| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 using extensions::Extension; | 102 using extensions::Extension; |
| 103 using extensions::ExtensionIdSet; | 103 using extensions::ExtensionIdSet; |
| 104 using extensions::ExtensionInfo; | 104 using extensions::ExtensionInfo; |
| 105 using extensions::ExtensionRegistry; | 105 using extensions::ExtensionRegistry; |
| 106 using extensions::ExtensionSet; | 106 using extensions::ExtensionSet; |
| 107 using extensions::FeatureSwitch; | 107 using extensions::FeatureSwitch; |
| 108 using extensions::InstallVerifier; | 108 using extensions::InstallVerifier; |
| 109 using extensions::ManagementPolicy; | 109 using extensions::ManagementPolicy; |
| 110 using extensions::Manifest; | 110 using extensions::Manifest; |
| 111 using extensions::PermissionMessage; | 111 using extensions::PermissionMessage; |
| 112 using extensions::PermissionMessages; | 112 using extensions::PermissionMessageIDs; |
| 113 using extensions::PermissionSet; | 113 using extensions::PermissionSet; |
| 114 using extensions::SharedModuleInfo; | 114 using extensions::SharedModuleInfo; |
| 115 using extensions::SharedModuleService; | 115 using extensions::SharedModuleService; |
| 116 using extensions::UnloadedExtensionInfo; | 116 using extensions::UnloadedExtensionInfo; |
| 117 | 117 |
| 118 namespace { | 118 namespace { |
| 119 | 119 |
| 120 // Wait this many seconds after an extensions becomes idle before updating it. | 120 // Wait this many seconds after an extensions becomes idle before updating it. |
| 121 const int kUpdateIdleDelay = 5; | 121 const int kUpdateIdleDelay = 5; |
| 122 | 122 |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 const Extension* extension, const char* histogram) { | 1010 const Extension* extension, const char* histogram) { |
| 1011 // Since this is called from multiple sources, and since the histogram macros | 1011 // Since this is called from multiple sources, and since the histogram macros |
| 1012 // use statics, we need to manually lookup the histogram ourselves. | 1012 // use statics, we need to manually lookup the histogram ourselves. |
| 1013 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( | 1013 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( |
| 1014 histogram, | 1014 histogram, |
| 1015 1, | 1015 1, |
| 1016 PermissionMessage::kEnumBoundary, | 1016 PermissionMessage::kEnumBoundary, |
| 1017 PermissionMessage::kEnumBoundary + 1, | 1017 PermissionMessage::kEnumBoundary + 1, |
| 1018 base::HistogramBase::kUmaTargetedHistogramFlag); | 1018 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 1019 | 1019 |
| 1020 PermissionMessages permissions = | 1020 PermissionMessageIDs permissions = |
| 1021 extension->permissions_data()->GetPermissionMessages(); | 1021 extension->permissions_data()->GetLegacyPermissionMessageIDs(); |
| 1022 if (permissions.empty()) { | 1022 if (permissions.empty()) { |
| 1023 counter->Add(PermissionMessage::kNone); | 1023 counter->Add(PermissionMessage::kNone); |
| 1024 } else { | 1024 } else { |
| 1025 for (PermissionMessages::iterator it = permissions.begin(); | 1025 for (PermissionMessage::ID id : permissions) |
| 1026 it != permissions.end(); ++it) | 1026 counter->Add(id); |
| 1027 counter->Add(it->id()); | |
| 1028 } | 1027 } |
| 1029 } | 1028 } |
| 1030 | 1029 |
| 1031 void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { | 1030 void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { |
| 1032 // The URLRequestContexts need to be first to know that the extension | 1031 // The URLRequestContexts need to be first to know that the extension |
| 1033 // was loaded, otherwise a race can arise where a renderer that is created | 1032 // was loaded, otherwise a race can arise where a renderer that is created |
| 1034 // for the extension may try to load an extension URL with an extension id | 1033 // for the extension may try to load an extension URL with an extension id |
| 1035 // that the request context doesn't yet know about. The profile is responsible | 1034 // that the request context doesn't yet know about. The profile is responsible |
| 1036 // for ensuring its URLRequestContexts appropriately discover the loaded | 1035 // for ensuring its URLRequestContexts appropriately discover the loaded |
| 1037 // extension. | 1036 // extension. |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2582 } | 2581 } |
| 2583 | 2582 |
| 2584 void ExtensionService::OnProfileDestructionStarted() { | 2583 void ExtensionService::OnProfileDestructionStarted() { |
| 2585 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2584 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2586 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2585 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2587 it != ids_to_unload.end(); | 2586 it != ids_to_unload.end(); |
| 2588 ++it) { | 2587 ++it) { |
| 2589 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2588 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2590 } | 2589 } |
| 2591 } | 2590 } |
| OLD | NEW |