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

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: Latest master Created 6 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/active_script_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5e72e702b2a5f9d4f6885b3b24844785b4fe7b91..21e068dcf04945e257ab0bd013ac2c22ca0606fc 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,17 +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,
- 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.
@@ -71,16 +62,44 @@ 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,
+ const base::Closure& callback) {
+ return RequestScriptInjection(extension, callback);
+ }
+#endif // defined(UNIT_TEST)
+
private:
typedef std::vector<base::Closure> 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,
+ 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,
- int64 request_id);
+ void OnRequestScriptInjectionPermission(
+ const std::string& extension_id,
+ UserScript::InjectionType script_type,
+ int64 request_id);
// Grants permission for the given request to run.
void PermitScriptInjection(int64 request_id);
« no previous file with comments | « no previous file | chrome/browser/extensions/active_script_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698