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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded( | 1556 ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded( |
1557 *extension); | 1557 *extension); |
1558 NotifyExtensionLoaded(extension); | 1558 NotifyExtensionLoaded(extension); |
1559 } | 1559 } |
1560 system_->runtime_data()->SetBeingUpgraded(extension->id(), false); | 1560 system_->runtime_data()->SetBeingUpgraded(extension->id(), false); |
1561 } | 1561 } |
1562 | 1562 |
1563 void ExtensionService::AddComponentExtension(const Extension* extension) { | 1563 void ExtensionService::AddComponentExtension(const Extension* extension) { |
1564 const std::string old_version_string( | 1564 const std::string old_version_string( |
1565 extension_prefs_->GetVersionString(extension->id())); | 1565 extension_prefs_->GetVersionString(extension->id())); |
1566 const Version old_version(old_version_string); | 1566 const base::Version old_version(old_version_string); |
1567 | 1567 |
1568 VLOG(1) << "AddComponentExtension " << extension->name(); | 1568 VLOG(1) << "AddComponentExtension " << extension->name(); |
1569 if (!old_version.IsValid() || !old_version.Equals(*extension->version())) { | 1569 if (!old_version.IsValid() || !old_version.Equals(*extension->version())) { |
1570 VLOG(1) << "Component extension " << extension->name() << " (" | 1570 VLOG(1) << "Component extension " << extension->name() << " (" |
1571 << extension->id() << ") installing/upgrading from '" | 1571 << extension->id() << ") installing/upgrading from '" |
1572 << old_version_string << "' to " << extension->version()->GetString(); | 1572 << old_version_string << "' to " << extension->version()->GetString(); |
1573 | 1573 |
1574 AddNewOrUpdatedExtension(extension, | 1574 AddNewOrUpdatedExtension(extension, |
1575 Extension::ENABLED, | 1575 Extension::ENABLED, |
1576 extensions::kInstallFlagNone, | 1576 extensions::kInstallFlagNone, |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 content::Details<const Extension>(extension)); | 2127 content::Details<const Extension>(extension)); |
2128 } | 2128 } |
2129 } | 2129 } |
2130 | 2130 |
2131 const Extension* ExtensionService::GetInstalledExtension( | 2131 const Extension* ExtensionService::GetInstalledExtension( |
2132 const std::string& id) const { | 2132 const std::string& id) const { |
2133 return registry_->GetExtensionById(id, ExtensionRegistry::EVERYTHING); | 2133 return registry_->GetExtensionById(id, ExtensionRegistry::EVERYTHING); |
2134 } | 2134 } |
2135 | 2135 |
2136 bool ExtensionService::OnExternalExtensionFileFound( | 2136 bool ExtensionService::OnExternalExtensionFileFound( |
2137 const std::string& id, | 2137 const std::string& id, |
2138 const Version* version, | 2138 const base::Version* version, |
2139 const base::FilePath& path, | 2139 const base::FilePath& path, |
2140 Manifest::Location location, | 2140 Manifest::Location location, |
2141 int creation_flags, | 2141 int creation_flags, |
2142 bool mark_acknowledged, | 2142 bool mark_acknowledged, |
2143 bool install_immediately) { | 2143 bool install_immediately) { |
2144 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2144 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2145 CHECK(crx_file::id_util::IdIsValid(id)); | 2145 CHECK(crx_file::id_util::IdIsValid(id)); |
2146 if (extension_prefs_->IsExternalExtensionUninstalled(id)) | 2146 if (extension_prefs_->IsExternalExtensionUninstalled(id)) |
2147 return false; | 2147 return false; |
2148 | 2148 |
2149 // Before even bothering to unpack, check and see if we already have this | 2149 // Before even bothering to unpack, check and see if we already have this |
2150 // version. This is important because these extensions are going to get | 2150 // version. This is important because these extensions are going to get |
2151 // installed on every startup. | 2151 // installed on every startup. |
2152 const Extension* existing = GetExtensionById(id, true); | 2152 const Extension* existing = GetExtensionById(id, true); |
2153 | 2153 |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 } | 2586 } |
2587 | 2587 |
2588 void ExtensionService::OnProfileDestructionStarted() { | 2588 void ExtensionService::OnProfileDestructionStarted() { |
2589 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2589 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2590 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2590 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2591 it != ids_to_unload.end(); | 2591 it != ids_to_unload.end(); |
2592 ++it) { | 2592 ++it) { |
2593 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2593 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2594 } | 2594 } |
2595 } | 2595 } |
OLD | NEW |