summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_updater.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 07:30:46 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 07:30:46 +0000
commit47bc47f6add650795e70d7c21b9c2555c7de5f72 (patch)
treedb4fc6c6f48795966a912d160a4c7388b4e3eacc /chrome/browser/extensions/extension_updater.cc
parent052c92700b2c71e60ab89e765467b9b0926d0f7c (diff)
downloadchromium_src-47bc47f6add650795e70d7c21b9c2555c7de5f72.zip
chromium_src-47bc47f6add650795e70d7c21b9c2555c7de5f72.tar.gz
chromium_src-47bc47f6add650795e70d7c21b9c2555c7de5f72.tar.bz2
Revert r50804 "Reworked ExtensionsService::AddPendingExtension()."
Reverted r50804 as it seems to be related to memory error. Review URL: http://codereview.chromium.org/2833033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_updater.cc')
-rw-r--r--chrome/browser/extensions/extension_updater.cc41
1 files changed, 19 insertions, 22 deletions
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index 95177c6..9c428e3 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -169,12 +169,7 @@ void ManifestFetchesBuilder::AddExtension(const Extension& extension) {
void ManifestFetchesBuilder::AddPendingExtension(
const std::string& id,
const PendingExtensionInfo& info) {
- // Use a zero version to ensure that a pending extension will always
- // be updated, and thus installed (assuming all extensions have
- // non-zero versions).
- scoped_ptr<Version> version(
- Version::GetVersionFromString("0.0.0.0"));
- AddExtensionData(Extension::INTERNAL, id, *version,
+ AddExtensionData(Extension::INTERNAL, id, info.version,
false, info.is_theme, info.update_url);
}
@@ -721,6 +716,12 @@ bool ExtensionUpdater::GetExistingVersion(const std::string& id,
WideToASCII(prefs_->GetString(kExtensionBlacklistUpdateVersion));
return true;
}
+ PendingExtensionMap::const_iterator it =
+ service_->pending_extensions().find(id);
+ if (it != service_->pending_extensions().end()) {
+ *version = it->second.version.GetString();
+ return true;
+ }
Extension* extension = service_->GetExtensionById(id, false);
if (!extension) {
return false;
@@ -744,24 +745,20 @@ std::vector<int> ExtensionUpdater::DetermineUpdates(
if (!fetch_data.Includes(update->extension_id))
continue;
- if (service_->pending_extensions().find(update->extension_id) ==
- service_->pending_extensions().end()) {
- // If we're not installing pending extension, and the update
- // version is the same or older than what's already installed,
- // we don't want it.
- std::string version;
- if (!GetExistingVersion(update->extension_id, &version))
- continue;
+ std::string version;
+ if (!GetExistingVersion(update->extension_id, &version))
+ continue;
- scoped_ptr<Version> existing_version(
- Version::GetVersionFromString(version));
- scoped_ptr<Version> update_version(
- Version::GetVersionFromString(update->version));
+ // If the update version is the same or older than what's already installed,
+ // we don't want it.
+ scoped_ptr<Version> existing_version(
+ Version::GetVersionFromString(version));
+ scoped_ptr<Version> update_version(
+ Version::GetVersionFromString(update->version));
- if (!update_version.get() ||
- update_version->CompareTo(*(existing_version.get())) <= 0) {
- continue;
- }
+ if (!update_version.get() ||
+ update_version->CompareTo(*(existing_version.get())) <= 0) {
+ continue;
}
// If the update specifies a browser minimum version, do we qualify?