OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_ACTIONS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 19 matching lines...) Expand all Loading... |
30 class Extension; | 30 class Extension; |
31 } | 31 } |
32 | 32 |
33 namespace views { | 33 namespace views { |
34 class BubbleDialogDelegateView; | 34 class BubbleDialogDelegateView; |
35 class ResizeArea; | 35 class ResizeArea; |
36 } | 36 } |
37 | 37 |
38 // The BrowserActionsContainer is a container view, responsible for drawing the | 38 // The BrowserActionsContainer is a container view, responsible for drawing the |
39 // toolbar action icons (including extension icons and icons for component | 39 // toolbar action icons (including extension icons and icons for component |
40 // toolbar actions). It comes intwo flavors, a main container (when residing on | 40 // toolbar actions). It comes in two flavors, a main container (when residing on |
41 // the toolbar) and an overflow container (that resides in the main application | 41 // the toolbar) and an overflow container (that resides in the main application |
42 // menu, aka the Chrome menu). | 42 // menu, aka the Chrome menu). |
43 // | 43 // |
44 // When in 'main' mode, the container supports the full functionality of a | 44 // When in 'main' mode, the container supports the full functionality of a |
45 // BrowserActionContainer, but in 'overflow' mode the container is effectively | 45 // BrowserActionContainer, but in 'overflow' mode the container is effectively |
46 // just an overflow for the 'main' toolbar (shows only the icons that the main | 46 // just an overflow for the 'main' toolbar (shows only the icons that the main |
47 // toolbar does not) and as such does not have an overflow itself. The overflow | 47 // toolbar does not) and as such does not have an overflow itself. The overflow |
48 // container also does not support resizing. Since the main container only shows | 48 // container also does not support resizing. Since the main container only shows |
49 // icons in the Chrome toolbar, it is limited to a single row of icons. The | 49 // icons in the Chrome toolbar, it is limited to a single row of icons. The |
50 // overflow container, however, is allowed to display icons in multiple rows. | 50 // overflow container, however, is allowed to display icons in multiple rows. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // Returns the browser this container is associated with. | 129 // Returns the browser this container is associated with. |
130 Browser* browser() const { return browser_; } | 130 Browser* browser() const { return browser_; } |
131 | 131 |
132 ToolbarActionsBar* toolbar_actions_bar() { | 132 ToolbarActionsBar* toolbar_actions_bar() { |
133 return toolbar_actions_bar_.get(); | 133 return toolbar_actions_bar_.get(); |
134 } | 134 } |
135 | 135 |
136 // Get a particular toolbar action view. | 136 // Get a particular toolbar action view. |
137 ToolbarActionView* GetToolbarActionViewAt(int index) { | 137 ToolbarActionView* GetToolbarActionViewAt(int index) { |
138 return toolbar_action_views_[index]; | 138 return toolbar_action_views_[index].get(); |
139 } | 139 } |
140 | 140 |
141 // Whether we are performing resize animation on the container. | 141 // Whether we are performing resize animation on the container. |
142 bool animating() const { | 142 bool animating() const { |
143 return resize_animation_ && resize_animation_->is_animating(); | 143 return resize_animation_ && resize_animation_->is_animating(); |
144 } | 144 } |
145 | 145 |
146 // Returns the ID of the action represented by the view at |index|. | 146 // Returns the ID of the action represented by the view at |index|. |
147 std::string GetIdAt(size_t index) const; | 147 std::string GetIdAt(size_t index) const; |
148 | 148 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 protected: | 228 protected: |
229 // Overridden from views::View: | 229 // Overridden from views::View: |
230 void ViewHierarchyChanged( | 230 void ViewHierarchyChanged( |
231 const ViewHierarchyChangedDetails& details) override; | 231 const ViewHierarchyChangedDetails& details) override; |
232 void OnPaint(gfx::Canvas* canvas) override; | 232 void OnPaint(gfx::Canvas* canvas) override; |
233 | 233 |
234 private: | 234 private: |
235 // A struct representing the position at which an action will be dropped. | 235 // A struct representing the position at which an action will be dropped. |
236 struct DropPosition; | 236 struct DropPosition; |
237 | 237 |
238 typedef std::vector<ToolbarActionView*> ToolbarActionViews; | 238 typedef std::vector<std::unique_ptr<ToolbarActionView>> ToolbarActionViews; |
239 | 239 |
240 // Clears the |active_bubble_|, and unregisters the container as an observer. | 240 // Clears the |active_bubble_|, and unregisters the container as an observer. |
241 void ClearActiveBubble(views::Widget* widget); | 241 void ClearActiveBubble(views::Widget* widget); |
242 | 242 |
243 const ToolbarActionsBar::PlatformSettings& platform_settings() const { | 243 const ToolbarActionsBar::PlatformSettings& platform_settings() const { |
244 return toolbar_actions_bar_->platform_settings(); | 244 return toolbar_actions_bar_->platform_settings(); |
245 } | 245 } |
246 | 246 |
247 // The controlling ToolbarActionsBar, which handles most non-view logic. | 247 // The controlling ToolbarActionsBar, which handles most non-view logic. |
248 std::unique_ptr<ToolbarActionsBar> toolbar_actions_bar_; | 248 std::unique_ptr<ToolbarActionsBar> toolbar_actions_bar_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // is none. | 288 // is none. |
289 std::unique_ptr<DropPosition> drop_position_; | 289 std::unique_ptr<DropPosition> drop_position_; |
290 | 290 |
291 // The extension bubble that is actively showing, if any. | 291 // The extension bubble that is actively showing, if any. |
292 views::BubbleDialogDelegateView* active_bubble_; | 292 views::BubbleDialogDelegateView* active_bubble_; |
293 | 293 |
294 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 294 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
295 }; | 295 }; |
296 | 296 |
297 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 297 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |