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

Unified Diff: chrome/browser/extensions/api/extension_action/extension_action_api.h

Issue 496863003: Consolidate ExtensionAction execution code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/api/extension_action/extension_action_api.h
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.h b/chrome/browser/extensions/api/extension_action/extension_action_api.h
index ac29d1f786282b2c3bf8109ee37bdda65f991500..171f8e4d964192eaf1f5f312fabebf45e9d3c355 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.h
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.h
@@ -66,18 +66,6 @@ class ExtensionActionAPI : public BrowserContextKeyedAPI {
const std::string& extension_id,
bool visible);
- // Fires the onClicked event for page_action.
- static void PageActionExecuted(content::BrowserContext* context,
- const ExtensionAction& page_action,
- int tab_id,
- const std::string& url,
- int button);
-
- // Fires the onClicked event for browser_action.
- static void BrowserActionExecuted(content::BrowserContext* context,
- const ExtensionAction& browser_action,
- content::WebContents* web_contents);
-
// BrowserContextKeyedAPI implementation.
static BrowserContextKeyedAPIFactory<ExtensionActionAPI>*
GetFactoryInstance();
@@ -86,6 +74,15 @@ class ExtensionActionAPI : public BrowserContextKeyedAPI {
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
+ // Executes the action of the given |extension| on the |browser|'s active
+ // web contents. If |grant_tab_permissions| is true, this will also grant
+ // activeTab to the extension (so this should only be done if this is through
+ // a direct user action). Returns the action that should be taken.
+ ExtensionAction::ShowAction ExecuteExtensionAction(
+ const Extension* extension,
+ Browser* browser,
+ bool grant_active_tab_permissions);
+
void NotifyChange(ExtensionAction* extension_action,
content::WebContents* web_contents,
content::BrowserContext* browser_context);
@@ -97,17 +94,16 @@ class ExtensionActionAPI : public BrowserContextKeyedAPI {
private:
friend class BrowserContextKeyedAPIFactory<ExtensionActionAPI>;
- // The DispatchEvent methods forward events to the |profile|'s event router.
- static void DispatchEventToExtension(content::BrowserContext* context,
- const std::string& extension_id,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ // The DispatchEvent methods forward events to the |context|'s event router.
+ void DispatchEventToExtension(content::BrowserContext* context,
+ const std::string& extension_id,
+ const std::string& event_name,
+ scoped_ptr<base::ListValue> event_args);
// Called when either a browser or page action is executed. Figures out which
// event to send based on what the extension wants.
- static void ExtensionActionExecuted(content::BrowserContext* context,
- const ExtensionAction& extension_action,
- content::WebContents* web_contents);
+ void ExtensionActionExecuted(const ExtensionAction& extension_action,
+ content::WebContents* web_contents);
// BrowserContextKeyedAPI implementation.
virtual void Shutdown() OVERRIDE;

Powered by Google App Engine
This is Rietveld 408576698