OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/prefs/public/pref_observer.h" |
13 #include "chrome/browser/api/prefs/pref_member.h" | 14 #include "chrome/browser/api/prefs/pref_member.h" |
14 #include "chrome/browser/command_observer.h" | 15 #include "chrome/browser/command_observer.h" |
15 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 16 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
17 #include "chrome/browser/ui/views/reload_button.h" | 18 #include "chrome/browser/ui/views/reload_button.h" |
18 #include "ui/base/accelerators/accelerator.h" | 19 #include "ui/base/accelerators/accelerator.h" |
19 #include "ui/base/animation/slide_animation.h" | 20 #include "ui/base/animation/slide_animation.h" |
20 #include "ui/views/accessible_pane_view.h" | 21 #include "ui/views/accessible_pane_view.h" |
21 #include "ui/views/controls/button/menu_button.h" | 22 #include "ui/views/controls/button/menu_button.h" |
22 #include "ui/views/controls/button/menu_button_listener.h" | 23 #include "ui/views/controls/button/menu_button_listener.h" |
23 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
24 | 25 |
25 class BrowserActionsContainer; | 26 class BrowserActionsContainer; |
26 class Browser; | 27 class Browser; |
27 class WrenchMenu; | 28 class WrenchMenu; |
28 class WrenchMenuModel; | 29 class WrenchMenuModel; |
29 | 30 |
30 namespace views { | 31 namespace views { |
31 class MenuListener; | 32 class MenuListener; |
32 } | 33 } |
33 | 34 |
34 // The Browser Window's toolbar. | 35 // The Browser Window's toolbar. |
35 class ToolbarView : public views::AccessiblePaneView, | 36 class ToolbarView : public views::AccessiblePaneView, |
36 public views::MenuButtonListener, | 37 public views::MenuButtonListener, |
37 public ui::AcceleratorProvider, | 38 public ui::AcceleratorProvider, |
38 public LocationBarView::Delegate, | 39 public LocationBarView::Delegate, |
39 public content::NotificationObserver, | 40 public content::NotificationObserver, |
40 public CommandObserver, | 41 public CommandObserver, |
41 public views::ButtonListener, | 42 public views::ButtonListener, |
42 public views::WidgetObserver { | 43 public views::WidgetObserver, |
| 44 public PrefObserver { |
43 public: | 45 public: |
44 // The view class name. | 46 // The view class name. |
45 static const char kViewClassName[]; | 47 static const char kViewClassName[]; |
46 | 48 |
47 explicit ToolbarView(Browser* browser); | 49 explicit ToolbarView(Browser* browser); |
48 virtual ~ToolbarView(); | 50 virtual ~ToolbarView(); |
49 | 51 |
50 // Create the contents of the Browser Toolbar. | 52 // Create the contents of the Browser Toolbar. |
51 void Init(); | 53 void Init(); |
52 | 54 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 120 |
119 // Overridden from views::WidgetObserver: | 121 // Overridden from views::WidgetObserver: |
120 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 122 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
121 bool visible) OVERRIDE; | 123 bool visible) OVERRIDE; |
122 | 124 |
123 // Overridden from content::NotificationObserver: | 125 // Overridden from content::NotificationObserver: |
124 virtual void Observe(int type, | 126 virtual void Observe(int type, |
125 const content::NotificationSource& source, | 127 const content::NotificationSource& source, |
126 const content::NotificationDetails& details) OVERRIDE; | 128 const content::NotificationDetails& details) OVERRIDE; |
127 | 129 |
| 130 // Overridden from PrefObserver: |
| 131 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 132 const std::string& pref_name) OVERRIDE; |
| 133 |
128 // Overridden from ui::AcceleratorProvider: | 134 // Overridden from ui::AcceleratorProvider: |
129 virtual bool GetAcceleratorForCommandId( | 135 virtual bool GetAcceleratorForCommandId( |
130 int command_id, ui::Accelerator* accelerator) OVERRIDE; | 136 int command_id, ui::Accelerator* accelerator) OVERRIDE; |
131 | 137 |
132 // Overridden from views::View: | 138 // Overridden from views::View: |
133 virtual gfx::Size GetPreferredSize() OVERRIDE; | 139 virtual gfx::Size GetPreferredSize() OVERRIDE; |
134 virtual void Layout() OVERRIDE; | 140 virtual void Layout() OVERRIDE; |
135 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 141 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
136 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 142 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
137 virtual bool GetDropFormats( | 143 virtual bool GetDropFormats( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 233 |
228 // A list of listeners to call when the menu opens. | 234 // A list of listeners to call when the menu opens. |
229 ObserverList<views::MenuListener> menu_listeners_; | 235 ObserverList<views::MenuListener> menu_listeners_; |
230 | 236 |
231 content::NotificationRegistrar registrar_; | 237 content::NotificationRegistrar registrar_; |
232 | 238 |
233 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 239 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
234 }; | 240 }; |
235 | 241 |
236 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 242 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
OLD | NEW |