Index: chrome/browser/ui/views/toolbar/browser_actions_container.h |
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.h b/chrome/browser/ui/views/toolbar/browser_actions_container.h |
index 9874e79cbcfb0aa5a3599f98271d2042593f4bd4..59342476796857364b74b112bb1b3129d7e84d4e 100644 |
--- a/chrome/browser/ui/views/toolbar/browser_actions_container.h |
+++ b/chrome/browser/ui/views/toolbar/browser_actions_container.h |
@@ -42,17 +42,25 @@ namespace views { |
class ResizeArea; |
} |
-//////////////////////////////////////////////////////////////////////////////// |
-// |
// The BrowserActionsContainer is a container view, responsible for drawing the |
-// browser action icons (extensions that add icons to the toolbar). |
+// browser action icons (extensions that add icons to the toolbar). It comes in |
+// two flavors, "master" (used for the toolbar) and "slave" (used in the main |
Devlin
2014/06/23 17:55:29
"master" and "slave" is kinda weird here, because
Finnur
2014/06/25 16:18:11
Converted to main and overflow.
|
+// application menu, known as the Hot Dog menu). The master container |
+// supports the full functionality of a BrowserActionContainer but the slave |
+// container is effectively just the overflow for the master (shows only the |
+// icons that the master does not) and as such does not have an overflow itself. |
+// The slave also does not support resizing. Since the master container only |
+// shows icons in the Chrome toolbar, it is limited to a single row of icons. |
+// The slave, however, is allowed to display icons in multiple rows. |
// |
-// The container is placed flush against the omnibox and wrench menu, and its |
-// layout looks like: |
+// The master container is placed flush against the omnibox and hot dog menu, |
+// whereas the slave container is placed at the top of the hot dog menu. The |
Devlin
2014/06/23 17:55:29
nit: I would say "the slave container is placed wi
|
+// layout is similar to this: |
// rI_I_IcCs |
// Where the letters are as follows: |
// r: An invisible resize area. This is ToolbarView::kStandardSpacing pixels |
-// wide and directly adjacent to the omnibox. |
+// wide and directly adjacent to the omnibox. Only shown for the master |
+// container. |
// I: An icon. This is as wide as the IDR_BROWSER_ACTION image. |
// _: kItemSpacing pixels of empty space. |
// c: kChevronSpacing pixels of empty space. Only present if C is present. |
@@ -66,7 +74,8 @@ class ResizeArea; |
// ultimate drop indicator. (Otherwise, we'd be trying to draw it into the |
// padding beyond our right edge, and it wouldn't appear.) |
// |
-// The BrowserActionsContainer follows a few rules, in terms of user experience: |
+// The BrowserActionsContainer in master mode follows a few rules, in terms of |
+// user experience: |
// |
// 1) The container can never grow beyond the space needed to show all icons |
// (hereby referred to as the max width). |
@@ -81,7 +90,7 @@ class ResizeArea; |
// 5) If the container is NOT at max width (has an overflow menu), we respect |
// that size when adding and removing icons and DON'T grow/shrink the container. |
// This means that new icons (which always appear at the far right) will show up |
-// in the overflow menu. The install bubble for extensions points to the chevron |
+// in the overflow. The install bubble for extensions points to the chevron |
// menu in this case. |
// |
// Resizing the BrowserActionsContainer: |
@@ -125,7 +134,12 @@ class BrowserActionsContainer |
public BrowserActionView::Delegate, |
public extensions::ExtensionKeybindingRegistry::Delegate { |
public: |
- BrowserActionsContainer(Browser* browser, views::View* owner_view); |
+ // Constructs a BrowserActionContainer for a particular |browser| object, and |
+ // specifies which view is the |owner_view|. For documentation of |master|, |
+ // see class comments. |
+ BrowserActionsContainer(Browser* browser, |
+ views::View* owner_view, |
+ BrowserActionsContainer* master); |
virtual ~BrowserActionsContainer(); |
void Init(); |
@@ -225,6 +239,7 @@ class BrowserActionsContainer |
virtual int GetCurrentTabId() const OVERRIDE; |
virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE; |
virtual void OnBrowserActionVisibilityChanged() OVERRIDE; |
+ virtual bool ShownInsideMenu() const OVERRIDE; |
// Overridden from extension::ExtensionKeybindingRegistry::Delegate: |
virtual extensions::ActiveTabPermissionGranter* |
@@ -346,6 +361,10 @@ class BrowserActionsContainer |
ExtensionPopup::ShowAction show_action, |
bool grant_tab_permissions); |
+ // Whether this container is slave (See class comments for details on slave |
+ // mode). |
+ bool is_slave() const { return master_ != NULL; } |
+ |
// The vector of browser actions (icons/image buttons for each action). Note |
// that not every BrowserAction in the ToolbarModel will necessarily be in |
// this collection. Some extensions may be disabled in incognito windows. |
@@ -359,6 +378,10 @@ class BrowserActionsContainer |
// The view that owns us. |
views::View* owner_view_; |
+ // The master container we are serving as overflow for, or NULL if this |
+ // class is the master. See class comments for details on master/slave mode. |
+ BrowserActionsContainer* master_; |
+ |
// The current popup and the button it came from. NULL if no popup. |
ExtensionPopup* popup_; |
@@ -375,7 +398,8 @@ class BrowserActionsContainer |
// The resize area for the container. |
views::ResizeArea* resize_area_; |
- // The chevron for accessing the overflow items. |
+ // The chevron for accessing the overflow items. Can be NULL if the toolbar |
+ // is permanently suppressing the chevron menu. |
views::MenuButton* chevron_; |
// The painter used when we are highlighting a subset of extensions. |