Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3528)

Unified Diff: chrome/browser/ui/views/toolbar/browser_actions_container.h

Issue 553233002: Dynamically calculate the number of extension icons to show per row in overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't resize menu to accommodate Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 978a5c33ce7f637c7724bd8cf7e78bc8043c2a97..f56c5ff2946992f01eba1ffebaa8fb7948203d43 100644
--- a/chrome/browser/ui/views/toolbar/browser_actions_container.h
+++ b/chrome/browser/ui/views/toolbar/browser_actions_container.h
@@ -131,6 +131,10 @@ class BrowserActionsContainer
public BrowserActionView::Delegate,
public extensions::ExtensionKeybindingRegistry::Delegate {
public:
+ // Horizontal spacing between most items in the container, as well as after
+ // the last item or chevron (if visible).
+ static const int kItemSpacing;
+
// Constructs a BrowserActionContainer for a particular |browser| object, and
// specifies which view is the |owner_view|. For documentation of
// |main_container|, see class comments.
@@ -193,6 +197,7 @@ class BrowserActionsContainer
// Overridden from views::View:
virtual gfx::Size GetPreferredSize() const OVERRIDE;
+ virtual int GetHeightForWidth(int width) const OVERRIDE;
virtual gfx::Size GetMinimumSize() const OVERRIDE;
virtual void Layout() OVERRIDE;
virtual bool GetDropFormats(int* formats,
@@ -250,6 +255,12 @@ class BrowserActionsContainer
// unit tests.
void TestSetIconVisibilityCount(size_t icons);
+ // Returns the width of an icon, optionally with its padding.
+ static int IconWidth(bool include_padding);
+
+ // Returns the height of an icon.
+ static int IconHeight();
+
// During testing we can disable animations by setting this flag to true,
// so that the bar resizes instantly, instead of having to poll it while it
// animates to open/closed status.
@@ -263,19 +274,11 @@ class BrowserActionsContainer
virtual void OnThemeChanged() OVERRIDE;
private:
- friend class BrowserActionView; // So it can access IconWidth().
-
// A struct representing the position at which an action will be dropped.
struct DropPosition;
typedef std::vector<BrowserActionView*> BrowserActionViews;
- // Returns the width of an icon, optionally with its padding.
- static int IconWidth(bool include_padding);
-
- // Returns the height of an icon.
- static int IconHeight();
-
// extensions::ExtensionToolbarModel::Observer implementation.
virtual void ToolbarExtensionAdded(const extensions::Extension* extension,
int index) OVERRIDE;
@@ -422,6 +425,10 @@ class BrowserActionsContainer
ObserverList<BrowserActionsContainerObserver> observers_;
+ // The maximum number of icons to show per row when in overflow mode (showing
+ // icons in the application menu).
+ static int icons_per_overflow_menu_row_;
sky 2014/09/12 20:09:37 Why does this need to be static?
Devlin 2014/09/12 22:41:37 It doesn't really, but there should only be one me
+
DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
};
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | ui/views/controls/menu/menu_item_view.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698