summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_toolbar_model.h
diff options
context:
space:
mode:
authorjustinlin@chromium.org <justinlin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-21 11:24:51 +0000
committerjustinlin@chromium.org <justinlin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-21 11:24:51 +0000
commitcdad5e7c630c3182d2dd91ed928639358ef0f016 (patch)
tree9c7283c47e353bb0b5144da736f146dd86e2d459 /chrome/browser/extensions/extension_toolbar_model.h
parentf2be49c44db038055104bba5a00d7de973d301eb (diff)
downloadchromium_src-cdad5e7c630c3182d2dd91ed928639358ef0f016.zip
chromium_src-cdad5e7c630c3182d2dd91ed928639358ef0f016.tar.gz
chromium_src-cdad5e7c630c3182d2dd91ed928639358ef0f016.tar.bz2
Implement chrome.browserAction.openPopup API.
https://docs.google.com/a/google.com/document/d/10NtNR0R77izXUd3kWWvrIzyqIJ2ZRP8jkkzuHw7mNUY/edit BUG=305744 Review URL: https://codereview.chromium.org/25305002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_toolbar_model.h')
-rw-r--r--chrome/browser/extensions/extension_toolbar_model.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h
index df01de5..1d77d4e 100644
--- a/chrome/browser/extensions/extension_toolbar_model.h
+++ b/chrome/browser/extensions/extension_toolbar_model.h
@@ -33,7 +33,7 @@ class ExtensionToolbarModel : public content::NotificationObserver {
};
// A class which is informed of changes to the model; represents the view of
- // MVC.
+ // MVC. Also used for signaling view changes such as showing extension popups.
class Observer {
public:
// An extension with a browser action button has been added, and should go
@@ -48,6 +48,10 @@ class ExtensionToolbarModel : public content::NotificationObserver {
virtual void BrowserActionMoved(const extensions::Extension* extension,
int index) {}
+ // Signal the |extension| to show the popup now in the active window.
+ // Returns true if a popup was slated to be shown.
+ virtual bool BrowserActionShowPopup(const extensions::Extension* extension);
+
// Called when the model has finished loading.
virtual void ModelLoaded() {}
@@ -62,10 +66,14 @@ class ExtensionToolbarModel : public content::NotificationObserver {
// Executes the browser action for an extension and returns the action that
// the UI should perform in response.
// |popup_url_out| will be set if the extension should show a popup, with
- // the URL that should be shown, if non-NULL.
+ // the URL that should be shown, if non-NULL. |should_grant| controls whether
+ // the extension should be granted page tab permissions, which is what happens
+ // when the user clicks the browser action, but not, for example, when the
+ // showPopup API is called.
Action ExecuteBrowserAction(const extensions::Extension* extension,
Browser* browser,
- GURL* popup_url_out);
+ GURL* popup_url_out,
+ bool should_grant);
// If count == size(), this will set the visible icon count to -1, meaning
// "show all actions".
void SetVisibleIconCount(int count);
@@ -85,6 +93,10 @@ 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 extensions::Extension* extension);
+
private:
// content::NotificationObserver implementation.
virtual void Observe(int type,