Chromium Code Reviews| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 // overflow and main containers. | 112 // overflow and main containers. |
| 113 void OnDragDrop(int dragged_index, | 113 void OnDragDrop(int dragged_index, |
| 114 int dropped_index, | 114 int dropped_index, |
| 115 DragType drag_type); | 115 DragType drag_type); |
| 116 | 116 |
| 117 const std::vector<ToolbarActionViewController*>& toolbar_actions() { | 117 const std::vector<ToolbarActionViewController*>& toolbar_actions() { |
| 118 return toolbar_actions_.get(); | 118 return toolbar_actions_.get(); |
| 119 } | 119 } |
| 120 bool enabled() const { return model_ != nullptr; } | 120 bool enabled() const { return model_ != nullptr; } |
| 121 bool suppress_layout() const { return suppress_layout_; } | 121 bool suppress_layout() const { return suppress_layout_; } |
| 122 bool suppress_animation() const { return suppress_animation_; } | 122 bool suppress_animation() const { |
| 123 return suppress_animation_ || disable_animations_during_testing_; | |
| 124 } | |
| 123 bool is_highlighting() const { return model_ && model_->is_highlighting(); } | 125 bool is_highlighting() const { return model_ && model_->is_highlighting(); } |
| 124 const PlatformSettings& platform_settings() const { | 126 const PlatformSettings& platform_settings() const { |
| 125 return platform_settings_; | 127 return platform_settings_; |
| 126 } | 128 } |
| 127 | 129 |
| 128 ToolbarActionsBarDelegate* delegate_for_test() { return delegate_; } | 130 ToolbarActionsBarDelegate* delegate_for_test() { return delegate_; } |
| 129 | 131 |
| 132 // During testing we can disable animations by setting this flag to true, | |
| 133 // so that the bar resizes instantly, instead of having to poll it while it | |
| 134 // animates to open/closed status. | |
| 135 static bool disable_animations_during_testing_; | |
|
Avi (use Gerrit)
2014/12/12 19:25:17
The standard naming convention is "for_testing"; c
Devlin
2014/12/12 19:50:21
Done.
| |
| 136 | |
| 130 private: | 137 private: |
| 131 using ToolbarActions = ScopedVector<ToolbarActionViewController>; | 138 using ToolbarActions = ScopedVector<ToolbarActionViewController>; |
| 132 | 139 |
| 133 // ExtensionToolbarModel::Observer: | 140 // ExtensionToolbarModel::Observer: |
| 134 void ToolbarExtensionAdded(const extensions::Extension* extension, | 141 void ToolbarExtensionAdded(const extensions::Extension* extension, |
| 135 int index) override; | 142 int index) override; |
| 136 void ToolbarExtensionRemoved(const extensions::Extension* extension) override; | 143 void ToolbarExtensionRemoved(const extensions::Extension* extension) override; |
| 137 void ToolbarExtensionMoved(const extensions::Extension* extension, | 144 void ToolbarExtensionMoved(const extensions::Extension* extension, |
| 138 int index) override; | 145 int index) override; |
| 139 void ToolbarExtensionUpdated(const extensions::Extension* extension) override; | 146 void ToolbarExtensionUpdated(const extensions::Extension* extension) override; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 bool suppress_layout_; | 209 bool suppress_layout_; |
| 203 | 210 |
| 204 // True if we should suppress animation; we do this when first creating the | 211 // True if we should suppress animation; we do this when first creating the |
| 205 // toolbar, and also when switching tabs changes the state of the icons. | 212 // toolbar, and also when switching tabs changes the state of the icons. |
| 206 bool suppress_animation_; | 213 bool suppress_animation_; |
| 207 | 214 |
| 208 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); | 215 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); |
| 209 }; | 216 }; |
| 210 | 217 |
| 211 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ | 218 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ |
| OLD | NEW |