Chromium Code Reviews| 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 | 
| 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/public/pref_observer.h" | |
| 14 #include "chrome/browser/api/prefs/pref_member.h" | 13 #include "chrome/browser/api/prefs/pref_member.h" | 
| 15 #include "chrome/browser/command_observer.h" | 14 #include "chrome/browser/command_observer.h" | 
| 16 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 15 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 
| 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 
| 18 #include "chrome/browser/ui/views/reload_button.h" | 17 #include "chrome/browser/ui/views/reload_button.h" | 
| 19 #include "ui/base/accelerators/accelerator.h" | 18 #include "ui/base/accelerators/accelerator.h" | 
| 20 #include "ui/base/animation/slide_animation.h" | 19 #include "ui/base/animation/slide_animation.h" | 
| 21 #include "ui/views/accessible_pane_view.h" | 20 #include "ui/views/accessible_pane_view.h" | 
| 22 #include "ui/views/controls/button/menu_button.h" | 21 #include "ui/views/controls/button/menu_button.h" | 
| 23 #include "ui/views/controls/button/menu_button_listener.h" | 22 #include "ui/views/controls/button/menu_button_listener.h" | 
| 24 #include "ui/views/view.h" | 23 #include "ui/views/view.h" | 
| 25 | 24 | 
| 26 class BrowserActionsContainer; | 25 class BrowserActionsContainer; | 
| 27 class Browser; | 26 class Browser; | 
| 28 class WrenchMenu; | 27 class WrenchMenu; | 
| 29 class WrenchMenuModel; | 28 class WrenchMenuModel; | 
| 30 | 29 | 
| 31 namespace views { | 30 namespace views { | 
| 32 class MenuListener; | 31 class MenuListener; | 
| 33 } | 32 } | 
| 34 | 33 | 
| 35 // The Browser Window's toolbar. | 34 // The Browser Window's toolbar. | 
| 36 class ToolbarView : public views::AccessiblePaneView, | 35 class ToolbarView : public views::AccessiblePaneView, | 
| 37 public views::MenuButtonListener, | 36 public views::MenuButtonListener, | 
| 38 public ui::AcceleratorProvider, | 37 public ui::AcceleratorProvider, | 
| 39 public LocationBarView::Delegate, | 38 public LocationBarView::Delegate, | 
| 40 public content::NotificationObserver, | 39 public content::NotificationObserver, | 
| 41 public CommandObserver, | 40 public CommandObserver, | 
| 42 public views::ButtonListener, | 41 public views::ButtonListener, | 
| 43 public views::WidgetObserver, | 42 public views::WidgetObserver { | 
| 44 public PrefObserver { | |
| 45 public: | 43 public: | 
| 46 // The view class name. | 44 // The view class name. | 
| 47 static const char kViewClassName[]; | 45 static const char kViewClassName[]; | 
| 48 | 46 | 
| 49 explicit ToolbarView(Browser* browser); | 47 explicit ToolbarView(Browser* browser); | 
| 50 virtual ~ToolbarView(); | 48 virtual ~ToolbarView(); | 
| 51 | 49 | 
| 52 // Create the contents of the Browser Toolbar. | 50 // Create the contents of the Browser Toolbar. | 
| 53 void Init(); | 51 void Init(); | 
| 54 | 52 | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 | 118 | 
| 121 // Overridden from views::WidgetObserver: | 119 // Overridden from views::WidgetObserver: | 
| 122 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 120 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 
| 123 bool visible) OVERRIDE; | 121 bool visible) OVERRIDE; | 
| 124 | 122 | 
| 125 // Overridden from content::NotificationObserver: | 123 // Overridden from content::NotificationObserver: | 
| 126 virtual void Observe(int type, | 124 virtual void Observe(int type, | 
| 127 const content::NotificationSource& source, | 125 const content::NotificationSource& source, | 
| 128 const content::NotificationDetails& details) OVERRIDE; | 126 const content::NotificationDetails& details) OVERRIDE; | 
| 129 | 127 | 
| 130 // Overridden from PrefObserver: | |
| 131 virtual void OnPreferenceChanged(PrefServiceBase* service, | |
| 132 const std::string& pref_name) OVERRIDE; | |
| 133 | |
| 134 // Overridden from ui::AcceleratorProvider: | 128 // Overridden from ui::AcceleratorProvider: | 
| 135 virtual bool GetAcceleratorForCommandId( | 129 virtual bool GetAcceleratorForCommandId( | 
| 136 int command_id, ui::Accelerator* accelerator) OVERRIDE; | 130 int command_id, ui::Accelerator* accelerator) OVERRIDE; | 
| 137 | 131 | 
| 138 // Overridden from views::View: | 132 // Overridden from views::View: | 
| 139 virtual gfx::Size GetPreferredSize() OVERRIDE; | 133 virtual gfx::Size GetPreferredSize() OVERRIDE; | 
| 140 virtual void Layout() OVERRIDE; | 134 virtual void Layout() OVERRIDE; | 
| 141 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 135 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 
| 142 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 136 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 
| 143 virtual bool GetDropFormats( | 137 virtual bool GetDropFormats( | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 bool is_display_mode_normal() const { | 185 bool is_display_mode_normal() const { | 
| 192 return display_mode_ == DISPLAYMODE_NORMAL; | 186 return display_mode_ == DISPLAYMODE_NORMAL; | 
| 193 } | 187 } | 
| 194 | 188 | 
| 195 // Shows the critical notification bubble against the wrench menu. | 189 // Shows the critical notification bubble against the wrench menu. | 
| 196 void ShowCriticalNotification(); | 190 void ShowCriticalNotification(); | 
| 197 | 191 | 
| 198 // Updates the badge and the accessible name of the app menu (Wrench). | 192 // Updates the badge and the accessible name of the app menu (Wrench). | 
| 199 void UpdateAppMenuState(); | 193 void UpdateAppMenuState(); | 
| 200 | 194 | 
| 201 // Gets a badge for the wrench icon corresponding to the number of | 195 void OnShowHomeButtonChanged(); | 
| 202 // unacknowledged background pages in the system. | |
| 203 gfx::ImageSkia GetBackgroundPageBadge(); | |
| 
 
Jói
2012/11/20 22:11:55
Looks like you're removing this because it's not i
 
tfarina
2012/11/20 23:41:20
Done.
 
 | |
| 204 | 196 | 
| 205 // The model that contains the security level, text, icon to display... | 197 // The model that contains the security level, text, icon to display... | 
| 206 ToolbarModel* model_; | 198 ToolbarModel* model_; | 
| 207 | 199 | 
| 208 // Controls | 200 // Controls | 
| 209 views::ImageButton* back_; | 201 views::ImageButton* back_; | 
| 210 views::ImageButton* forward_; | 202 views::ImageButton* forward_; | 
| 211 ReloadButton* reload_; | 203 ReloadButton* reload_; | 
| 212 views::ImageButton* home_; | 204 views::ImageButton* home_; | 
| 213 LocationBarView* location_bar_; | 205 LocationBarView* location_bar_; | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 235 | 227 | 
| 236 // A list of listeners to call when the menu opens. | 228 // A list of listeners to call when the menu opens. | 
| 237 ObserverList<views::MenuListener> menu_listeners_; | 229 ObserverList<views::MenuListener> menu_listeners_; | 
| 238 | 230 | 
| 239 content::NotificationRegistrar registrar_; | 231 content::NotificationRegistrar registrar_; | 
| 240 | 232 | 
| 241 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 233 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 
| 242 }; | 234 }; | 
| 243 | 235 | 
| 244 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 236 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 
| OLD | NEW |