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 "app/slide_animation.h" | 11 #include "app/slide_animation.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "chrome/browser/back_forward_menu_model.h" | 13 #include "chrome/browser/back_forward_menu_model.h" |
14 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_updater.h" |
15 #include "chrome/browser/pref_member.h" | 15 #include "chrome/browser/pref_member.h" |
16 #include "chrome/browser/views/accessible_toolbar_view.h" | 16 #include "chrome/browser/views/accessible_toolbar_view.h" |
17 #include "chrome/browser/views/location_bar/location_bar_view.h" | 17 #include "chrome/browser/views/location_bar/location_bar_view.h" |
18 #include "chrome/browser/views/reload_button.h" | 18 #include "chrome/browser/views/reload_button.h" |
19 #include "views/controls/button/menu_button.h" | 19 #include "views/controls/button/menu_button.h" |
20 #include "views/controls/menu/menu.h" | 20 #include "views/controls/menu/menu.h" |
21 #include "views/controls/menu/menu_wrapper.h" | 21 #include "views/controls/menu/menu_wrapper.h" |
22 #include "views/controls/menu/view_menu_delegate.h" | 22 #include "views/controls/menu/view_menu_delegate.h" |
23 #include "views/view.h" | 23 #include "views/view.h" |
24 | 24 |
25 class BrowserActionsContainer; | 25 class BrowserActionsContainer; |
26 class Browser; | 26 class Browser; |
27 class Profile; | 27 class Profile; |
28 class WrenchMenu; | 28 class WrenchMenu; |
29 | 29 |
30 namespace views { | |
31 class Menu2; | |
32 } | |
33 | |
34 // The Browser Window's toolbar. | 30 // The Browser Window's toolbar. |
35 class ToolbarView : public AccessibleToolbarView, | 31 class ToolbarView : public AccessibleToolbarView, |
36 public views::ViewMenuDelegate, | 32 public views::ViewMenuDelegate, |
37 public menus::SimpleMenuModel::Delegate, | 33 public menus::SimpleMenuModel::Delegate, |
38 public LocationBarView::Delegate, | 34 public LocationBarView::Delegate, |
39 public AnimationDelegate, | 35 public AnimationDelegate, |
40 public NotificationObserver, | 36 public NotificationObserver, |
41 public CommandUpdater::CommandObserver, | 37 public CommandUpdater::CommandObserver, |
42 public views::ButtonListener { | 38 public views::ButtonListener { |
43 public: | 39 public: |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 virtual views::View* GetDefaultFocusableChild(); | 122 virtual views::View* GetDefaultFocusableChild(); |
127 virtual void RemoveToolbarFocus(); | 123 virtual void RemoveToolbarFocus(); |
128 | 124 |
129 private: | 125 private: |
130 // Returns the number of pixels above the location bar in non-normal display. | 126 // Returns the number of pixels above the location bar in non-normal display. |
131 int PopupTopSpacing() const; | 127 int PopupTopSpacing() const; |
132 | 128 |
133 // Loads the images for all the child views. | 129 // Loads the images for all the child views. |
134 void LoadImages(); | 130 void LoadImages(); |
135 | 131 |
136 // Check if the menu exited with a code indicating the user wants to | |
137 // switch to the other menu, and then switch to that other menu. | |
138 void SwitchToOtherMenuIfNeeded(views::Menu2* previous_menu, | |
139 views::MenuButton* next_menu_button); | |
140 | |
141 void ActivateMenuButton(views::MenuButton* menu_button); | |
142 | |
143 // Types of display mode this toolbar can have. | 132 // Types of display mode this toolbar can have. |
144 enum DisplayMode { | 133 enum DisplayMode { |
145 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. | 134 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. |
146 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location | 135 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location |
147 // bar, used for popups. | 136 // bar, used for popups. |
148 }; | 137 }; |
149 bool IsDisplayModeNormal() const { | 138 bool IsDisplayModeNormal() const { |
150 return display_mode_ == DISPLAYMODE_NORMAL; | 139 return display_mode_ == DISPLAYMODE_NORMAL; |
151 } | 140 } |
152 | 141 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 199 |
211 // If non-null the destructor sets this to true. This is set to a non-null | 200 // If non-null the destructor sets this to true. This is set to a non-null |
212 // while the menu is showing and used to detect if the menu was deleted while | 201 // while the menu is showing and used to detect if the menu was deleted while |
213 // running. | 202 // running. |
214 bool* destroyed_flag_; | 203 bool* destroyed_flag_; |
215 | 204 |
216 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 205 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
217 }; | 206 }; |
218 | 207 |
219 #endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_ | 208 #endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H_ |
OLD | NEW |