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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 2499493004: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Fix effective TLD wildcard bug, move to Leaky LazyInstance in PermissionsData, removed unnecessary … Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 if (!system_->management_policy()->UserMayLoad(extension.get(), nullptr)) 1205 if (!system_->management_policy()->UserMayLoad(extension.get(), nullptr))
1206 to_unload.push_back(extension->id()); 1206 to_unload.push_back(extension->id());
1207 Extension::DisableReason disable_reason = Extension::DISABLE_NONE; 1207 Extension::DisableReason disable_reason = Extension::DISABLE_NONE;
1208 if (system_->management_policy()->MustRemainDisabled( 1208 if (system_->management_policy()->MustRemainDisabled(
1209 extension.get(), &disable_reason, nullptr)) 1209 extension.get(), &disable_reason, nullptr))
1210 to_disable[extension->id()] = disable_reason; 1210 to_disable[extension->id()] = disable_reason;
1211 } 1211 }
1212 1212
1213 extensions::ExtensionManagement* management = 1213 extensions::ExtensionManagement* management =
1214 extensions::ExtensionManagementFactory::GetForBrowserContext(profile()); 1214 extensions::ExtensionManagementFactory::GetForBrowserContext(profile());
1215 for (const auto& extension : registry_->enabled_extensions()) {
1216 extensions::PermissionsUpdater(profile()).SetPolicyHostRestrictions(
1217 extension.get(), management->GetRuntimeBlockedHosts(extension.get()),
1218 management->GetRuntimeAllowedHosts(extension.get()),
1219 management->UsesDefaultRuntimeHostRestrictions(extension.get()));
1220 }
1221 extensions::PermissionsUpdater(profile()).SetDefaultPolicyHostRestrictions(
1222 management->GetDefaultRuntimeBlockedHosts(),
1223 management->GetDefaultRuntimeAllowedHosts());
1215 1224
1216 // Loop through the disabled extension list, find extensions to re-enable 1225 // Loop through the disabled extension list, find extensions to re-enable
1217 // automatically. These extensions are exclusive from the |to_disable| and 1226 // automatically. These extensions are exclusive from the |to_disable| and
1218 // |to_unload| lists constructed above, since disabled_extensions() and 1227 // |to_unload| lists constructed above, since disabled_extensions() and
1219 // enabled_extensions() are supposed to be mutually exclusive. 1228 // enabled_extensions() are supposed to be mutually exclusive.
1220 for (const auto& extension : registry_->disabled_extensions()) { 1229 for (const auto& extension : registry_->disabled_extensions()) {
1221 // Find all disabled extensions disabled due to minimum version requirement, 1230 // Find all disabled extensions disabled due to minimum version requirement,
1222 // but now satisfying it. 1231 // but now satisfying it.
1223 if (management->CheckMinimumVersion(extension.get(), nullptr) && 1232 if (management->CheckMinimumVersion(extension.get(), nullptr) &&
1224 extension_prefs_->HasDisableReason( 1233 extension_prefs_->HasDisableReason(
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 } 2486 }
2478 2487
2479 void ExtensionService::OnProfileDestructionStarted() { 2488 void ExtensionService::OnProfileDestructionStarted() {
2480 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2489 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2481 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2490 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2482 it != ids_to_unload.end(); 2491 it != ids_to_unload.end();
2483 ++it) { 2492 ++it) {
2484 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2493 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2485 } 2494 }
2486 } 2495 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698