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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 if (app_sync_bundle_.HasExtensionId(extension_id) && | 828 if (app_sync_bundle_.HasExtensionId(extension_id) && |
829 sync_change.sync_data().GetDataType() == syncer::APPS) { | 829 sync_change.sync_data().GetDataType() == syncer::APPS) { |
830 app_sync_bundle_.ProcessDeletion(extension_id, sync_change); | 830 app_sync_bundle_.ProcessDeletion(extension_id, sync_change); |
831 } else if (extension_sync_bundle_.HasExtensionId(extension_id) && | 831 } else if (extension_sync_bundle_.HasExtensionId(extension_id) && |
832 sync_change.sync_data().GetDataType() == syncer::EXTENSIONS) { | 832 sync_change.sync_data().GetDataType() == syncer::EXTENSIONS) { |
833 extension_sync_bundle_.ProcessDeletion(extension_id, sync_change); | 833 extension_sync_bundle_.ProcessDeletion(extension_id, sync_change); |
834 } | 834 } |
835 | 835 |
836 delayed_installs_.Remove(extension_id); | 836 delayed_installs_.Remove(extension_id); |
837 | 837 |
838 PruneSharedModulesOnUninstall(extension); | 838 PruneSharedModulesOnUninstall(extension.get()); |
839 | 839 |
840 // Track the uninstallation. | 840 // Track the uninstallation. |
841 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionUninstalled", 1, 2); | 841 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionUninstalled", 1, 2); |
842 | 842 |
843 return true; | 843 return true; |
844 } | 844 } |
845 | 845 |
846 bool ExtensionService::IsExtensionEnabled( | 846 bool ExtensionService::IsExtensionEnabled( |
847 const std::string& extension_id) const { | 847 const std::string& extension_id) const { |
848 if (extensions_.Contains(extension_id) || | 848 if (extensions_.Contains(extension_id) || |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 SyncExtensionChangeIfNeeded(*extension); | 952 SyncExtensionChangeIfNeeded(*extension); |
953 } | 953 } |
954 | 954 |
955 void ExtensionService::DisableUserExtensions() { | 955 void ExtensionService::DisableUserExtensions() { |
956 extensions::ManagementPolicy* management_policy = | 956 extensions::ManagementPolicy* management_policy = |
957 system_->management_policy(); | 957 system_->management_policy(); |
958 extensions::ExtensionList to_disable; | 958 extensions::ExtensionList to_disable; |
959 | 959 |
960 for (ExtensionSet::const_iterator extension = extensions_.begin(); | 960 for (ExtensionSet::const_iterator extension = extensions_.begin(); |
961 extension != extensions_.end(); ++extension) { | 961 extension != extensions_.end(); ++extension) { |
962 if (management_policy->UserMayModifySettings(*extension, NULL)) | 962 if (management_policy->UserMayModifySettings(extension->get(), NULL)) |
963 to_disable.push_back(*extension); | 963 to_disable.push_back(*extension); |
964 } | 964 } |
965 for (ExtensionSet::const_iterator extension = terminated_extensions_.begin(); | 965 for (ExtensionSet::const_iterator extension = terminated_extensions_.begin(); |
966 extension != terminated_extensions_.end(); ++extension) { | 966 extension != terminated_extensions_.end(); ++extension) { |
967 if (management_policy->UserMayModifySettings(*extension, NULL)) | 967 if (management_policy->UserMayModifySettings(extension->get(), NULL)) |
968 to_disable.push_back(*extension); | 968 to_disable.push_back(*extension); |
969 } | 969 } |
970 | 970 |
971 for (extensions::ExtensionList::const_iterator extension = to_disable.begin(); | 971 for (extensions::ExtensionList::const_iterator extension = to_disable.begin(); |
972 extension != to_disable.end(); ++extension) { | 972 extension != to_disable.end(); ++extension) { |
973 DisableExtension((*extension)->id(), | 973 DisableExtension((*extension)->id(), |
974 extensions::Extension::DISABLE_USER_ACTION); | 974 extensions::Extension::DISABLE_USER_ACTION); |
975 } | 975 } |
976 } | 976 } |
977 | 977 |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 scoped_ptr<const ExtensionSet> | 2254 scoped_ptr<const ExtensionSet> |
2255 ExtensionService::GetDependentExtensions(const Extension* extension) { | 2255 ExtensionService::GetDependentExtensions(const Extension* extension) { |
2256 scoped_ptr<ExtensionSet> dependents(new ExtensionSet()); | 2256 scoped_ptr<ExtensionSet> dependents(new ExtensionSet()); |
2257 scoped_ptr<ExtensionSet> set_to_check(new ExtensionSet()); | 2257 scoped_ptr<ExtensionSet> set_to_check(new ExtensionSet()); |
2258 if (SharedModuleInfo::IsSharedModule(extension)) { | 2258 if (SharedModuleInfo::IsSharedModule(extension)) { |
2259 set_to_check->InsertAll(disabled_extensions_); | 2259 set_to_check->InsertAll(disabled_extensions_); |
2260 set_to_check->InsertAll(delayed_installs_); | 2260 set_to_check->InsertAll(delayed_installs_); |
2261 set_to_check->InsertAll(extensions_); | 2261 set_to_check->InsertAll(extensions_); |
2262 for (ExtensionSet::const_iterator iter = set_to_check->begin(); | 2262 for (ExtensionSet::const_iterator iter = set_to_check->begin(); |
2263 iter != set_to_check->end(); ++iter) { | 2263 iter != set_to_check->end(); ++iter) { |
2264 if (SharedModuleInfo::ImportsExtensionById(*iter, extension->id())) { | 2264 if (SharedModuleInfo::ImportsExtensionById(iter->get(), |
| 2265 extension->id())) { |
2265 dependents->Insert(*iter); | 2266 dependents->Insert(*iter); |
2266 } | 2267 } |
2267 } | 2268 } |
2268 } | 2269 } |
2269 return dependents.PassAs<const ExtensionSet>(); | 2270 return dependents.PassAs<const ExtensionSet>(); |
2270 } | 2271 } |
2271 | 2272 |
2272 void ExtensionService::PruneSharedModulesOnUninstall( | 2273 void ExtensionService::PruneSharedModulesOnUninstall( |
2273 const Extension* extension) { | 2274 const Extension* extension) { |
2274 if (SharedModuleInfo::ImportsModules(extension)) { | 2275 if (SharedModuleInfo::ImportsModules(extension)) { |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 } | 3036 } |
3036 | 3037 |
3037 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3038 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3038 update_observers_.AddObserver(observer); | 3039 update_observers_.AddObserver(observer); |
3039 } | 3040 } |
3040 | 3041 |
3041 void ExtensionService::RemoveUpdateObserver( | 3042 void ExtensionService::RemoveUpdateObserver( |
3042 extensions::UpdateObserver* observer) { | 3043 extensions::UpdateObserver* observer) { |
3043 update_observers_.RemoveObserver(observer); | 3044 update_observers_.RemoveObserver(observer); |
3044 } | 3045 } |
OLD | NEW |