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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 public ui::AcceleratorProvider, | 44 public ui::AcceleratorProvider, |
45 public LocationBarView::Delegate, | 45 public LocationBarView::Delegate, |
46 public chrome::search::SearchModelObserver, | 46 public chrome::search::SearchModelObserver, |
47 public content::NotificationObserver, | 47 public content::NotificationObserver, |
48 public CommandObserver, | 48 public CommandObserver, |
49 public views::ButtonListener { | 49 public views::ButtonListener { |
50 public: | 50 public: |
51 // The view class name. | 51 // The view class name. |
52 static const char kViewClassName[]; | 52 static const char kViewClassName[]; |
53 | 53 |
| 54 // Types of display mode this toolbar can have. |
| 55 enum DisplayMode { |
| 56 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. |
| 57 DISPLAYMODE_LOCATION, // Slimline toolbar showing only compact location |
| 58 // bar, used for popups. |
| 59 DISPLAYMODE_METROSNAP, // Non-interactive slimline toolbar used for metro |
| 60 // metro snap. |
| 61 }; |
| 62 |
54 explicit ToolbarView(Browser* browser); | 63 explicit ToolbarView(Browser* browser); |
55 virtual ~ToolbarView(); | 64 virtual ~ToolbarView(); |
56 | 65 |
57 // Create the contents of the Browser Toolbar. |location_bar_parent| is the | 66 // Create the contents of the Browser Toolbar. |location_bar_parent| is the |
58 // view the LocationBarContainer is added to. |popup_parent_view| is the | 67 // view the LocationBarContainer is added to. |popup_parent_view| is the |
59 // View to add the omnibox popup view to. | 68 // View to add the omnibox popup view to. |
60 // TODO(sky): clearly describe when |popup_parent_view| is used. | 69 // TODO(sky): clearly describe when |popup_parent_view| is used. |
61 void Init(views::View* location_bar_parent, views::View* popup_parent_view); | 70 void Init(views::View* location_bar_parent, views::View* popup_parent_view); |
62 | 71 |
63 // Updates the toolbar (and transitively the location bar) with the states of | 72 // Updates the toolbar (and transitively the location bar) with the states of |
(...skipping 20 matching lines...) Expand all Loading... |
84 // badge. | 93 // badge. |
85 gfx::ImageSkia GetAppMenuIcon(views::CustomButton::ButtonState state); | 94 gfx::ImageSkia GetAppMenuIcon(views::CustomButton::ButtonState state); |
86 | 95 |
87 virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); | 96 virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); |
88 | 97 |
89 // Layout toolbar for the various modes when --enable-instant-extended-api | 98 // Layout toolbar for the various modes when --enable-instant-extended-api |
90 // is specified. Depending on the toolbar mode, this can result in | 99 // is specified. Depending on the toolbar mode, this can result in |
91 // some toolbar children views change in visibility. | 100 // some toolbar children views change in visibility. |
92 void LayoutForSearch(); | 101 void LayoutForSearch(); |
93 | 102 |
| 103 // Allows setting the display mode to metro snap. |
| 104 void SetMetroSnapDisplayMode(bool enable); |
| 105 |
94 // Accessors... | 106 // Accessors... |
95 Browser* browser() const { return browser_; } | 107 Browser* browser() const { return browser_; } |
96 BrowserActionsContainer* browser_actions() const { return browser_actions_; } | 108 BrowserActionsContainer* browser_actions() const { return browser_actions_; } |
97 ReloadButton* reload_button() const { return reload_; } | 109 ReloadButton* reload_button() const { return reload_; } |
98 LocationBarView* location_bar() const { return location_bar_; } | 110 LocationBarView* location_bar() const { return location_bar_; } |
99 LocationBarContainer* location_bar_container() const { | 111 LocationBarContainer* location_bar_container() const { |
100 return location_bar_container_; | 112 return location_bar_container_; |
101 } | 113 } |
102 views::MenuButton* app_menu() const { return app_menu_; } | 114 views::MenuButton* app_menu() const { return app_menu_; } |
103 | 115 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // The top of the toolbar has an edge we have to skip over in addition to the | 176 // The top of the toolbar has an edge we have to skip over in addition to the |
165 // standard spacing. | 177 // standard spacing. |
166 static const int kVertSpacing; | 178 static const int kVertSpacing; |
167 | 179 |
168 protected: | 180 protected: |
169 // Overridden from AccessiblePaneView | 181 // Overridden from AccessiblePaneView |
170 virtual bool SetPaneFocusAndFocusDefault() OVERRIDE; | 182 virtual bool SetPaneFocusAndFocusDefault() OVERRIDE; |
171 virtual void RemovePaneFocus() OVERRIDE; | 183 virtual void RemovePaneFocus() OVERRIDE; |
172 | 184 |
173 private: | 185 private: |
174 // Types of display mode this toolbar can have. | |
175 enum DisplayMode { | |
176 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. | |
177 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location | |
178 // bar, used for popups. | |
179 }; | |
180 | 186 |
181 // Returns true if we should show the upgrade recommended dot. | 187 // Returns true if we should show the upgrade recommended dot. |
182 bool ShouldShowUpgradeRecommended(); | 188 bool ShouldShowUpgradeRecommended(); |
183 | 189 |
184 // Returns true if we should show the background page badge. | 190 // Returns true if we should show the background page badge. |
185 bool ShouldShowBackgroundPageBadge(); | 191 bool ShouldShowBackgroundPageBadge(); |
186 | 192 |
187 // Returns true if we should show the warning for incompatible software. | 193 // Returns true if we should show the warning for incompatible software. |
188 bool ShouldShowIncompatibilityWarning(); | 194 bool ShouldShowIncompatibilityWarning(); |
189 | 195 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 views::ImageButton* back_; | 227 views::ImageButton* back_; |
222 views::ImageButton* forward_; | 228 views::ImageButton* forward_; |
223 ReloadButton* reload_; | 229 ReloadButton* reload_; |
224 views::ImageButton* home_; | 230 views::ImageButton* home_; |
225 LocationBarView* location_bar_; | 231 LocationBarView* location_bar_; |
226 LocationBarContainer* location_bar_container_; | 232 LocationBarContainer* location_bar_container_; |
227 BrowserActionsContainer* browser_actions_; | 233 BrowserActionsContainer* browser_actions_; |
228 views::MenuButton* app_menu_; | 234 views::MenuButton* app_menu_; |
229 Browser* browser_; | 235 Browser* browser_; |
230 | 236 |
| 237 // The View to add the omnibox popup view to. |
| 238 views::View* popup_parent_view_; |
| 239 |
231 // Contents of the profiles menu to populate with profile names. | 240 // Contents of the profiles menu to populate with profile names. |
232 scoped_ptr<ui::SimpleMenuModel> profiles_menu_contents_; | 241 scoped_ptr<ui::SimpleMenuModel> profiles_menu_contents_; |
233 | 242 |
234 // Controls whether or not a home button should be shown on the toolbar. | 243 // Controls whether or not a home button should be shown on the toolbar. |
235 BooleanPrefMember show_home_button_; | 244 BooleanPrefMember show_home_button_; |
236 | 245 |
237 // The display mode used when laying out the toolbar. | 246 // The display mode used when laying out the toolbar. |
238 DisplayMode display_mode_; | 247 DisplayMode display_mode_; |
239 | 248 |
240 // Wrench menu. | 249 // Wrench menu. |
241 scoped_ptr<WrenchMenu> wrench_menu_; | 250 scoped_ptr<WrenchMenu> wrench_menu_; |
242 | 251 |
243 // A list of listeners to call when the menu opens. | 252 // A list of listeners to call when the menu opens. |
244 ObserverList<views::MenuListener> menu_listeners_; | 253 ObserverList<views::MenuListener> menu_listeners_; |
245 | 254 |
246 content::NotificationRegistrar registrar_; | 255 content::NotificationRegistrar registrar_; |
247 | 256 |
248 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 257 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
249 }; | 258 }; |
250 | 259 |
251 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 260 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
OLD | NEW |