| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/observer_list.h" |
| 12 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 13 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" | 14 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" |
| 14 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" | 15 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
| 15 #include "ui/gfx/animation/tween.h" | 16 #include "ui/gfx/animation/tween.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 namespace extensions { | 19 namespace extensions { |
| 19 class Extension; | 20 class Extension; |
| 20 class ExtensionMessageBubbleController; | 21 class ExtensionMessageBubbleController; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace user_prefs { | 24 namespace user_prefs { |
| 24 class PrefRegistrySyncable; | 25 class PrefRegistrySyncable; |
| 25 } | 26 } |
| 26 | 27 |
| 27 class ToolbarActionsBarDelegate; | 28 class ToolbarActionsBarDelegate; |
| 29 class ToolbarActionsBarObserver; |
| 28 class ToolbarActionViewController; | 30 class ToolbarActionViewController; |
| 29 | 31 |
| 30 // A platform-independent version of the container for toolbar actions, | 32 // A platform-independent version of the container for toolbar actions, |
| 31 // including extension actions and component actions. | 33 // including extension actions and component actions. |
| 32 // | 34 // |
| 33 // This is a per-window instance, unlike the ToolbarActionsModel, which is | 35 // This is a per-window instance, unlike the ToolbarActionsModel, which is |
| 34 // per-profile. In most cases, ordering and visible count will be identical | 36 // per-profile. In most cases, ordering and visible count will be identical |
| 35 // between the base model and the window; however, there are exceptions in the | 37 // between the base model and the window; however, there are exceptions in the |
| 36 // case of very small windows (which may be too narrow to display all the | 38 // case of very small windows (which may be too narrow to display all the |
| 37 // icons), or windows in which an action is "popped out", resulting in a | 39 // icons), or windows in which an action is "popped out", resulting in a |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // Sets the active popup owner to be |popup_owner|. | 197 // Sets the active popup owner to be |popup_owner|. |
| 196 void SetPopupOwner(ToolbarActionViewController* popup_owner); | 198 void SetPopupOwner(ToolbarActionViewController* popup_owner); |
| 197 | 199 |
| 198 // Hides the actively showing popup, if any. | 200 // Hides the actively showing popup, if any. |
| 199 void HideActivePopup(); | 201 void HideActivePopup(); |
| 200 | 202 |
| 201 // Returns the main (i.e., not overflow) controller for the given action. | 203 // Returns the main (i.e., not overflow) controller for the given action. |
| 202 ToolbarActionViewController* GetMainControllerForAction( | 204 ToolbarActionViewController* GetMainControllerForAction( |
| 203 ToolbarActionViewController* action); | 205 ToolbarActionViewController* action); |
| 204 | 206 |
| 207 // Add or remove an observer. |
| 208 void AddObserver(ToolbarActionsBarObserver* observer); |
| 209 void RemoveObserver(ToolbarActionsBarObserver* observer); |
| 210 |
| 205 // Returns the underlying toolbar actions, but does not order them. Primarily | 211 // Returns the underlying toolbar actions, but does not order them. Primarily |
| 206 // for use in testing. | 212 // for use in testing. |
| 207 const std::vector<ToolbarActionViewController*>& toolbar_actions_unordered() | 213 const std::vector<ToolbarActionViewController*>& toolbar_actions_unordered() |
| 208 const { | 214 const { |
| 209 return toolbar_actions_.get(); | 215 return toolbar_actions_.get(); |
| 210 } | 216 } |
| 211 bool enabled() const { return model_ != nullptr; } | 217 bool enabled() const { return model_ != nullptr; } |
| 212 bool suppress_layout() const { return suppress_layout_; } | 218 bool suppress_layout() const { return suppress_layout_; } |
| 213 bool suppress_animation() const { | 219 bool suppress_animation() const { |
| 214 return suppress_animation_ || disable_animations_for_testing_; | 220 return suppress_animation_ || disable_animations_for_testing_; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 ToolbarActionViewController* popped_out_action_; | 322 ToolbarActionViewController* popped_out_action_; |
| 317 | 323 |
| 318 // The task to alert the |popped_out_action_| that animation has finished, and | 324 // The task to alert the |popped_out_action_| that animation has finished, and |
| 319 // it is fully popped out. | 325 // it is fully popped out. |
| 320 base::Closure popped_out_closure_; | 326 base::Closure popped_out_closure_; |
| 321 | 327 |
| 322 // The controller of the bubble to show once animation finishes, if any. | 328 // The controller of the bubble to show once animation finishes, if any. |
| 323 scoped_ptr<extensions::ExtensionMessageBubbleController> | 329 scoped_ptr<extensions::ExtensionMessageBubbleController> |
| 324 pending_extension_bubble_controller_; | 330 pending_extension_bubble_controller_; |
| 325 | 331 |
| 332 base::ObserverList<ToolbarActionsBarObserver> observers_; |
| 333 |
| 326 base::WeakPtrFactory<ToolbarActionsBar> weak_ptr_factory_; | 334 base::WeakPtrFactory<ToolbarActionsBar> weak_ptr_factory_; |
| 327 | 335 |
| 328 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); | 336 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); |
| 329 }; | 337 }; |
| 330 | 338 |
| 331 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ | 339 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ |
| OLD | NEW |