OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 // The Browser Window's toolbar. | 43 // The Browser Window's toolbar. |
44 class ToolbarView : public views::AccessiblePaneView, | 44 class ToolbarView : public views::AccessiblePaneView, |
45 public views::MenuButtonListener, | 45 public views::MenuButtonListener, |
46 public ui::AcceleratorProvider, | 46 public ui::AcceleratorProvider, |
47 public LocationBarView::Delegate, | 47 public LocationBarView::Delegate, |
48 public content::NotificationObserver, | 48 public content::NotificationObserver, |
49 public CommandObserver, | 49 public CommandObserver, |
50 public views::ButtonListener, | 50 public views::ButtonListener, |
51 public views::WidgetObserver { | 51 public views::WidgetObserver, |
| 52 public views::ViewTargeterDelegate { |
52 public: | 53 public: |
53 // The view class name. | 54 // The view class name. |
54 static const char kViewClassName[]; | 55 static const char kViewClassName[]; |
55 | 56 |
56 explicit ToolbarView(Browser* browser); | 57 explicit ToolbarView(Browser* browser); |
57 virtual ~ToolbarView(); | 58 virtual ~ToolbarView(); |
58 | 59 |
59 // Create the contents of the Browser Toolbar. | 60 // Create the contents of the Browser Toolbar. |
60 void Init(); | 61 void Init(); |
61 | 62 |
(...skipping 28 matching lines...) Expand all Loading... |
90 // Executes |command| registered by |extension|. | 91 // Executes |command| registered by |extension|. |
91 void ExecuteExtensionCommand(const extensions::Extension* extension, | 92 void ExecuteExtensionCommand(const extensions::Extension* extension, |
92 const extensions::Command& command); | 93 const extensions::Command& command); |
93 | 94 |
94 // Shows the extension's page action, if present. | 95 // Shows the extension's page action, if present. |
95 void ShowPageActionPopup(const extensions::Extension* extension); | 96 void ShowPageActionPopup(const extensions::Extension* extension); |
96 | 97 |
97 // Shows the extension's browser action, if present. | 98 // Shows the extension's browser action, if present. |
98 void ShowBrowserActionPopup(const extensions::Extension* extension); | 99 void ShowBrowserActionPopup(const extensions::Extension* extension); |
99 | 100 |
100 // Accessors... | 101 // Accessors. |
101 Browser* browser() const { return browser_; } | 102 Browser* browser() const { return browser_; } |
102 BrowserActionsContainer* browser_actions() const { return browser_actions_; } | 103 BrowserActionsContainer* browser_actions() const { return browser_actions_; } |
103 ReloadButton* reload_button() const { return reload_; } | 104 ReloadButton* reload_button() const { return reload_; } |
104 LocationBarView* location_bar() const { return location_bar_; } | 105 LocationBarView* location_bar() const { return location_bar_; } |
105 views::MenuButton* app_menu() const; | 106 views::MenuButton* app_menu() const; |
106 HomeButton* home_button() const { return home_; } | 107 HomeButton* home_button() const { return home_; } |
107 | 108 |
108 // Overridden from AccessiblePaneView | 109 // AccessiblePaneView: |
109 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE; | 110 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE; |
110 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 111 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
111 | 112 |
112 // Overridden from views::MenuButtonListener: | 113 // views::MenuButtonListener: |
113 virtual void OnMenuButtonClicked(views::View* source, | 114 virtual void OnMenuButtonClicked(views::View* source, |
114 const gfx::Point& point) OVERRIDE; | 115 const gfx::Point& point) OVERRIDE; |
115 | 116 |
116 // Overridden from LocationBarView::Delegate: | 117 // LocationBarView::Delegate: |
117 virtual content::WebContents* GetWebContents() OVERRIDE; | 118 virtual content::WebContents* GetWebContents() OVERRIDE; |
118 virtual ToolbarModel* GetToolbarModel() OVERRIDE; | 119 virtual ToolbarModel* GetToolbarModel() OVERRIDE; |
119 virtual const ToolbarModel* GetToolbarModel() const OVERRIDE; | 120 virtual const ToolbarModel* GetToolbarModel() const OVERRIDE; |
120 virtual InstantController* GetInstant() OVERRIDE; | 121 virtual InstantController* GetInstant() OVERRIDE; |
121 virtual views::Widget* CreateViewsBubble( | 122 virtual views::Widget* CreateViewsBubble( |
122 views::BubbleDelegateView* bubble_delegate) OVERRIDE; | 123 views::BubbleDelegateView* bubble_delegate) OVERRIDE; |
123 virtual PageActionImageView* CreatePageActionImageView( | 124 virtual PageActionImageView* CreatePageActionImageView( |
124 LocationBarView* owner, ExtensionAction* action) OVERRIDE; | 125 LocationBarView* owner, ExtensionAction* action) OVERRIDE; |
125 virtual ContentSettingBubbleModelDelegate* | 126 virtual ContentSettingBubbleModelDelegate* |
126 GetContentSettingBubbleModelDelegate() OVERRIDE; | 127 GetContentSettingBubbleModelDelegate() OVERRIDE; |
127 virtual void ShowWebsiteSettings(content::WebContents* web_contents, | 128 virtual void ShowWebsiteSettings(content::WebContents* web_contents, |
128 const GURL& url, | 129 const GURL& url, |
129 const content::SSLStatus& ssl) OVERRIDE; | 130 const content::SSLStatus& ssl) OVERRIDE; |
130 | 131 |
131 // Overridden from CommandObserver: | 132 // CommandObserver: |
132 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; | 133 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
133 | 134 |
134 // Overridden from views::ButtonListener: | 135 // views::ButtonListener: |
135 virtual void ButtonPressed(views::Button* sender, | 136 virtual void ButtonPressed(views::Button* sender, |
136 const ui::Event& event) OVERRIDE; | 137 const ui::Event& event) OVERRIDE; |
137 | 138 |
138 // Overridden from views::WidgetObserver: | 139 // views::WidgetObserver: |
139 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 140 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
140 bool visible) OVERRIDE; | 141 bool visible) OVERRIDE; |
141 | 142 |
142 // Overridden from content::NotificationObserver: | 143 // content::NotificationObserver: |
143 virtual void Observe(int type, | 144 virtual void Observe(int type, |
144 const content::NotificationSource& source, | 145 const content::NotificationSource& source, |
145 const content::NotificationDetails& details) OVERRIDE; | 146 const content::NotificationDetails& details) OVERRIDE; |
146 | 147 |
147 // Overridden from ui::AcceleratorProvider: | 148 // ui::AcceleratorProvider: |
148 virtual bool GetAcceleratorForCommandId( | 149 virtual bool GetAcceleratorForCommandId( |
149 int command_id, ui::Accelerator* accelerator) OVERRIDE; | 150 int command_id, ui::Accelerator* accelerator) OVERRIDE; |
150 | 151 |
151 // Overridden from views::View: | 152 // views::View: |
152 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 153 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
153 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 154 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
154 virtual void Layout() OVERRIDE; | 155 virtual void Layout() OVERRIDE; |
155 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | |
156 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 156 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
157 virtual void OnThemeChanged() OVERRIDE; | 157 virtual void OnThemeChanged() OVERRIDE; |
158 virtual const char* GetClassName() const OVERRIDE; | 158 virtual const char* GetClassName() const OVERRIDE; |
159 virtual bool AcceleratorPressed(const ui::Accelerator& acc) OVERRIDE; | 159 virtual bool AcceleratorPressed(const ui::Accelerator& acc) OVERRIDE; |
160 | 160 |
161 // Whether the wrench/hotdogs menu is currently showing. | 161 // Whether the wrench/hotdogs menu is currently showing. |
162 bool IsWrenchMenuShowing() const; | 162 bool IsWrenchMenuShowing() const; |
163 | 163 |
164 // Whether the toolbar view needs its background painted by the | 164 // Whether the toolbar view needs its background painted by the |
165 // BrowserNonClientFrameView. | 165 // BrowserNonClientFrameView. |
166 bool ShouldPaintBackground() const; | 166 bool ShouldPaintBackground() const; |
167 | 167 |
168 enum { | 168 enum { |
169 // The apparent horizontal space between most items, and the vertical | 169 // The apparent horizontal space between most items, and the vertical |
170 // padding above and below them. | 170 // padding above and below them. |
171 kStandardSpacing = 3, | 171 kStandardSpacing = 3, |
172 | 172 |
173 // The top of the toolbar has an edge we have to skip over in addition to | 173 // The top of the toolbar has an edge we have to skip over in addition to |
174 // the standard spacing. | 174 // the standard spacing. |
175 kVertSpacing = 5, | 175 kVertSpacing = 5, |
176 }; | 176 }; |
177 | 177 |
178 protected: | 178 protected: |
179 // Overridden from AccessiblePaneView | 179 // AccessiblePaneView: |
180 virtual bool SetPaneFocusAndFocusDefault() OVERRIDE; | 180 virtual bool SetPaneFocusAndFocusDefault() OVERRIDE; |
181 virtual void RemovePaneFocus() OVERRIDE; | 181 virtual void RemovePaneFocus() OVERRIDE; |
182 | 182 |
183 private: | 183 private: |
184 // Types of display mode this toolbar can have. | 184 // Types of display mode this toolbar can have. |
185 enum DisplayMode { | 185 enum DisplayMode { |
186 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. | 186 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. |
187 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location | 187 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location |
188 // bar, used for popups. | 188 // bar, used for popups. |
189 }; | 189 }; |
190 | 190 |
| 191 // views::ViewTargeterDelegate: |
| 192 virtual bool DoesIntersectRect(const views::View* target, |
| 193 const gfx::Rect& rect) const OVERRIDE; |
| 194 |
191 // Returns true if we should show the upgrade recommended dot. | 195 // Returns true if we should show the upgrade recommended dot. |
192 bool ShouldShowUpgradeRecommended(); | 196 bool ShouldShowUpgradeRecommended(); |
193 | 197 |
194 // Returns true if we should show the background page badge. | 198 // Returns true if we should show the background page badge. |
195 bool ShouldShowBackgroundPageBadge(); | 199 bool ShouldShowBackgroundPageBadge(); |
196 | 200 |
197 // Returns true if we should show the warning for incompatible software. | 201 // Returns true if we should show the warning for incompatible software. |
198 bool ShouldShowIncompatibilityWarning(); | 202 bool ShouldShowIncompatibilityWarning(); |
199 | 203 |
200 // Returns the number of pixels above the location bar in non-normal display. | 204 // Returns the number of pixels above the location bar in non-normal display. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 260 |
257 // A list of listeners to call when the menu opens. | 261 // A list of listeners to call when the menu opens. |
258 ObserverList<views::MenuListener> menu_listeners_; | 262 ObserverList<views::MenuListener> menu_listeners_; |
259 | 263 |
260 content::NotificationRegistrar registrar_; | 264 content::NotificationRegistrar registrar_; |
261 | 265 |
262 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 266 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
263 }; | 267 }; |
264 | 268 |
265 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ | 269 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
OLD | NEW |