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

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

Issue 2499493004: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: nits Created 3 years, 8 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_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 41f485b713f42f737eb6dfe3c2418357691faee1..de3963cedbeca5e1d716ca849a2bc683864a6db2 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1257,6 +1257,21 @@ void ExtensionService::CheckManagementPolicy() {
extensions::ExtensionManagement* management =
extensions::ExtensionManagementFactory::GetForBrowserContext(profile());
+ extensions::PermissionsUpdater(profile()).SetDefaultPolicyHostRestrictions(
+ management->GetDefaultRuntimeBlockedHosts(),
+ management->GetDefaultRuntimeAllowedHosts());
+ for (const auto& extension : registry_->enabled_extensions()) {
+ bool uses_default =
+ management->UsesDefaultRuntimeHostRestrictions(extension.get());
+ if (uses_default) {
+ extensions::PermissionsUpdater(profile()).SetUsesDefaultHostRestrictions(
+ extension.get());
+ } else {
+ extensions::PermissionsUpdater(profile()).SetPolicyHostRestrictions(
+ extension.get(), management->GetRuntimeBlockedHosts(extension.get()),
+ management->GetRuntimeAllowedHosts(extension.get()));
+ }
+ }
// Loop through the disabled extension list, find extensions to re-enable
// automatically. These extensions are exclusive from the |to_disable| and

Powered by Google App Engine
This is Rietveld 408576698