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

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

Issue 25305002: Implement initial chrome.browserAction.openPopup API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 7 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 df01de5d17281de69b7072048f8efca77b573e26..ef35793664fdc9b29b9658d907ac9423e98ec75a 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,7 +66,13 @@ 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 browser action should grant the page tab permissions. The showPopup API
+ // does not grant permissions.
+ Action ExecuteBrowserAction(const extensions::Extension* extension,
+ Browser* browser,
+ GURL* popup_url_out,
+ bool should_grant);
Action ExecuteBrowserAction(const extensions::Extension* extension,
Browser* browser,
GURL* popup_url_out);
@@ -85,6 +95,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,

Powered by Google App Engine
This is Rietveld 408576698