| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |