location_bar_view.h revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector>
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h"
1258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "base/memory/weak_ptr.h"
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/prefs/pref_member.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/extensions/extension_context_menu_model.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/search_engines/template_url_service_observer.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/omnibox/location_bar.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "chrome/browser/ui/search/search_model_observer.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/toolbar/toolbar_model.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/dropdown_bar_host.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/dropdown_bar_host_delegate.h"
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/extensions/extension_popup.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_observer.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_registrar.h"
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/font.h"
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/rect.h"
277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "ui/views/controls/button/button.h"
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/controls/native/native_view_host.h"
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/drag_controller.h"
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(USE_AURA)
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/compositor/layer_animation_observer.h"
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ActionBoxButtonView;
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CommandUpdater;
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ContentSettingBubbleModelDelegate;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ContentSettingImageView;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class EVBubbleView;
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ExtensionAction;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class GURL;
42ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdochclass GeneratedCreditCardView;
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class InstantController;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class KeywordHintView;
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class LocationIconView;
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class OpenPDFInReaderView;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PageActionWithBadgeView;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PageActionImageView;
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile;
502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ScriptBubbleIconView;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SelectedKeywordView;
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class StarView;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TemplateURLService;
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ZoomView;
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views {
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BubbleDelegateView;
58ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdochclass ImageButton;
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Label;
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Widget;
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/////////////////////////////////////////////////////////////////////////////
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// LocationBarView class
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   The LocationBarView class is a View subclass that paints the background
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   of the URL bar strip and contains its content.
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/////////////////////////////////////////////////////////////////////////////
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class LocationBarView : public LocationBar,
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public LocationBarTesting,
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public views::View,
747dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                        public views::ButtonListener,
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public views::DragController,
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public OmniboxEditController,
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public DropdownBarHostDelegate,
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public TemplateURLServiceObserver,
797dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                        public content::NotificationObserver,
807dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                        public SearchModelObserver {
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The location bar view's class name.
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static const char kViewClassName[];
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
8590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // DropdownBarHostDelegate:
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetFocusAndSelection(bool select_all) OVERRIDE;
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetAnimationOffset(int offset) OVERRIDE;
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the offset used while animating.
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int animation_offset() const { return animation_offset_; }
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  class Delegate {
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    // Should return the current web contents.
953551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    virtual content::WebContents* GetWebContents() = 0;
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Returns the InstantController, or NULL if there isn't one.
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual InstantController* GetInstant() = 0;
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1003551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    virtual ToolbarModel* GetToolbarModel() = 0;
1013551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    virtual const ToolbarModel* GetToolbarModel() const = 0;
1023551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Creates Widget for the given delegate.
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual views::Widget* CreateViewsBubble(
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        views::BubbleDelegateView* bubble_delegate) = 0;
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Creates PageActionImageView. Caller gets an ownership.
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual PageActionImageView* CreatePageActionImageView(
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        LocationBarView* owner,
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        ExtensionAction* action) = 0;
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Returns ContentSettingBubbleModelDelegate.
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ContentSettingBubbleModelDelegate*
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        GetContentSettingBubbleModelDelegate() = 0;
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    // Shows permissions and settings for the given web contents.
1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    virtual void ShowWebsiteSettings(content::WebContents* web_contents,
1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                     const GURL& url,
1197dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                                     const content::SSLStatus& ssl) = 0;
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   protected:
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ~Delegate() {}
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum ColorKind {
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    BACKGROUND = 0,
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    TEXT,
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SELECTED_TEXT,
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    DEEMPHASIZED_TEXT,
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SECURITY_TEXT,
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  LocationBarView(Browser* browser,
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                  Profile* profile,
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                  CommandUpdater* command_updater,
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                  Delegate* delegate,
13790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                  bool is_popup_mode);
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~LocationBarView();
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
141ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // Uses GetBuiltInHorizontalPaddingForChildViews() to optionally add
142ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // additional padding (via an empty border) to |view|. This should be called
143ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // during creation on all child views which are potentially touchable so that
144ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // when touch is enabled they will have sufficient padding.
145ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  static void InitTouchableLocationBarChildView(views::View* view);
146ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Initializes the LocationBarView.
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Init();
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if this instance has been initialized by calling Init, which can only
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be called when the receiving instance is attached to a view container.
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsInitialized() const;
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the appropriate color for the desired kind, based on the user's
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // system theme.
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SkColor GetColor(ToolbarModel::SecurityLevel security_level,
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                   ColorKind kind) const;
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns corresponding profile.
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Profile* profile() const { return profile_; }
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the delegate.
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Delegate* delegate() const { return delegate_; }
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // See comment in browser_window.h for more info.
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ZoomChangedForActiveTab(bool can_show_bubble);
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // The zoom icon view. It may not be visible.
1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ZoomView* zoom_view() { return zoom_view_; }
1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets |preview_enabled| for the PageAction View associated with this
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |page_action|. If |preview_enabled| is true, the view will display the
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // PageActions icon even though it has not been activated by the extension.
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is used by the ExtensionInstalledBubble to preview what the icon
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // will look like for the user upon installation of the extension.
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetPreviewEnabledPageAction(ExtensionAction* page_action,
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   bool preview_enabled);
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Retrieves the PageAction View which is associated with |page_action|.
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::View* GetPageActionView(ExtensionAction* page_action);
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Toggles the star on or off.
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetStarToggled(bool on);
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the star view. It may not be visible.
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  StarView* star_view() { return star_view_; }
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Shows the bookmark prompt.
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ShowBookmarkPrompt();
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the screen coordinates of the location entry (where the URL text
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // appears, not where the icons are shown).
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::Point GetLocationEntryOrigin() const;
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Shows |text| as an inline autocompletion.  This is useful for IMEs, where
196868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // we can't show the autocompletion inside the actual OmniboxView.  See
197868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // comments on |ime_inline_autocomplete_view_|.
198868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  void SetImeInlineAutocompletion(const string16& text);
199868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
2007dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Invoked from OmniboxViewWin to show gray text autocompletion.
2017dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  void SetGrayTextAutocompletion(const string16& text);
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2037dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Returns the current gray text autocompletion.
2047dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  string16 GetGrayTextAutocompletion() const;
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets whether the location entry can accept focus.
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetLocationEntryFocusable(bool focusable);
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the location entry is focusable and visible in
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the root view.
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsLocationEntryFocusableInRootView() const;
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sizing functions
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::Size GetPreferredSize() OVERRIDE;
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Layout and Painting functions
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Layout() OVERRIDE;
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // No focus border for the location bar, the caret is enough.
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE { }
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set if we should show a focus rect while the location entry field is
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // focused. Used when the toolbar is in full keyboard accessibility mode.
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Repaints if necessary.
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetShowFocusRect(bool show);
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Select all of the text. Needed when the user tabs through controls
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in the toolbar in full keyboard accessibility mode.
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SelectAll();
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_WIN) && !defined(USE_AURA)
2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Event Handlers
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnMouseCaptureLost() OVERRIDE;
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  LocationIconView* location_icon_view() { return location_icon_view_; }
2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const LocationIconView* location_icon_view() const {
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return location_icon_view_;
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::View* location_entry_view() const { return location_entry_view_; }
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
247ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  views::View* generated_credit_card_view();
2487dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
24990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // OmniboxEditController:
2504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void Update(const content::WebContents* contents) OVERRIDE;
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnChanged() OVERRIDE;
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnSetFocus() OVERRIDE;
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual InstantController* GetInstant() OVERRIDE;
2543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual content::WebContents* GetWebContents() OVERRIDE;
2553551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual ToolbarModel* GetToolbarModel() OVERRIDE;
2563551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual const ToolbarModel* GetToolbarModel() const OVERRIDE;
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
25890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // views::View:
259b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual const char* GetClassName() const OVERRIDE;
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool SkipDefaultKeyEventProcessing(
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ui::KeyEvent& event) OVERRIDE;
2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool HasFocus() const OVERRIDE;
2642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2667dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // views::ButtonListener:
2677dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void ButtonPressed(views::Button* sender,
2687dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                             const ui::Event& event) OVERRIDE;
2697dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
27090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // views::DragController:
2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void WriteDragDataForView(View* sender,
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                    const gfx::Point& press_pt,
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                    OSExchangeData* data) OVERRIDE;
2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetDragOperationsForView(View* sender,
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                       const gfx::Point& p) OVERRIDE;
2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanStartDragForView(View* sender,
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   const gfx::Point& press_pt,
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   const gfx::Point& p) OVERRIDE;
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
28090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // LocationBar:
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowFirstRunBubble() OVERRIDE;
2824e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual GURL GetDestinationURL() const OVERRIDE;
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual WindowOpenDisposition GetWindowOpenDisposition() const OVERRIDE;
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual content::PageTransition GetPageTransition() const OVERRIDE;
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void AcceptInput() OVERRIDE;
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void FocusLocation(bool select_all) OVERRIDE;
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void FocusSearch() OVERRIDE;
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdateContentSettingsIcons() OVERRIDE;
2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdatePageActions() OVERRIDE;
2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void InvalidatePageActions() OVERRIDE;
2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE;
292ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  virtual void UpdateGeneratedCreditCardView() OVERRIDE;
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE;
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Revert() OVERRIDE;
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual const OmniboxView* GetLocationEntry() const OVERRIDE;
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual OmniboxView* GetLocationEntry() OVERRIDE;
2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE;
2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
29990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // LocationBarTesting:
3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int PageActionCount() OVERRIDE;
3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int PageActionVisibleCount() OVERRIDE;
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE;
3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void TestPageActionPressed(size_t index) OVERRIDE;
3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool GetBookmarkStarVisibility() OVERRIDE;
3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
30790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // TemplateURLServiceObserver:
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnTemplateURLServiceChanged() OVERRIDE;
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
31090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // content::NotificationObserver:
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Observe(int type,
3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       const content::NotificationSource& source,
3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       const content::NotificationDetails& details) OVERRIDE;
3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // SearchModelObserver:
3167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void ModelChanged(const SearchModel::State& old_state,
3177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                            const SearchModel::State& new_state) OVERRIDE;
3187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the height of the control without the top and bottom
3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // edges(i.e.  the height of the edit control inside).  If
3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |use_preferred_size| is true this will be the preferred height,
3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // otherwise it will be the current height.
3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int GetInternalHeight(bool use_preferred_size);
3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
325868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Returns the position and width that the popup should be, and also the left
326868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // edge that the results should align themselves to (which will leave some
327868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // border on the left of the popup).
328ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  void GetOmniboxPopupPositioningInfo(gfx::Point* top_left_screen_coord,
329ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch                                      int* popup_width,
330ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch                                      int* left_margin,
331ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch                                      int* right_margin);
332868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
333868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Space between items in the location bar, as well as between items and the
334868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // edges.
3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static int GetItemPadding();
3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
337868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Thickness of the edges of the omnibox background images, in normal mode.
338868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  static const int kNormalEdgeThickness;
33990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // The same, but for popup mode.
34090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  static const int kPopupEdgeThickness;
3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Amount of padding built into the standard omnibox icons.
3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static const int kIconInternalPadding;
3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Space between the edge and a bubble.
34490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  static const int kBubblePadding;
3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnFocus() OVERRIDE;
3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef std::vector<ContentSettingImageView*> ContentSettingViews;
3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class PageActionImageView;
3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class PageActionWithBadgeView;
3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef std::vector<PageActionWithBadgeView*> PageActionViews;
3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
356ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // Returns the number of pixels of built-in padding to the left and right for
357ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // child views. This is nonzero when touch UI is enabled so as to space out
358ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // child views for easier targeting. See InitTouchableLocationBarChildView().
359ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  static int GetBuiltInHorizontalPaddingForChildViews();
360ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
36190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Returns the thickness of any visible left and right edge, in pixels.
36290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  int GetHorizontalEdgeThickness() const;
36390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
36490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // The same, but for the top and bottom edges.
36590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  int vertical_edge_thickness() const {
366868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    return is_popup_mode_ ? kPopupEdgeThickness : kNormalEdgeThickness;
36790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
36890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
36958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Updates the visibility state of the Content Blocked icons to reflect what
37058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // is actually blocked on the current page. Calling this function should
37158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // always eventually be followed by calling Layout() and then
37258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // UpdateContentSettingViewsPostLayout(), to ensure the icons can completely
37358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // update their states.
37458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  void UpdateContentSettingViewsPreLayout();
37558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
37658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Updates after the correct screen coordinates have been set for icons.
37758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Allows content setting icons to perform any updating which can't complete
37858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // until after the icons have been correctly laid out.  This should be called
37958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // after UpdateContentSettingViewsPreLayout() and a subsequent Layout().
38058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  void UpdateContentSettingViewsPostLayout();
3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Delete all page action views that we have created.
3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DeletePageActionViews();
3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Update the views for the Page Actions, to reflect state changes for
3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // PageActions.
3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RefreshPageActionViews();
3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns the number of scripts currently running on the page.
3902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  size_t ScriptBubbleScriptsRunning();
3912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Update the Script Bubble Icon, to reflect the number of content scripts
3932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // running on the page.
3942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void RefreshScriptBubble();
3952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Update the view for the zoom icon based on the current tab's zoom.
3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RefreshZoomView();
3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if !defined(USE_AURA)
4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Helper for the Mouse event handlers that does all the real work.
4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void OnMouseEvent(const ui::MouseEvent& event, UINT msg);
4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the suggest text is valid.
4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool HasValidSuggestText() const;
4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Helper to show the first run info bubble.
4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ShowFirstRunBubbleInternal();
4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Draw backgrounds and borders for page actions.  Must be called
4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // after layout, so the |page_action_views_| have their bounds.
4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PaintPageActionBackgrounds(gfx::Canvas* canvas);
4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
41458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Handles a request to change the value of this text field from software
41558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // using an accessibility API (typically automation software, screen readers
41658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // don't normally use this). Sets the value and clears the selection.
41758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  void AccessibilitySetValue(const string16& new_value);
41858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The Browser this LocationBarView is in.  Note that at least
4205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser
4215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // window, so this may be NULL.
4225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Browser* browser_;
4235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The Autocomplete Edit field.
4255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<OmniboxView> location_entry_;
4265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The profile which corresponds to this View.
4285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Profile* profile_;
4295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Our delegate.
4315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Delegate* delegate_;
4325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // An object used to paint the normal-mode background.
434868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  scoped_ptr<views::Painter> background_border_painter_;
435868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  scoped_ptr<views::Painter> background_filling_painter_;
4365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // An icon to the left of the edit field.
4385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  LocationIconView* location_icon_view_;
4395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A bubble displayed for EV HTTPS sites.
4415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  EVBubbleView* ev_bubble_view_;
4425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Location_entry view
4445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::View* location_entry_view_;
4455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
446868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // A view to show inline autocompletion when an IME is active.  In this case,
447868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // we shouldn't change the text or selection inside the OmniboxView itself,
448868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // since this will conflict with the IME's control over the text.  So instead
449868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // we show any autocompletion in a separate field after the OmniboxView.
450868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  views::Label* ime_inline_autocomplete_view_;
451868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
4525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The following views are used to provide hints and remind the user as to
4535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // what is going in the edit. They are all added a children of the
4545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // LocationBarView. At most one is visible at a time. Preference is
4555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // given to the keyword_view_, then hint_view_.
4565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These autocollapse when the edit needs the room.
4575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Shown if the user has selected a keyword.
4595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SelectedKeywordView* selected_keyword_view_;
4605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // View responsible for showing suggested text. This is NULL when there is no
4625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // suggested text.
4635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::Label* suggested_text_view_;
4645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Shown if the selected url has a corresponding keyword.
4665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  KeywordHintView* keyword_hint_view_;
4675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4687dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // The voice search icon.
469ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  views::ImageButton* mic_search_view_;
4707dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
4715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The content setting views.
4725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ContentSettingViews content_setting_views_;
4735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The zoom icon.
4755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ZoomView* zoom_view_;
4765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
477ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // A bubble that shows after successfully generating a new credit card number.
478ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  GeneratedCreditCardView* generated_credit_card_view_;
4797dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
4805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The icon to open a PDF in Reader.
4815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  OpenPDFInReaderView* open_pdf_in_reader_view_;
4825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The current page actions.
4845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  std::vector<ExtensionAction*> page_actions_;
4855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The page action icon views.
4875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PageActionViews page_action_views_;
4885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // The script bubble.
4902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ScriptBubbleIconView* script_bubble_icon_view_;
4912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The star.
4935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  StarView* star_view_;
4945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4954e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Whether we're in popup mode. This value also controls whether the location
4964e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // bar is read-only.
49790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const bool is_popup_mode_;
4985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if we should show a focus rect while the location entry field is
5005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // focused. Used when the toolbar is in full keyboard accessibility mode.
5015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool show_focus_rect_;
5025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is in case we're destroyed before the model loads. We need to make
5045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Add/RemoveObserver calls.
5055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  TemplateURLService* template_url_service_;
5065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Tracks this preference to determine whether bookmark editing is allowed.
5085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BooleanPrefMember edit_bookmarks_enabled_;
5095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // While animating, the host clips the widget and draws only the bottom
5115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // part of it. The view needs to know the pixel offset at which we are drawing
5125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the widget so that we can draw the curved edges that attach to the toolbar
5135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in the right location.
5145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int animation_offset_;
5155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used to register for notifications received by NotificationObserver.
5175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  content::NotificationRegistrar registrar_;
5185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
51958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Used to bind callback functions to this object.
52058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  base::WeakPtrFactory<LocationBarView> weak_ptr_factory_;
52158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
52290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(LocationBarView);
5235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
5245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
526