Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_view.h

Issue 395193003: Create a cross-platform helper class for badging the wrench menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TOOLBAR_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_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/pref_member.h" 13 #include "base/prefs/pref_member.h"
14 #include "chrome/browser/command_observer.h" 14 #include "chrome/browser/command_observer.h"
15 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" 15 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
16 #include "chrome/browser/ui/toolbar/wrench_menu_badge_controller.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 "ui/base/accelerators/accelerator.h" 18 #include "ui/base/accelerators/accelerator.h"
18 #include "ui/views/accessible_pane_view.h" 19 #include "ui/views/accessible_pane_view.h"
19 #include "ui/views/controls/button/menu_button.h" 20 #include "ui/views/controls/button/menu_button.h"
20 #include "ui/views/controls/button/menu_button_listener.h" 21 #include "ui/views/controls/button/menu_button_listener.h"
21 #include "ui/views/view.h" 22 #include "ui/views/view.h"
22 23
23 class BackButton; 24 class BackButton;
24 class BrowserActionsContainer; 25 class BrowserActionsContainer;
25 class Browser; 26 class Browser;
(...skipping 16 matching lines...) Expand all
42 43
43 // The Browser Window's toolbar. 44 // The Browser Window's toolbar.
44 class ToolbarView : public views::AccessiblePaneView, 45 class ToolbarView : public views::AccessiblePaneView,
45 public views::MenuButtonListener, 46 public views::MenuButtonListener,
46 public ui::AcceleratorProvider, 47 public ui::AcceleratorProvider,
47 public LocationBarView::Delegate, 48 public LocationBarView::Delegate,
48 public content::NotificationObserver, 49 public content::NotificationObserver,
49 public CommandObserver, 50 public CommandObserver,
50 public views::ButtonListener, 51 public views::ButtonListener,
51 public views::WidgetObserver, 52 public views::WidgetObserver,
52 public views::ViewTargeterDelegate { 53 public views::ViewTargeterDelegate,
54 public WrenchMenuBadgeController::Delegate {
53 public: 55 public:
54 // The view class name. 56 // The view class name.
55 static const char kViewClassName[]; 57 static const char kViewClassName[];
56 58
57 explicit ToolbarView(Browser* browser); 59 explicit ToolbarView(Browser* browser);
58 virtual ~ToolbarView(); 60 virtual ~ToolbarView();
59 61
60 // Create the contents of the Browser Toolbar. 62 // Create the contents of the Browser Toolbar.
61 void Init(); 63 void Init();
62 64
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 enum DisplayMode { 187 enum DisplayMode {
186 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. 188 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc.
187 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location 189 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location
188 // bar, used for popups. 190 // bar, used for popups.
189 }; 191 };
190 192
191 // views::ViewTargeterDelegate: 193 // views::ViewTargeterDelegate:
192 virtual bool DoesIntersectRect(const views::View* target, 194 virtual bool DoesIntersectRect(const views::View* target,
193 const gfx::Rect& rect) const OVERRIDE; 195 const gfx::Rect& rect) const OVERRIDE;
194 196
195 // Returns true if we should show the upgrade recommended dot. 197 // WrenchMenuBadgeController::Delegate:
196 bool ShouldShowUpgradeRecommended(); 198 virtual void UpdateBadgeSeverity(WrenchMenuBadgeController::BadgeType type,
197 199 WrenchIconPainter::Severity severity,
198 // Returns true if we should show the background page badge. 200 bool animate) OVERRIDE;
199 bool ShouldShowBackgroundPageBadge();
200
201 // Returns true if we should show the warning for incompatible software.
202 bool ShouldShowIncompatibilityWarning();
203 201
204 // Returns the number of pixels above the location bar in non-normal display. 202 // Returns the number of pixels above the location bar in non-normal display.
205 int PopupTopSpacing() const; 203 int PopupTopSpacing() const;
206 204
207 // Given toolbar contents of size |size|, returns the total toolbar size. 205 // Given toolbar contents of size |size|, returns the total toolbar size.
208 gfx::Size SizeForContentSize(gfx::Size size) const; 206 gfx::Size SizeForContentSize(gfx::Size size) const;
209 207
210 // Loads the images for all the child views. 208 // Loads the images for all the child views.
211 void LoadImages(); 209 void LoadImages();
212 210
213 bool is_display_mode_normal() const { 211 bool is_display_mode_normal() const {
214 return display_mode_ == DISPLAYMODE_NORMAL; 212 return display_mode_ == DISPLAYMODE_NORMAL;
215 } 213 }
216 214
217 // Shows the critical notification bubble against the wrench menu. 215 // Shows the critical notification bubble against the wrench menu.
218 void ShowCriticalNotification(); 216 void ShowCriticalNotification();
219 217
220 // Shows the outdated install notification bubble against the wrench menu. 218 // Shows the outdated install notification bubble against the wrench menu.
221 // |auto_update_enabled| is set to true when auto-upate is on. 219 // |auto_update_enabled| is set to true when auto-upate is on.
222 void ShowOutdatedInstallNotification(bool auto_update_enabled); 220 void ShowOutdatedInstallNotification(bool auto_update_enabled);
223 221
224 // Updates the badge and the accessible name of the app menu (Wrench).
225 void UpdateAppMenuState();
226
227 // Updates the severity level on the wrench menu button.
228 void UpdateWrenchButtonSeverity();
229
230 void OnShowHomeButtonChanged(); 222 void OnShowHomeButtonChanged();
231 223
232 int content_shadow_height() const; 224 int content_shadow_height() const;
233 225
234 // Controls 226 // Controls
235 BackButton* back_; 227 BackButton* back_;
236 ToolbarButton* forward_; 228 ToolbarButton* forward_;
237 ReloadButton* reload_; 229 ReloadButton* reload_;
238 HomeButton* home_; 230 HomeButton* home_;
239 LocationBarView* location_bar_; 231 LocationBarView* location_bar_;
240 BrowserActionsContainer* browser_actions_; 232 BrowserActionsContainer* browser_actions_;
241 WrenchToolbarButton* app_menu_; 233 WrenchToolbarButton* app_menu_;
242 Browser* browser_; 234 Browser* browser_;
243 235
236 WrenchMenuBadgeController badge_controller_;
237
244 // Controls whether or not a home button should be shown on the toolbar. 238 // Controls whether or not a home button should be shown on the toolbar.
245 BooleanPrefMember show_home_button_; 239 BooleanPrefMember show_home_button_;
246 240
247 // The display mode used when laying out the toolbar. 241 // The display mode used when laying out the toolbar.
248 DisplayMode display_mode_; 242 DisplayMode display_mode_;
249 243
250 // Wrench model and menu. 244 // Wrench model and menu.
251 // Note that the menu should be destroyed before the model it uses, so the 245 // Note that the menu should be destroyed before the model it uses, so the
252 // menu should be listed later. 246 // menu should be listed later.
253 scoped_ptr<WrenchMenuModel> wrench_menu_model_; 247 scoped_ptr<WrenchMenuModel> wrench_menu_model_;
254 scoped_ptr<WrenchMenu> wrench_menu_; 248 scoped_ptr<WrenchMenu> wrench_menu_;
255 249
256 // The factory to create bubbles to warn about dangerous/suspicious 250 // The factory to create bubbles to warn about dangerous/suspicious
257 // extensions. 251 // extensions.
258 scoped_ptr<extensions::ExtensionMessageBubbleFactory> 252 scoped_ptr<extensions::ExtensionMessageBubbleFactory>
259 extension_message_bubble_factory_; 253 extension_message_bubble_factory_;
260 254
261 // A list of listeners to call when the menu opens. 255 // A list of listeners to call when the menu opens.
262 ObserverList<views::MenuListener> menu_listeners_; 256 ObserverList<views::MenuListener> menu_listeners_;
263 257
264 content::NotificationRegistrar registrar_; 258 content::NotificationRegistrar registrar_;
265 259
266 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); 260 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView);
267 }; 261 };
268 262
269 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ 263 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_badge_controller.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698