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

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

Issue 2499493004: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Style fixes, prevent heap leak. Created 3 years, 10 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 4cecaddab3e02cc9e9697c9d3f7a01d4ab746468..74a1c6eb93d56b5e166779e7d7edc45768a97853 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -871,7 +871,6 @@ void ExtensionService::EnableExtension(const std::string& extension_id) {
UMA_HISTOGRAM_COUNTS_100("Extensions.EnableDeniedByPolicy", 1);
return;
}
-
Devlin 2017/02/14 23:17:09 nit: remove extraneous change
nrpeter 2017/03/22 23:47:38 Done.
extension_prefs_->SetExtensionEnabled(extension_id);
// This can happen if sync enables an extension that is not installed yet.
@@ -1212,6 +1211,15 @@ void ExtensionService::CheckManagementPolicy() {
extensions::ExtensionManagement* management =
extensions::ExtensionManagementFactory::GetForBrowserContext(profile());
+ for (const auto& extension : registry_->enabled_extensions()) {
+ extensions::PermissionsUpdater(profile()).SetPolicyHostRestrictions(
+ extension.get(), management->GetRuntimeBlockedHosts(extension.get()),
+ management->GetRuntimeAllowedHosts(extension.get()),
+ management->UsesDefaultRuntimeHostRestrictions(extension.get()));
+ }
+ extensions::PermissionsUpdater(profile()).SetDefaultPolicyHostRestrictions(
+ management->GetDefaultRuntimeBlockedHosts(),
+ management->GetDefaultRuntimeAllowedHosts());
// Loop through the disabled extension list, find extensions to re-enable
// automatically. These extensions are exclusive from the |to_disable| and
@@ -1460,7 +1468,6 @@ void ExtensionService::AddExtension(const Extension* extension) {
disable_flag_exempted_extensions_.count(extension->id()) == 0) {
return;
}
-
Devlin 2017/02/14 23:17:09 remove extraneous change
nrpeter 2017/03/22 23:47:38 Done.
bool is_extension_upgrade = false;
bool is_extension_loaded = false;
const Extension* old = GetInstalledExtension(extension->id());

Powered by Google App Engine
This is Rietveld 408576698