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

Unified Diff: chrome/browser/extensions/extension_util.cc

Issue 348313003: Create withheld permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fix 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/extension_util.cc
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index 6b27885445973a01fb41f875222c267a0e1e99c6..8d3d924f0811411bbbb612622bda9cfe7fdf3efa 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -24,6 +24,7 @@
#include "extensions/common/features/simple_feature.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
+#include "extensions/common/permissions/permissions_data.h"
#include "grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
@@ -183,10 +184,23 @@ bool AllowedScriptingOnAllUrls(const std::string& extension_id,
void SetAllowedScriptingOnAllUrls(const std::string& extension_id,
content::BrowserContext* context,
bool allowed) {
+ if (allowed == AllowedScriptingOnAllUrls(extension_id, context))
+ return; // Nothing to do here.
+
ExtensionPrefs::Get(context)->UpdateExtensionPref(
extension_id,
kExtensionAllowedOnAllUrlsPrefName,
allowed ? new base::FundamentalValue(true) : NULL);
+
+ const Extension* extension =
+ ExtensionRegistry::Get(context)->enabled_extensions().GetByID(
+ extension_id);
+ if (extension) {
+ if (allowed)
+ extension->permissions_data()->GrantWithheldAllHosts();
not at google - send to devlin 2014/06/30 14:37:03 - what about on browser startup (I can't see an ob
Devlin 2014/06/30 17:06:10 Whoops. Had that in there at some point, but it m
+ else
+ extension->permissions_data()->WithholdAllHosts();
+ }
}
bool IsAppLaunchable(const std::string& extension_id,

Powered by Google App Engine
This is Rietveld 408576698