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

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

Issue 489183005: Make a ShowExtensionActionPopup function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's Created 6 years, 4 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 c0d35d6aa9a35c02be70fbf122a7e4bd907c12a7..29e83b385d9b6e464860b90011ecdbb4da1cceb9 100644
--- a/chrome/browser/extensions/extension_toolbar_model.h
+++ b/chrome/browser/extensions/extension_toolbar_model.h
@@ -37,8 +37,8 @@ class ExtensionToolbarModel : public content::NotificationObserver,
// A class which is informed of changes to the model; represents the view of
// MVC. Also used for signaling view changes such as showing extension popups.
- // TODO(devlin): Should this really be an observer? There should probably be
- // only one (aka a Delegate)...
+ // TODO(devlin): Should this really be an observer? It acts more like a
+ // delegate.
class Observer {
public:
// An extension has been added to the toolbar and should go at |index|.
@@ -59,8 +59,11 @@ class ExtensionToolbarModel : public content::NotificationObserver,
virtual void ToolbarExtensionUpdated(const Extension* extension) = 0;
// Signal the |extension| to show the popup now in the active window.
+ // If |grant_active_tab| is true, then active tab permissions should be
+ // given to the extension (only do this if this is through a user action).
// Returns true if a popup was slated to be shown.
- virtual bool ShowExtensionActionPopup(const Extension* extension) = 0;
+ virtual bool ShowExtensionActionPopup(const Extension* extension,
+ bool grant_active_tab) = 0;
// Signal when the container needs to be redrawn because of a size change,
// and when the model has finished loading.
@@ -75,6 +78,9 @@ class ExtensionToolbarModel : public content::NotificationObserver,
// with the new set (and just assume the new set is different).
virtual void ToolbarHighlightModeChanged(bool is_highlighting) = 0;
+ // Returns the browser associated with the Observer.
+ virtual Browser* GetBrowser() = 0;
+
protected:
virtual ~Observer() {}
};
@@ -112,9 +118,13 @@ class ExtensionToolbarModel : public content::NotificationObserver,
void OnExtensionToolbarPrefChange();
- // Tells observers to display a popup without granting tab permissions and
- // returns whether the popup was slated to be shown.
- bool ShowBrowserActionPopup(const Extension* extension);
+ // 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
+ // a direct user action.
+ bool ShowExtensionActionPopup(const Extension* extension,
+ Browser* browser,
+ bool grant_active_tab);
// Ensures that the extensions in the |extension_ids| list are visible on the
// toolbar. This might mean they need to be moved to the front (if they are in
« no previous file with comments | « chrome/browser/extensions/extension_action_manager.cc ('k') | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698