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

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

Issue 2820333003: Revert of Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: 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 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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 if (!system_->management_policy()->UserMayLoad(extension.get(), nullptr)) 1250 if (!system_->management_policy()->UserMayLoad(extension.get(), nullptr))
1251 to_unload.push_back(extension->id()); 1251 to_unload.push_back(extension->id());
1252 Extension::DisableReason disable_reason = Extension::DISABLE_NONE; 1252 Extension::DisableReason disable_reason = Extension::DISABLE_NONE;
1253 if (system_->management_policy()->MustRemainDisabled( 1253 if (system_->management_policy()->MustRemainDisabled(
1254 extension.get(), &disable_reason, nullptr)) 1254 extension.get(), &disable_reason, nullptr))
1255 to_disable[extension->id()] = disable_reason; 1255 to_disable[extension->id()] = disable_reason;
1256 } 1256 }
1257 1257
1258 extensions::ExtensionManagement* management = 1258 extensions::ExtensionManagement* management =
1259 extensions::ExtensionManagementFactory::GetForBrowserContext(profile()); 1259 extensions::ExtensionManagementFactory::GetForBrowserContext(profile());
1260 extensions::PermissionsUpdater(profile()).SetDefaultPolicyHostRestrictions(
1261 management->GetDefaultRuntimeBlockedHosts(),
1262 management->GetDefaultRuntimeAllowedHosts());
1263 for (const auto& extension : registry_->enabled_extensions()) {
1264 bool uses_default =
1265 management->UsesDefaultRuntimeHostRestrictions(extension.get());
1266 if (uses_default) {
1267 extensions::PermissionsUpdater(profile()).SetUsesDefaultHostRestrictions(
1268 extension.get());
1269 } else {
1270 extensions::PermissionsUpdater(profile()).SetPolicyHostRestrictions(
1271 extension.get(), management->GetRuntimeBlockedHosts(extension.get()),
1272 management->GetRuntimeAllowedHosts(extension.get()));
1273 }
1274 }
1275 1260
1276 // Loop through the disabled extension list, find extensions to re-enable 1261 // Loop through the disabled extension list, find extensions to re-enable
1277 // automatically. These extensions are exclusive from the |to_disable| and 1262 // automatically. These extensions are exclusive from the |to_disable| and
1278 // |to_unload| lists constructed above, since disabled_extensions() and 1263 // |to_unload| lists constructed above, since disabled_extensions() and
1279 // enabled_extensions() are supposed to be mutually exclusive. 1264 // enabled_extensions() are supposed to be mutually exclusive.
1280 for (const auto& extension : registry_->disabled_extensions()) { 1265 for (const auto& extension : registry_->disabled_extensions()) {
1281 // Find all disabled extensions disabled due to minimum version requirement, 1266 // Find all disabled extensions disabled due to minimum version requirement,
1282 // but now satisfying it. 1267 // but now satisfying it.
1283 if (management->CheckMinimumVersion(extension.get(), nullptr) && 1268 if (management->CheckMinimumVersion(extension.get(), nullptr) &&
1284 extension_prefs_->HasDisableReason( 1269 extension_prefs_->HasDisableReason(
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2573 } 2558 }
2574 2559
2575 void ExtensionService::OnProfileDestructionStarted() { 2560 void ExtensionService::OnProfileDestructionStarted() {
2576 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2561 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2577 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2562 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2578 it != ids_to_unload.end(); 2563 it != ids_to_unload.end();
2579 ++it) { 2564 ++it) {
2580 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2565 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2581 } 2566 }
2582 } 2567 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698