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