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 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 if (extension_sync_service_) | 1824 if (extension_sync_service_) |
1825 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension); | 1825 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension); |
1826 NotifyExtensionLoaded(extension); | 1826 NotifyExtensionLoaded(extension); |
1827 } | 1827 } |
1828 SetBeingUpgraded(extension, false); | 1828 SetBeingUpgraded(extension, false); |
1829 } | 1829 } |
1830 | 1830 |
1831 void ExtensionService::AddComponentExtension(const Extension* extension) { | 1831 void ExtensionService::AddComponentExtension(const Extension* extension) { |
1832 const std::string old_version_string( | 1832 const std::string old_version_string( |
1833 extension_prefs_->GetVersionString(extension->id())); | 1833 extension_prefs_->GetVersionString(extension->id())); |
1834 const Version old_version(old_version_string); | 1834 const base::Version old_version(old_version_string); |
1835 | 1835 |
1836 VLOG(1) << "AddComponentExtension " << extension->name(); | 1836 VLOG(1) << "AddComponentExtension " << extension->name(); |
1837 if (!old_version.IsValid() || !old_version.Equals(*extension->version())) { | 1837 if (!old_version.IsValid() || !old_version.Equals(*extension->version())) { |
1838 VLOG(1) << "Component extension " << extension->name() << " (" | 1838 VLOG(1) << "Component extension " << extension->name() << " (" |
1839 << extension->id() << ") installing/upgrading from '" | 1839 << extension->id() << ") installing/upgrading from '" |
1840 << old_version_string << "' to " << extension->version()->GetString(); | 1840 << old_version_string << "' to " << extension->version()->GetString(); |
1841 | 1841 |
1842 AddNewOrUpdatedExtension(extension, | 1842 AddNewOrUpdatedExtension(extension, |
1843 Extension::ENABLED_COMPONENT, | 1843 Extension::ENABLED_COMPONENT, |
1844 extensions::NOT_BLACKLISTED, | 1844 extensions::NOT_BLACKLISTED, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 std::list<SharedModuleInfo::ImportInfo>* outdated_modules) { | 2000 std::list<SharedModuleInfo::ImportInfo>* outdated_modules) { |
2001 DCHECK(extension); | 2001 DCHECK(extension); |
2002 DCHECK(missing_modules && missing_modules->empty()); | 2002 DCHECK(missing_modules && missing_modules->empty()); |
2003 DCHECK(outdated_modules && outdated_modules->empty()); | 2003 DCHECK(outdated_modules && outdated_modules->empty()); |
2004 ImportStatus status = IMPORT_STATUS_OK; | 2004 ImportStatus status = IMPORT_STATUS_OK; |
2005 if (SharedModuleInfo::ImportsModules(extension)) { | 2005 if (SharedModuleInfo::ImportsModules(extension)) { |
2006 const std::vector<SharedModuleInfo::ImportInfo>& imports = | 2006 const std::vector<SharedModuleInfo::ImportInfo>& imports = |
2007 SharedModuleInfo::GetImports(extension); | 2007 SharedModuleInfo::GetImports(extension); |
2008 std::vector<SharedModuleInfo::ImportInfo>::const_iterator i; | 2008 std::vector<SharedModuleInfo::ImportInfo>::const_iterator i; |
2009 for (i = imports.begin(); i != imports.end(); ++i) { | 2009 for (i = imports.begin(); i != imports.end(); ++i) { |
2010 Version version_required(i->minimum_version); | 2010 base::Version version_required(i->minimum_version); |
2011 const Extension* imported_module = | 2011 const Extension* imported_module = |
2012 GetExtensionById(i->extension_id, true); | 2012 GetExtensionById(i->extension_id, true); |
2013 if (!imported_module) { | 2013 if (!imported_module) { |
2014 if (extension->from_webstore()) { | 2014 if (extension->from_webstore()) { |
2015 status = IMPORT_STATUS_UNSATISFIED; | 2015 status = IMPORT_STATUS_UNSATISFIED; |
2016 missing_modules->push_back(*i); | 2016 missing_modules->push_back(*i); |
2017 } else { | 2017 } else { |
2018 return IMPORT_STATUS_UNRECOVERABLE; | 2018 return IMPORT_STATUS_UNRECOVERABLE; |
2019 } | 2019 } |
2020 } else if (!SharedModuleInfo::IsSharedModule(imported_module)) { | 2020 } else if (!SharedModuleInfo::IsSharedModule(imported_module)) { |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2397 if (extension && extension->is_platform_app()) { | 2397 if (extension && extension->is_platform_app()) { |
2398 *url = GURL(chrome::kExtensionInvalidRequestURL); | 2398 *url = GURL(chrome::kExtensionInvalidRequestURL); |
2399 return true; | 2399 return true; |
2400 } | 2400 } |
2401 | 2401 |
2402 return false; | 2402 return false; |
2403 } | 2403 } |
2404 | 2404 |
2405 bool ExtensionService::OnExternalExtensionFileFound( | 2405 bool ExtensionService::OnExternalExtensionFileFound( |
2406 const std::string& id, | 2406 const std::string& id, |
2407 const Version* version, | 2407 const base::Version* version, |
2408 const base::FilePath& path, | 2408 const base::FilePath& path, |
2409 Manifest::Location location, | 2409 Manifest::Location location, |
2410 int creation_flags, | 2410 int creation_flags, |
2411 bool mark_acknowledged) { | 2411 bool mark_acknowledged) { |
2412 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2412 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2413 CHECK(Extension::IdIsValid(id)); | 2413 CHECK(Extension::IdIsValid(id)); |
2414 if (extension_prefs_->IsExternalExtensionUninstalled(id)) | 2414 if (extension_prefs_->IsExternalExtensionUninstalled(id)) |
2415 return false; | 2415 return false; |
2416 | 2416 |
2417 // Before even bothering to unpack, check and see if we already have this | 2417 // Before even bothering to unpack, check and see if we already have this |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 void ExtensionService::UnloadAllExtensionsInternal() { | 2870 void ExtensionService::UnloadAllExtensionsInternal() { |
2871 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); | 2871 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); |
2872 | 2872 |
2873 registry_->ClearAll(); | 2873 registry_->ClearAll(); |
2874 extension_runtime_data_.clear(); | 2874 extension_runtime_data_.clear(); |
2875 | 2875 |
2876 // TODO(erikkay) should there be a notification for this? We can't use | 2876 // TODO(erikkay) should there be a notification for this? We can't use |
2877 // EXTENSION_UNLOADED since that implies that the extension has been disabled | 2877 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
2878 // or uninstalled. | 2878 // or uninstalled. |
2879 } | 2879 } |
OLD | NEW |