| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 friend class BrowserContextKeyedAPIFactory<ExtensionActionAPI>; | 94 friend class BrowserContextKeyedAPIFactory<ExtensionActionAPI>; |
| 95 | 95 |
| 96 // The DispatchEvent methods forward events to the |profile|'s event router. | 96 // The DispatchEvent methods forward events to the |profile|'s event router. |
| 97 static void DispatchEventToExtension(content::BrowserContext* context, | 97 static void DispatchEventToExtension(content::BrowserContext* context, |
| 98 const std::string& extension_id, | 98 const std::string& extension_id, |
| 99 const std::string& event_name, | 99 const std::string& event_name, |
| 100 scoped_ptr<base::ListValue> event_args); | 100 scoped_ptr<base::ListValue> event_args); |
| 101 | 101 |
| 102 // Called to dispatch a deprecated style page action click event that was | |
| 103 // registered like: | |
| 104 // chrome.pageActions["name"].addListener(function(actionId, info){}) | |
| 105 static void DispatchOldPageActionEvent(content::BrowserContext* context, | |
| 106 const std::string& extension_id, | |
| 107 const std::string& page_action_id, | |
| 108 int tab_id, | |
| 109 const std::string& url, | |
| 110 int button); | |
| 111 | |
| 112 // Called when either a browser or page action is executed. Figures out which | 102 // Called when either a browser or page action is executed. Figures out which |
| 113 // event to send based on what the extension wants. | 103 // event to send based on what the extension wants. |
| 114 static void ExtensionActionExecuted(content::BrowserContext* context, | 104 static void ExtensionActionExecuted(content::BrowserContext* context, |
| 115 const ExtensionAction& extension_action, | 105 const ExtensionAction& extension_action, |
| 116 content::WebContents* web_contents); | 106 content::WebContents* web_contents); |
| 117 | 107 |
| 118 // BrowserContextKeyedAPI implementation. | 108 // BrowserContextKeyedAPI implementation. |
| 119 virtual void Shutdown() OVERRIDE; | 109 virtual void Shutdown() OVERRIDE; |
| 120 static const char* service_name() { return "ExtensionActionAPI"; } | 110 static const char* service_name() { return "ExtensionActionAPI"; } |
| 121 static const bool kServiceRedirectedInIncognito = true; | 111 static const bool kServiceRedirectedInIncognito = true; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 class PageActionGetPopupFunction | 464 class PageActionGetPopupFunction |
| 475 : public extensions::ExtensionActionGetPopupFunction { | 465 : public extensions::ExtensionActionGetPopupFunction { |
| 476 public: | 466 public: |
| 477 DECLARE_EXTENSION_FUNCTION("pageAction.getPopup", PAGEACTION_GETPOPUP) | 467 DECLARE_EXTENSION_FUNCTION("pageAction.getPopup", PAGEACTION_GETPOPUP) |
| 478 | 468 |
| 479 protected: | 469 protected: |
| 480 virtual ~PageActionGetPopupFunction() {} | 470 virtual ~PageActionGetPopupFunction() {} |
| 481 }; | 471 }; |
| 482 | 472 |
| 483 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H
_ | 473 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H
_ |
| OLD | NEW |