| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_TOOLBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/menus/simple_menu_model.h" | 10 #include "app/menus/simple_menu_model.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/app_menu_model.h" | 12 #include "chrome/browser/app_menu_model.h" |
| 13 #include "chrome/browser/back_forward_menu_model.h" | 13 #include "chrome/browser/back_forward_menu_model.h" |
| 14 #include "chrome/browser/bubble_positioner.h" | |
| 15 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_updater.h" |
| 16 #include "chrome/browser/page_menu_model.h" | 15 #include "chrome/browser/page_menu_model.h" |
| 17 #include "chrome/browser/pref_member.h" | 16 #include "chrome/browser/pref_member.h" |
| 18 #include "chrome/browser/views/accessible_toolbar_view.h" | 17 #include "chrome/browser/views/accessible_toolbar_view.h" |
| 19 #include "chrome/browser/views/go_button.h" | 18 #include "chrome/browser/views/go_button.h" |
| 20 #include "chrome/browser/views/location_bar_view.h" | 19 #include "chrome/browser/views/location_bar_view.h" |
| 21 #include "views/controls/button/menu_button.h" | 20 #include "views/controls/button/menu_button.h" |
| 22 #include "views/controls/menu/menu.h" | 21 #include "views/controls/menu/menu.h" |
| 23 #include "views/controls/menu/menu_wrapper.h" | 22 #include "views/controls/menu/menu_wrapper.h" |
| 24 #include "views/controls/menu/view_menu_delegate.h" | 23 #include "views/controls/menu/view_menu_delegate.h" |
| 25 #include "views/view.h" | 24 #include "views/view.h" |
| 26 | 25 |
| 27 class BrowserActionsContainer; | 26 class BrowserActionsContainer; |
| 28 class Browser; | 27 class Browser; |
| 29 class Profile; | 28 class Profile; |
| 30 | 29 |
| 31 namespace views { | 30 namespace views { |
| 32 class Menu2; | 31 class Menu2; |
| 33 } | 32 } |
| 34 | 33 |
| 35 // The Browser Window's toolbar. | 34 // The Browser Window's toolbar. |
| 36 class ToolbarView : public AccessibleToolbarView, | 35 class ToolbarView : public AccessibleToolbarView, |
| 37 public views::ViewMenuDelegate, | 36 public views::ViewMenuDelegate, |
| 38 public views::FocusChangeListener, | 37 public views::FocusChangeListener, |
| 39 public menus::SimpleMenuModel::Delegate, | 38 public menus::SimpleMenuModel::Delegate, |
| 40 public LocationBarView::Delegate, | 39 public LocationBarView::Delegate, |
| 41 public NotificationObserver, | 40 public NotificationObserver, |
| 42 public CommandUpdater::CommandObserver, | 41 public CommandUpdater::CommandObserver, |
| 43 public views::ButtonListener, | 42 public views::ButtonListener { |
| 44 public BubblePositioner { | |
| 45 public: | 43 public: |
| 46 explicit ToolbarView(Browser* browser); | 44 explicit ToolbarView(Browser* browser); |
| 47 virtual ~ToolbarView(); | 45 virtual ~ToolbarView(); |
| 48 | 46 |
| 49 // Create the contents of the Browser Toolbar | 47 // Create the contents of the Browser Toolbar |
| 50 void Init(Profile* profile); | 48 void Init(Profile* profile); |
| 51 | 49 |
| 52 // Sets the profile which is active on the currently-active tab. | 50 // Sets the profile which is active on the currently-active tab. |
| 53 void SetProfile(Profile* profile); | 51 void SetProfile(Profile* profile); |
| 54 Profile* profile() { return profile_; } | 52 Profile* profile() { return profile_; } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Overridden from LocationBarView::Delegate: | 103 // Overridden from LocationBarView::Delegate: |
| 106 virtual TabContents* GetTabContents(); | 104 virtual TabContents* GetTabContents(); |
| 107 virtual void OnInputInProgress(bool in_progress); | 105 virtual void OnInputInProgress(bool in_progress); |
| 108 | 106 |
| 109 // Overridden from CommandUpdater::CommandObserver: | 107 // Overridden from CommandUpdater::CommandObserver: |
| 110 virtual void EnabledStateChangedForCommand(int id, bool enabled); | 108 virtual void EnabledStateChangedForCommand(int id, bool enabled); |
| 111 | 109 |
| 112 // Overridden from views::BaseButton::ButtonListener: | 110 // Overridden from views::BaseButton::ButtonListener: |
| 113 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 111 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 114 | 112 |
| 115 // BubblePositioner: | |
| 116 virtual gfx::Rect GetLocationStackBounds() const; | |
| 117 | |
| 118 // Overridden from NotificationObserver: | 113 // Overridden from NotificationObserver: |
| 119 virtual void Observe(NotificationType type, | 114 virtual void Observe(NotificationType type, |
| 120 const NotificationSource& source, | 115 const NotificationSource& source, |
| 121 const NotificationDetails& details); | 116 const NotificationDetails& details); |
| 122 | 117 |
| 123 // Overridden from menus::SimpleMenuModel::Delegate: | 118 // Overridden from menus::SimpleMenuModel::Delegate: |
| 124 virtual bool IsCommandIdChecked(int command_id) const; | 119 virtual bool IsCommandIdChecked(int command_id) const; |
| 125 virtual bool IsCommandIdEnabled(int command_id) const; | 120 virtual bool IsCommandIdEnabled(int command_id) const; |
| 126 virtual bool GetAcceleratorForCommandId(int command_id, | 121 virtual bool GetAcceleratorForCommandId(int command_id, |
| 127 menus::Accelerator* accelerator); | 122 menus::Accelerator* accelerator); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 221 |
| 227 // Are we in the menu bar emulation mode, where the app and page menu | 222 // Are we in the menu bar emulation mode, where the app and page menu |
| 228 // are temporarily focusable? | 223 // are temporarily focusable? |
| 229 bool menu_bar_emulation_mode_; | 224 bool menu_bar_emulation_mode_; |
| 230 | 225 |
| 231 // Used to post tasks to switch to the next/previous menu. | 226 // Used to post tasks to switch to the next/previous menu. |
| 232 ScopedRunnableMethodFactory<ToolbarView> method_factory_; | 227 ScopedRunnableMethodFactory<ToolbarView> method_factory_; |
| 233 }; | 228 }; |
| 234 | 229 |
| 235 #endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_ | 230 #endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_ |
| OLD | NEW |