Add a withheld permissions model to PermissionsData. Withheld permissions are the permissions which were requested by the extension, but not granted due to how dangerous/powerful they are.  Currently, these withheld permissions are only used for all hosts, and only behind the scripts_require_action flag.

BUG=362353

Review URL: https://codereview.chromium.org/348313003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281605 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/active_script_controller.h b/chrome/browser/extensions/active_script_controller.h
index 5e72e70..21e068dc 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 @@
   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 @@
   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);