| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class Menu2; | 32 class Menu2; |
| 33 } // namespace views | 33 } // namespace views |
| 34 #endif | 34 #endif |
| 35 class WrenchMenu; | 35 class WrenchMenu; |
| 36 | 36 |
| 37 // The Browser Window's toolbar. | 37 // The Browser Window's toolbar. |
| 38 class ToolbarView : public AccessiblePaneView, | 38 class ToolbarView : public AccessiblePaneView, |
| 39 public views::ViewMenuDelegate, | 39 public views::ViewMenuDelegate, |
| 40 public menus::AcceleratorProvider, | 40 public menus::AcceleratorProvider, |
| 41 public LocationBarView::Delegate, | 41 public LocationBarView::Delegate, |
| 42 public AnimationDelegate, | |
| 43 public NotificationObserver, | 42 public NotificationObserver, |
| 44 public CommandUpdater::CommandObserver, | 43 public CommandUpdater::CommandObserver, |
| 45 public views::ButtonListener { | 44 public views::ButtonListener { |
| 46 public: | 45 public: |
| 47 explicit ToolbarView(Browser* browser); | 46 explicit ToolbarView(Browser* browser); |
| 48 virtual ~ToolbarView(); | 47 virtual ~ToolbarView(); |
| 49 | 48 |
| 50 // Create the contents of the Browser Toolbar | 49 // Create the contents of the Browser Toolbar |
| 51 void Init(Profile* profile); | 50 void Init(Profile* profile); |
| 52 | 51 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 virtual bool GetAcceleratorInfo(int id, menus::Accelerator* accel); | 93 virtual bool GetAcceleratorInfo(int id, menus::Accelerator* accel); |
| 95 | 94 |
| 96 // Overridden from views::MenuDelegate: | 95 // Overridden from views::MenuDelegate: |
| 97 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 96 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 98 | 97 |
| 99 // Overridden from LocationBarView::Delegate: | 98 // Overridden from LocationBarView::Delegate: |
| 100 virtual TabContents* GetTabContents(); | 99 virtual TabContents* GetTabContents(); |
| 101 virtual InstantController* GetInstant(); | 100 virtual InstantController* GetInstant(); |
| 102 virtual void OnInputInProgress(bool in_progress); | 101 virtual void OnInputInProgress(bool in_progress); |
| 103 | 102 |
| 104 // Overridden from AnimationDelegate: | |
| 105 virtual void AnimationProgressed(const Animation* animation); | |
| 106 | |
| 107 // Overridden from CommandUpdater::CommandObserver: | 103 // Overridden from CommandUpdater::CommandObserver: |
| 108 virtual void EnabledStateChangedForCommand(int id, bool enabled); | 104 virtual void EnabledStateChangedForCommand(int id, bool enabled); |
| 109 | 105 |
| 110 // Overridden from views::BaseButton::ButtonListener: | 106 // Overridden from views::BaseButton::ButtonListener: |
| 111 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 107 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 112 | 108 |
| 113 // Overridden from NotificationObserver: | 109 // Overridden from NotificationObserver: |
| 114 virtual void Observe(NotificationType type, | 110 virtual void Observe(NotificationType type, |
| 115 const NotificationSource& source, | 111 const NotificationSource& source, |
| 116 const NotificationDetails& details); | 112 const NotificationDetails& details); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // Types of display mode this toolbar can have. | 150 // Types of display mode this toolbar can have. |
| 155 enum DisplayMode { | 151 enum DisplayMode { |
| 156 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. | 152 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. |
| 157 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location | 153 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location |
| 158 // bar, used for popups. | 154 // bar, used for popups. |
| 159 }; | 155 }; |
| 160 bool IsDisplayModeNormal() const { | 156 bool IsDisplayModeNormal() const { |
| 161 return display_mode_ == DISPLAYMODE_NORMAL; | 157 return display_mode_ == DISPLAYMODE_NORMAL; |
| 162 } | 158 } |
| 163 | 159 |
| 164 // Starts the recurring timer that periodically asks the notification dot | 160 // Updates the badge on the app menu (Wrench). |
| 165 // to pulsate. | 161 void UpdateAppMenuBadge(); |
| 166 void ShowNotificationDot(); | |
| 167 | 162 |
| 168 // Show the reminder, tempting the user to take a look. | 163 // Gets a bitmap with the icon for the app menu and any overlaid notification |
| 169 void PulsateNotificationDot(); | 164 // badge. |
| 170 | |
| 171 // Gets a canvas with the icon for the app menu. It will possibly contain | |
| 172 // an overlaid badge if an update is recommended. | |
| 173 SkBitmap GetAppMenuIcon(views::CustomButton::ButtonState state); | 165 SkBitmap GetAppMenuIcon(views::CustomButton::ButtonState state); |
| 174 | 166 |
| 175 scoped_ptr<BackForwardMenuModel> back_menu_model_; | 167 scoped_ptr<BackForwardMenuModel> back_menu_model_; |
| 176 scoped_ptr<BackForwardMenuModel> forward_menu_model_; | 168 scoped_ptr<BackForwardMenuModel> forward_menu_model_; |
| 177 | 169 |
| 178 // The model that contains the security level, text, icon to display... | 170 // The model that contains the security level, text, icon to display... |
| 179 ToolbarModel* model_; | 171 ToolbarModel* model_; |
| 180 | 172 |
| 181 // Controls | 173 // Controls |
| 182 views::ImageButton* back_; | 174 views::ImageButton* back_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 206 // MenuLister is managed by Menu2. | 198 // MenuLister is managed by Menu2. |
| 207 scoped_ptr<views::Menu2> wrench_menu_2_; | 199 scoped_ptr<views::Menu2> wrench_menu_2_; |
| 208 #endif | 200 #endif |
| 209 | 201 |
| 210 // Wrench menu. | 202 // Wrench menu. |
| 211 scoped_refptr<WrenchMenu> wrench_menu_; | 203 scoped_refptr<WrenchMenu> wrench_menu_; |
| 212 | 204 |
| 213 // Vector of listeners to receive callbacks when the menu opens. | 205 // Vector of listeners to receive callbacks when the menu opens. |
| 214 std::vector<views::MenuListener*> menu_listeners_; | 206 std::vector<views::MenuListener*> menu_listeners_; |
| 215 | 207 |
| 216 // The animation that makes the notification dot pulse. | |
| 217 scoped_ptr<SlideAnimation> notification_dot_animation_; | |
| 218 | |
| 219 // We periodically restart the animation after it has been showed | |
| 220 // once, to create a pulsating effect. | |
| 221 base::RepeatingTimer<ToolbarView> notification_dot_pulse_timer_; | |
| 222 | |
| 223 // Used to post tasks to switch to the next/previous menu. | 208 // Used to post tasks to switch to the next/previous menu. |
| 224 ScopedRunnableMethodFactory<ToolbarView> method_factory_; | 209 ScopedRunnableMethodFactory<ToolbarView> method_factory_; |
| 225 | 210 |
| 226 NotificationRegistrar registrar_; | 211 NotificationRegistrar registrar_; |
| 227 | 212 |
| 228 // If non-null the destructor sets this to true. This is set to a non-null | 213 // If non-null the destructor sets this to true. This is set to a non-null |
| 229 // while the menu is showing and used to detect if the menu was deleted while | 214 // while the menu is showing and used to detect if the menu was deleted while |
| 230 // running. | 215 // running. |
| 231 bool* destroyed_flag_; | 216 bool* destroyed_flag_; |
| 232 | 217 |
| 233 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 218 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
| 234 }; | 219 }; |
| 235 | 220 |
| 236 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 221 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
| OLD | NEW |