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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_updater.h" |
15 #include "chrome/browser/prefs/pref_member.h" | 15 #include "chrome/browser/prefs/pref_member.h" |
16 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 16 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
18 #include "chrome/browser/ui/views/reload_button.h" | 18 #include "chrome/browser/ui/views/reload_button.h" |
19 #include "ui/base/accelerators/accelerator.h" | 19 #include "ui/base/accelerators/accelerator.h" |
20 #include "ui/base/animation/slide_animation.h" | 20 #include "ui/base/animation/slide_animation.h" |
21 #include "ui/views/accessible_pane_view.h" | 21 #include "ui/views/accessible_pane_view.h" |
22 #include "ui/views/controls/button/menu_button.h" | 22 #include "ui/views/controls/button/menu_button.h" |
23 #include "ui/views/controls/button/menu_button_delegate.h" | 23 #include "ui/views/controls/button/menu_button_listener.h" |
24 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
25 | 25 |
26 class BrowserActionsContainer; | 26 class BrowserActionsContainer; |
27 class Browser; | 27 class Browser; |
28 class WrenchMenu; | 28 class WrenchMenu; |
29 | 29 |
30 namespace views { | 30 namespace views { |
31 class MenuListener; | 31 class MenuListener; |
32 } | 32 } |
33 | 33 |
34 // The Browser Window's toolbar. | 34 // The Browser Window's toolbar. |
35 class ToolbarView : public views::AccessiblePaneView, | 35 class ToolbarView : public views::AccessiblePaneView, |
36 public views::MenuButtonDelegate, | 36 public views::MenuButtonListener, |
37 public ui::AcceleratorProvider, | 37 public ui::AcceleratorProvider, |
38 public LocationBarView::Delegate, | 38 public LocationBarView::Delegate, |
39 public content::NotificationObserver, | 39 public content::NotificationObserver, |
40 public CommandUpdater::CommandObserver, | 40 public CommandUpdater::CommandObserver, |
41 public views::ButtonListener { | 41 public views::ButtonListener { |
42 public: | 42 public: |
43 // The view class name. | 43 // The view class name. |
44 static const char kViewClassName[]; | 44 static const char kViewClassName[]; |
45 | 45 |
46 explicit ToolbarView(Browser* browser); | 46 explicit ToolbarView(Browser* browser); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 Browser* browser() const { return browser_; } | 79 Browser* browser() const { return browser_; } |
80 BrowserActionsContainer* browser_actions() const { return browser_actions_; } | 80 BrowserActionsContainer* browser_actions() const { return browser_actions_; } |
81 ReloadButton* reload_button() const { return reload_; } | 81 ReloadButton* reload_button() const { return reload_; } |
82 LocationBarView* location_bar() const { return location_bar_; } | 82 LocationBarView* location_bar() const { return location_bar_; } |
83 views::MenuButton* app_menu() const { return app_menu_; } | 83 views::MenuButton* app_menu() const { return app_menu_; } |
84 | 84 |
85 // Overridden from AccessiblePaneView | 85 // Overridden from AccessiblePaneView |
86 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE; | 86 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE; |
87 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 87 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
88 | 88 |
89 // Overridden from views::MenuButtonDelegate: | 89 // Overridden from views::MenuButtonListener: |
90 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; | 90 virtual void OnMenuButtonClicked(views::View* source, |
| 91 const gfx::Point& point) OVERRIDE; |
91 | 92 |
92 // Overridden from LocationBarView::Delegate: | 93 // Overridden from LocationBarView::Delegate: |
93 virtual TabContentsWrapper* GetTabContentsWrapper() const OVERRIDE; | 94 virtual TabContentsWrapper* GetTabContentsWrapper() const OVERRIDE; |
94 virtual InstantController* GetInstant() OVERRIDE; | 95 virtual InstantController* GetInstant() OVERRIDE; |
95 virtual void OnInputInProgress(bool in_progress) OVERRIDE; | 96 virtual void OnInputInProgress(bool in_progress) OVERRIDE; |
96 | 97 |
97 // Overridden from CommandUpdater::CommandObserver: | 98 // Overridden from CommandUpdater::CommandObserver: |
98 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; | 99 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
99 | 100 |
100 // Overridden from views::BaseButton::ButtonListener: | 101 // Overridden from views::ButtonListener: |
101 virtual void ButtonPressed(views::Button* sender, const views::Event& event) | 102 virtual void ButtonPressed(views::Button* sender, |
102 OVERRIDE; | 103 const views::Event& event) OVERRIDE; |
103 | 104 |
104 // Overridden from content::NotificationObserver: | 105 // Overridden from content::NotificationObserver: |
105 virtual void Observe(int type, | 106 virtual void Observe(int type, |
106 const content::NotificationSource& source, | 107 const content::NotificationSource& source, |
107 const content::NotificationDetails& details) OVERRIDE; | 108 const content::NotificationDetails& details) OVERRIDE; |
108 | 109 |
109 // Overridden from ui::AcceleratorProvider: | 110 // Overridden from ui::AcceleratorProvider: |
110 virtual bool GetAcceleratorForCommandId( | 111 virtual bool GetAcceleratorForCommandId( |
111 int command_id, ui::Accelerator* accelerator) OVERRIDE; | 112 int command_id, ui::Accelerator* accelerator) OVERRIDE; |
112 | 113 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 203 |
203 // A list of listeners to call when the menu opens. | 204 // A list of listeners to call when the menu opens. |
204 ObserverList<views::MenuListener> menu_listeners_; | 205 ObserverList<views::MenuListener> menu_listeners_; |
205 | 206 |
206 content::NotificationRegistrar registrar_; | 207 content::NotificationRegistrar registrar_; |
207 | 208 |
208 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 209 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
209 }; | 210 }; |
210 | 211 |
211 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 212 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
OLD | NEW |