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

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

Issue 348313003: Create withheld permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kalman's Created 6 years, 6 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/active_script_controller.h
diff --git a/chrome/browser/extensions/active_script_controller.h b/chrome/browser/extensions/active_script_controller.h
index 1cd222769ed2b7bd14d73e71dc93c0afa2194509..8e0e577c63680d9e9d946ef61437d5515d18ed9e 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/permissions/permissions_data.h"
+#include "extensions/common/user_script.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,20 @@ 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,
+ UserScript::InjectionType 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 +90,29 @@ 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,
+ UserScript::InjectionType 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,
+ UserScript::InjectionType script_type,
+ int page_id,
+ int request_id);
// Grants permission for the given request to run.
void PermitScriptInjection(int request_id);
« no previous file with comments | « no previous file | chrome/browser/extensions/active_script_controller.cc » ('j') | extensions/common/extension_messages.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698