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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 // The Browser Window's toolbar. | 35 // The Browser Window's toolbar. |
36 class ToolbarView : public views::AccessiblePaneView, | 36 class ToolbarView : public views::AccessiblePaneView, |
37 public views::MenuButtonListener, | 37 public views::MenuButtonListener, |
38 public ui::AcceleratorProvider, | 38 public ui::AcceleratorProvider, |
39 public LocationBarView::Delegate, | 39 public LocationBarView::Delegate, |
40 public content::NotificationObserver, | 40 public content::NotificationObserver, |
41 public CommandObserver, | 41 public CommandObserver, |
42 public views::ButtonListener, | 42 public views::ButtonListener, |
| 43 public views::WidgetObserver, |
43 public views::ViewTargeterDelegate, | 44 public views::ViewTargeterDelegate, |
44 public AppMenuBadgeController::Delegate { | 45 public AppMenuBadgeController::Delegate { |
45 public: | 46 public: |
46 // The view class name. | 47 // The view class name. |
47 static const char kViewClassName[]; | 48 static const char kViewClassName[]; |
48 | 49 |
49 explicit ToolbarView(Browser* browser); | 50 explicit ToolbarView(Browser* browser); |
50 ~ToolbarView() override; | 51 ~ToolbarView() override; |
51 | 52 |
52 // Create the contents of the Browser Toolbar. | 53 // Create the contents of the Browser Toolbar. |
(...skipping 25 matching lines...) Expand all Loading... |
78 views::View* GetSaveCreditCardBubbleAnchor(); | 79 views::View* GetSaveCreditCardBubbleAnchor(); |
79 | 80 |
80 // Returns the view to which the Translate bubble should be anchored. | 81 // Returns the view to which the Translate bubble should be anchored. |
81 views::View* GetTranslateBubbleAnchor(); | 82 views::View* GetTranslateBubbleAnchor(); |
82 | 83 |
83 // Adds |anchor_view| as an observer of |bubble_widget| to track its | 84 // Adds |anchor_view| as an observer of |bubble_widget| to track its |
84 // visibility. | 85 // visibility. |
85 void OnBubbleCreatedForAnchor(views::View* anchor_view, | 86 void OnBubbleCreatedForAnchor(views::View* anchor_view, |
86 views::Widget* bubble_widget); | 87 views::Widget* bubble_widget); |
87 | 88 |
| 89 // Executes |command| registered by |extension|. |
| 90 void ExecuteExtensionCommand(const extensions::Extension* extension, |
| 91 const extensions::Command& command); |
| 92 |
88 // Returns the maximum width the browser actions container can have. | 93 // Returns the maximum width the browser actions container can have. |
89 int GetMaxBrowserActionsWidth() const; | 94 int GetMaxBrowserActionsWidth() const; |
90 | 95 |
91 // Accessors. | 96 // Accessors. |
92 Browser* browser() const { return browser_; } | 97 Browser* browser() const { return browser_; } |
93 BrowserActionsContainer* browser_actions() const { return browser_actions_; } | 98 BrowserActionsContainer* browser_actions() const { return browser_actions_; } |
94 ReloadButton* reload_button() const { return reload_; } | 99 ReloadButton* reload_button() const { return reload_; } |
95 LocationBarView* location_bar() const { return location_bar_; } | 100 LocationBarView* location_bar() const { return location_bar_; } |
96 AppMenuButton* app_menu_button() const { return app_menu_button_; } | 101 AppMenuButton* app_menu_button() const { return app_menu_button_; } |
97 HomeButton* home_button() const { return home_; } | 102 HomeButton* home_button() const { return home_; } |
(...skipping 25 matching lines...) Expand all Loading... |
123 const GURL& url, | 128 const GURL& url, |
124 const security_state::SecurityStateModel::SecurityInfo& security_info) | 129 const security_state::SecurityStateModel::SecurityInfo& security_info) |
125 override; | 130 override; |
126 | 131 |
127 // CommandObserver: | 132 // CommandObserver: |
128 void EnabledStateChangedForCommand(int id, bool enabled) override; | 133 void EnabledStateChangedForCommand(int id, bool enabled) override; |
129 | 134 |
130 // views::ButtonListener: | 135 // views::ButtonListener: |
131 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 136 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
132 | 137 |
| 138 // views::WidgetObserver: |
| 139 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; |
| 140 |
133 // content::NotificationObserver: | 141 // content::NotificationObserver: |
134 void Observe(int type, | 142 void Observe(int type, |
135 const content::NotificationSource& source, | 143 const content::NotificationSource& source, |
136 const content::NotificationDetails& details) override; | 144 const content::NotificationDetails& details) override; |
137 | 145 |
138 // ui::AcceleratorProvider: | 146 // ui::AcceleratorProvider: |
139 bool GetAcceleratorForCommandId(int command_id, | 147 bool GetAcceleratorForCommandId(int command_id, |
140 ui::Accelerator* accelerator) override; | 148 ui::Accelerator* accelerator) override; |
141 | 149 |
142 // views::View: | 150 // views::View: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 void ShowCriticalNotification(); | 200 void ShowCriticalNotification(); |
193 | 201 |
194 // Shows the outdated install notification bubble against the app menu. | 202 // Shows the outdated install notification bubble against the app menu. |
195 // |auto_update_enabled| is set to true when auto-upate is on. | 203 // |auto_update_enabled| is set to true when auto-upate is on. |
196 void ShowOutdatedInstallNotification(bool auto_update_enabled); | 204 void ShowOutdatedInstallNotification(bool auto_update_enabled); |
197 | 205 |
198 void OnShowHomeButtonChanged(); | 206 void OnShowHomeButtonChanged(); |
199 | 207 |
200 int content_shadow_height() const; | 208 int content_shadow_height() const; |
201 | 209 |
202 // Controls. Most of these can be null, e.g. in popup windows. Only | 210 // Controls |
203 // |location_bar_| is guaranteed to exist. | |
204 BackButton* back_; | 211 BackButton* back_; |
205 ToolbarButton* forward_; | 212 ToolbarButton* forward_; |
206 ReloadButton* reload_; | 213 ReloadButton* reload_; |
207 HomeButton* home_; | 214 HomeButton* home_; |
208 LocationBarView* location_bar_; | 215 LocationBarView* location_bar_; |
209 BrowserActionsContainer* browser_actions_; | 216 BrowserActionsContainer* browser_actions_; |
210 AppMenuButton* app_menu_button_; | 217 AppMenuButton* app_menu_button_; |
211 | |
212 Browser* browser_; | 218 Browser* browser_; |
213 | 219 |
214 AppMenuBadgeController badge_controller_; | 220 AppMenuBadgeController badge_controller_; |
215 | 221 |
216 // Controls whether or not a home button should be shown on the toolbar. | 222 // Controls whether or not a home button should be shown on the toolbar. |
217 BooleanPrefMember show_home_button_; | 223 BooleanPrefMember show_home_button_; |
218 | 224 |
219 // The display mode used when laying out the toolbar. | 225 // The display mode used when laying out the toolbar. |
220 const DisplayMode display_mode_; | 226 DisplayMode display_mode_; |
221 | 227 |
222 content::NotificationRegistrar registrar_; | 228 content::NotificationRegistrar registrar_; |
223 | 229 |
224 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 230 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
225 }; | 231 }; |
226 | 232 |
227 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ | 233 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
OLD | NEW |