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/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" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 // The type of drag that occurred in a drag-and-drop operation. | 60 // The type of drag that occurred in a drag-and-drop operation. |
| 61 enum DragType { | 61 enum DragType { |
| 62 // The icon was dragged to the same container it started in. | 62 // The icon was dragged to the same container it started in. |
| 63 DRAG_TO_SAME, | 63 DRAG_TO_SAME, |
| 64 // The icon was dragged from the main container to the overflow. | 64 // The icon was dragged from the main container to the overflow. |
| 65 DRAG_TO_OVERFLOW, | 65 DRAG_TO_OVERFLOW, |
| 66 // The icon was dragged from the overflow container to the main. | 66 // The icon was dragged from the overflow container to the main. |
| 67 DRAG_TO_MAIN, | 67 DRAG_TO_MAIN, |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 enum HighlightType { | |
| 71 HIGHLIGHT_NONE, | |
| 72 HIGHLIGHT_INFO, | |
| 73 HIGHLIGHT_WARNING, | |
| 74 }; | |
| 75 | |
| 70 ToolbarActionsBar(ToolbarActionsBarDelegate* delegate, | 76 ToolbarActionsBar(ToolbarActionsBarDelegate* delegate, |
| 71 Browser* browser, | 77 Browser* browser, |
| 72 ToolbarActionsBar* main_bar); | 78 ToolbarActionsBar* main_bar); |
| 73 ~ToolbarActionsBar() override; | 79 ~ToolbarActionsBar() override; |
| 74 | 80 |
| 75 // Returns the width of a browser action icon, optionally including the | 81 // Returns the width of a browser action icon, optionally including the |
| 76 // following padding. | 82 // following padding. |
| 77 static int IconWidth(bool include_padding); | 83 static int IconWidth(bool include_padding); |
| 78 | 84 |
| 79 // Returns the height of a browser action icon. | 85 // Returns the height of a browser action icon. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 96 // Returns the number of icons that can fit within the given width. | 102 // Returns the number of icons that can fit within the given width. |
| 97 size_t WidthToIconCount(int width) const; | 103 size_t WidthToIconCount(int width) const; |
| 98 | 104 |
| 99 // Returns the number of icons that should be displayed. | 105 // Returns the number of icons that should be displayed. |
| 100 size_t GetIconCount() const; | 106 size_t GetIconCount() const; |
| 101 | 107 |
| 102 // Returns the actions in the proper order; this may differ from the | 108 // Returns the actions in the proper order; this may differ from the |
| 103 // underlying order in the case of actions being popped out to show a popup. | 109 // underlying order in the case of actions being popped out to show a popup. |
| 104 std::vector<ToolbarActionViewController*> GetActions() const; | 110 std::vector<ToolbarActionViewController*> GetActions() const; |
| 105 | 111 |
| 112 // Returns the current highlight type. | |
| 113 HighlightType GetHighlightType() const; | |
|
Peter Kasting
2015/07/23 18:29:07
I think this declaration is a leftover?
Devlin
2015/07/23 20:39:35
Whoops, removed.
| |
| 114 | |
| 106 // Creates the toolbar actions. | 115 // Creates the toolbar actions. |
| 107 void CreateActions(); | 116 void CreateActions(); |
| 108 | 117 |
| 109 // Deletes all toolbar actions. | 118 // Deletes all toolbar actions. |
| 110 void DeleteActions(); | 119 void DeleteActions(); |
| 111 | 120 |
| 112 // Updates all the toolbar actions. | 121 // Updates all the toolbar actions. |
| 113 void Update(); | 122 void Update(); |
| 114 | 123 |
| 115 // Sets the width for the overflow menu rows. | 124 // Sets the width for the overflow menu rows. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 const std::vector<ToolbarActionViewController*>& toolbar_actions_unordered() | 167 const std::vector<ToolbarActionViewController*>& toolbar_actions_unordered() |
| 159 const { | 168 const { |
| 160 return toolbar_actions_.get(); | 169 return toolbar_actions_.get(); |
| 161 } | 170 } |
| 162 bool enabled() const { return model_ != nullptr; } | 171 bool enabled() const { return model_ != nullptr; } |
| 163 bool suppress_layout() const { return suppress_layout_; } | 172 bool suppress_layout() const { return suppress_layout_; } |
| 164 bool suppress_animation() const { | 173 bool suppress_animation() const { |
| 165 return suppress_animation_ || disable_animations_for_testing_; | 174 return suppress_animation_ || disable_animations_for_testing_; |
| 166 } | 175 } |
| 167 bool is_highlighting() const { return model_ && model_->is_highlighting(); } | 176 bool is_highlighting() const { return model_ && model_->is_highlighting(); } |
| 177 extensions::ExtensionToolbarModel::HighlightType highlight_type() const { | |
| 178 return model_ ? model_->highlight_type() | |
| 179 : extensions::ExtensionToolbarModel::HIGHLIGHT_NONE; | |
| 180 } | |
| 168 const PlatformSettings& platform_settings() const { | 181 const PlatformSettings& platform_settings() const { |
| 169 return platform_settings_; | 182 return platform_settings_; |
| 170 } | 183 } |
| 171 ToolbarActionViewController* popup_owner() { return popup_owner_; } | 184 ToolbarActionViewController* popup_owner() { return popup_owner_; } |
| 172 ToolbarActionViewController* popped_out_action() { | 185 ToolbarActionViewController* popped_out_action() { |
| 173 return popped_out_action_; | 186 return popped_out_action_; |
| 174 } | 187 } |
| 175 bool in_overflow_mode() const { return main_bar_ != nullptr; } | 188 bool in_overflow_mode() const { return main_bar_ != nullptr; } |
| 176 | 189 |
| 177 ToolbarActionsBarDelegate* delegate_for_test() { return delegate_; } | 190 ToolbarActionsBarDelegate* delegate_for_test() { return delegate_; } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 // The controller of the bubble to show once animation finishes, if any. | 302 // The controller of the bubble to show once animation finishes, if any. |
| 290 scoped_ptr<extensions::ExtensionMessageBubbleController> | 303 scoped_ptr<extensions::ExtensionMessageBubbleController> |
| 291 pending_extension_bubble_controller_; | 304 pending_extension_bubble_controller_; |
| 292 | 305 |
| 293 base::WeakPtrFactory<ToolbarActionsBar> weak_ptr_factory_; | 306 base::WeakPtrFactory<ToolbarActionsBar> weak_ptr_factory_; |
| 294 | 307 |
| 295 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); | 308 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); |
| 296 }; | 309 }; |
| 297 | 310 |
| 298 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ | 311 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ |
| OLD | NEW |