| Index: chrome/browser/extensions/active_script_controller.h
|
| diff --git a/chrome/browser/extensions/active_script_controller.h b/chrome/browser/extensions/active_script_controller.h
|
| index 1cd222769ed2b7bd14d73e71dc93c0afa2194509..5b1349d236307c824c216a8664bb3b109ab311ef 100644
|
| --- a/chrome/browser/extensions/active_script_controller.h
|
| +++ b/chrome/browser/extensions/active_script_controller.h
|
| @@ -15,6 +15,8 @@
|
| #include "base/memory/linked_ptr.h"
|
| #include "chrome/browser/extensions/location_bar_controller.h"
|
| #include "content/public/browser/web_contents_observer.h"
|
| +#include "extensions/common/constants.h"
|
| +#include "extensions/common/permissions/permissions_data.h"
|
|
|
| namespace content {
|
| class WebContents;
|
| @@ -44,18 +46,6 @@ class ActiveScriptController : public LocationBarController::ActionProvider,
|
| static ActiveScriptController* GetForWebContents(
|
| content::WebContents* web_contents);
|
|
|
| - // Returns true if the extension requesting script injection requires
|
| - // user consent. If this is true, the caller should then register a request
|
| - // via RequestScriptInjection().
|
| - bool RequiresUserConsentForScriptInjection(const Extension* extension);
|
| -
|
| - // Register a request for a script injection, to be executed by running
|
| - // |callback|. The only assumption that can be made about when (or if)
|
| - // |callback| is run is that, if it is run, it will run on the current page.
|
| - void RequestScriptInjection(const Extension* extension,
|
| - int page_id,
|
| - const base::Closure& callback);
|
| -
|
| // Notifies the ActiveScriptController that an extension has been granted
|
| // active tab permissions. This will run any pending injections for that
|
| // extension.
|
| @@ -72,6 +62,19 @@ class ActiveScriptController : public LocationBarController::ActionProvider,
|
| virtual void OnNavigated() OVERRIDE;
|
| virtual void OnExtensionUnloaded(const Extension* extension) OVERRIDE;
|
|
|
| +#if defined(UNIT_TEST)
|
| + // Only used in tests.
|
| + PermissionsData::AccessType RequiresUserConsentForScriptInjectionForTesting(
|
| + const Extension* extension, extension_misc::InjectedScriptType type) {
|
| + return RequiresUserConsentForScriptInjection(extension, type);
|
| + }
|
| + void RequestScriptInjectionForTesting(const Extension* extension,
|
| + int page_id,
|
| + const base::Closure& callback) {
|
| + return RequestScriptInjection(extension, page_id, callback);
|
| + }
|
| +#endif // defined(UNIT_TEST)
|
| +
|
| private:
|
| // A single pending request. This could be a pair, but we'd have way too many
|
| // stl typedefs, and "request.closure" is nicer than "request.first".
|
| @@ -86,13 +89,28 @@ class ActiveScriptController : public LocationBarController::ActionProvider,
|
| typedef std::vector<PendingRequest> PendingRequestList;
|
| typedef std::map<std::string, PendingRequestList> PendingRequestMap;
|
|
|
| + // Returns true if the extension requesting script injection requires
|
| + // user consent. If this is true, the caller should then register a request
|
| + // via RequestScriptInjection().
|
| + PermissionsData::AccessType RequiresUserConsentForScriptInjection(
|
| + const Extension* extension, extension_misc::InjectedScriptType type);
|
| +
|
| + // |callback|. The only assumption that can be made about when (or if)
|
| + // |callback| is run is that, if it is run, it will run on the current page.
|
| + void RequestScriptInjection(const Extension* extension,
|
| + int page_id,
|
| + const base::Closure& callback);
|
| +
|
| + // Register a request for a script injection, to be executed by running
|
| // Runs any pending injections for the corresponding extension.
|
| void RunPendingForExtension(const Extension* extension);
|
|
|
| // Handle the RequestScriptInjectionPermission message.
|
| - void OnRequestScriptInjectionPermission(const std::string& extension_id,
|
| - int page_id,
|
| - int request_id);
|
| + void OnRequestScriptInjectionPermission(
|
| + const std::string& extension_id,
|
| + extension_misc::InjectedScriptType script_type,
|
| + int page_id,
|
| + int request_id);
|
|
|
| // Grants permission for the given request to run.
|
| void PermitScriptInjection(int request_id);
|
|
|