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

Unified Diff: chrome/browser/extensions/extension_toolbar_model.h

Issue 675023002: Make extensions that desire to act pop out if in overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fixes Created 6 years, 2 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/extensions/extension_toolbar_model.h
diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h
index 950366e7768daa6bb3cbb5b9f9d845ef54b30d6e..088171bd0818fc382540ef6bf184cb2b5d39134e 100644
--- a/chrome/browser/extensions/extension_toolbar_model.h
+++ b/chrome/browser/extensions/extension_toolbar_model.h
@@ -78,6 +78,12 @@ class ExtensionToolbarModel : public content::NotificationObserver,
// with the new set (and just assume the new set is different).
virtual void ToolbarHighlightModeChanged(bool is_highlighting) = 0;
+ // Signal that the toolbar needs to be reordered for the given
+ // |web_contents|. This is caused by an overflowed action wanting to run,
+ // and needing to "pop itself out".
+ virtual void ToolbarReorderNecessary(
+ content::WebContents* web_contents) = 0;
+
// Returns the browser associated with the Observer.
virtual Browser* GetBrowser() = 0;
@@ -103,6 +109,12 @@ class ExtensionToolbarModel : public content::NotificationObserver,
// As above, a return value of -1 represents "show all actions".
int GetVisibleIconCount() const { return visible_icon_count_; }
+ // Returns the number of visible icons as an absolute value.
+ size_t GetAbsoluteVisibleIconCount() const {
+ return visible_icon_count_ == -1 ?
+ toolbar_items().size() : static_cast<size_t>(visible_icon_count_);
+ }
+
bool extensions_initialized() const { return extensions_initialized_; }
const ExtensionList& toolbar_items() const {
@@ -113,6 +125,17 @@ class ExtensionToolbarModel : public content::NotificationObserver,
void OnExtensionToolbarPrefChange();
+ // Returns the item order for a given tab. This can be different from the
+ // base item order if the action wants to run on the given page, and needs to
+ // be popped out of overflow.
+ ExtensionList GetItemOrderForTab(content::WebContents* web_contents) const;
+
+ // Returns the visible icon count for a given tab. This can be different from
+ // the base item order if the action wants to run on the given page and needs
+ // to be popped out of overflow.
+ // A result of -1 indicates "all icons".
+ int GetVisibleIconCountForTab(content::WebContents* web_contents) const;
+
// Finds the Observer associated with |browser| and tells it to display a
// popup for the given |extension|. If |grant_active_tab| is true, this
// grants active tab permissions to the |extension|; only do this because of

Powered by Google App Engine
This is Rietveld 408576698