summaryrefslogtreecommitdiffstats
path: root/extensions/browser/updater
diff options
context:
space:
mode:
authorelijahtaylor <elijahtaylor@chromium.org>2015-10-05 13:11:53 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-05 20:12:30 +0000
commit9964c838ba172bbbdbc0d8248d3c37cf0141be08 (patch)
treeda08e2d5f318d467aec86f9c82dc3c84276c8ba7 /extensions/browser/updater
parente155a0cc870f5346ae4475c96a804811b846e6bb (diff)
downloadchromium_src-9964c838ba172bbbdbc0d8248d3c37cf0141be08.zip
chromium_src-9964c838ba172bbbdbc0d8248d3c37cf0141be08.tar.gz
chromium_src-9964c838ba172bbbdbc0d8248d3c37cf0141be08.tar.bz2
Remove multi-crx force download code
This was added in M38 for the Mac 32- to 64-bit switch to make sure that NaCl extensions would get re-downloaded if the architecture changed. Original add: https://codereview.chromium.org/540673002 Some cleanup: https://codereview.chromium.org/596193002 Unfortunately this code has never been 100% robust, and is not correct for packages lacking "nacl_arch" keys. To be completely correct it needs to duplicate logic from Chrome Web Store and other parts of Chrome. BUG=531812 Review URL: https://codereview.chromium.org/1386783005 Cr-Commit-Position: refs/heads/master@{#352397}
Diffstat (limited to 'extensions/browser/updater')
-rw-r--r--extensions/browser/updater/extension_downloader.cc80
-rw-r--r--extensions/browser/updater/extension_downloader.h4
-rw-r--r--extensions/browser/updater/extension_downloader_delegate.cc5
-rw-r--r--extensions/browser/updater/extension_downloader_delegate.h6
-rw-r--r--extensions/browser/updater/manifest_fetch_data.cc16
-rw-r--r--extensions/browser/updater/manifest_fetch_data.h9
6 files changed, 27 insertions, 93 deletions
diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc
index d1d6468..4e243b0 100644
--- a/extensions/browser/updater/extension_downloader.cc
+++ b/extensions/browser/updater/extension_downloader.cc
@@ -213,17 +213,9 @@ bool ExtensionDownloader::AddExtension(const Extension& extension,
if (!ManifestURL::UpdatesFromGallery(&extension))
update_url_data = delegate_->GetUpdateUrlData(extension.id());
- std::string install_source;
- bool force_update =
- delegate_->ShouldForceUpdate(extension.id(), &install_source);
- return AddExtensionData(extension.id(),
- *extension.version(),
- extension.GetType(),
- ManifestURL::GetUpdateURL(&extension),
- update_url_data,
- request_id,
- force_update,
- install_source);
+ return AddExtensionData(
+ extension.id(), *extension.version(), extension.GetType(),
+ ManifestURL::GetUpdateURL(&extension), update_url_data, request_id);
}
bool ExtensionDownloader::AddPendingExtension(const std::string& id,
@@ -235,14 +227,8 @@ bool ExtensionDownloader::AddPendingExtension(const std::string& id,
Version version("0.0.0.0");
DCHECK(version.IsValid());
- return AddExtensionData(id,
- version,
- Manifest::TYPE_UNKNOWN,
- update_url,
- std::string(),
- request_id,
- false,
- std::string());
+ return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url,
+ std::string(), request_id);
}
void ExtensionDownloader::StartAllPending(ExtensionCache* cache) {
@@ -280,12 +266,8 @@ void ExtensionDownloader::StartBlacklistUpdate(
scoped_ptr<ManifestFetchData> blacklist_fetch(CreateManifestFetchData(
extension_urls::GetWebstoreUpdateUrl(), request_id));
DCHECK(blacklist_fetch->base_url().SchemeIsCryptographic());
- blacklist_fetch->AddExtension(kBlacklistAppID,
- version,
- &ping_data,
- std::string(),
- kDefaultInstallSource,
- false);
+ blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data,
+ std::string(), kDefaultInstallSource);
StartUpdateCheck(blacklist_fetch.Pass());
}
@@ -294,15 +276,12 @@ void ExtensionDownloader::SetWebstoreIdentityProvider(
identity_provider_.swap(identity_provider);
}
-bool ExtensionDownloader::AddExtensionData(
- const std::string& id,
- const Version& version,
- Manifest::Type extension_type,
- const GURL& extension_update_url,
- const std::string& update_url_data,
- int request_id,
- bool force_update,
- const std::string& install_source_override) {
+bool ExtensionDownloader::AddExtensionData(const std::string& id,
+ const Version& version,
+ Manifest::Type extension_type,
+ const GURL& extension_update_url,
+ const std::string& update_url_data,
+ int request_id) {
GURL update_url(extension_update_url);
// Skip extensions with non-empty invalid update URLs.
if (!update_url.is_empty() && !update_url.is_valid()) {
@@ -368,9 +347,6 @@ bool ExtensionDownloader::AddExtensionData(
std::string install_source =
i == 0 ? kDefaultInstallSource : kNotFromWebstoreInstallSource;
- if (!install_source_override.empty()) {
- install_source = install_source_override;
- }
ManifestFetchData::PingData ping_data;
ManifestFetchData::PingData* optional_ping_data = NULL;
@@ -385,12 +361,9 @@ bool ExtensionDownloader::AddExtensionData(
!existing_iter->second.empty()) {
// Try to add to the ManifestFetchData at the end of the list.
ManifestFetchData* existing_fetch = existing_iter->second.back().get();
- if (existing_fetch->AddExtension(id,
- version.GetString(),
- optional_ping_data,
- update_url_data,
- install_source,
- force_update)) {
+ if (existing_fetch->AddExtension(id, version.GetString(),
+ optional_ping_data, update_url_data,
+ install_source)) {
added = true;
}
}
@@ -401,12 +374,8 @@ bool ExtensionDownloader::AddExtensionData(
CreateManifestFetchData(update_urls[i], request_id));
fetches_preparing_[std::make_pair(request_id, update_urls[i])].push_back(
fetch);
- added = fetch->AddExtension(id,
- version.GetString(),
- optional_ping_data,
- update_url_data,
- install_source,
- force_update);
+ added = fetch->AddExtension(id, version.GetString(), optional_ping_data,
+ update_url_data, install_source);
DCHECK(added);
}
}
@@ -659,14 +628,11 @@ void ExtensionDownloader::DetermineUpdates(
VLOG(2) << id << " is at '" << version << "'";
- // We should skip the version check if update was forced.
- if (!fetch_data.DidForceUpdate(id)) {
- Version existing_version(version);
- Version update_version(update->version);
- if (!update_version.IsValid() ||
- update_version.CompareTo(existing_version) <= 0) {
- continue;
- }
+ Version existing_version(version);
+ Version update_version(update->version);
+ if (!update_version.IsValid() ||
+ update_version.CompareTo(existing_version) <= 0) {
+ continue;
}
}
diff --git a/extensions/browser/updater/extension_downloader.h b/extensions/browser/updater/extension_downloader.h
index 9c321b5..a5685c5 100644
--- a/extensions/browser/updater/extension_downloader.h
+++ b/extensions/browser/updater/extension_downloader.h
@@ -182,9 +182,7 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
Manifest::Type extension_type,
const GURL& extension_update_url,
const std::string& update_url_data,
- int request_id,
- bool force_update,
- const std::string& install_source_override);
+ int request_id);
// Adds all recorded stats taken so far to histogram counts.
void ReportStats() const;
diff --git a/extensions/browser/updater/extension_downloader_delegate.cc b/extensions/browser/updater/extension_downloader_delegate.cc
index a82f5ca..5ccf9c9 100644
--- a/extensions/browser/updater/extension_downloader_delegate.cc
+++ b/extensions/browser/updater/extension_downloader_delegate.cc
@@ -36,9 +36,4 @@ std::string ExtensionDownloaderDelegate::GetUpdateUrlData(
return std::string();
}
-bool ExtensionDownloaderDelegate::ShouldForceUpdate(const std::string& id,
- std::string* source) {
- return false;
-}
-
} // namespace extensions
diff --git a/extensions/browser/updater/extension_downloader_delegate.h b/extensions/browser/updater/extension_downloader_delegate.h
index a1076da..155e569 100644
--- a/extensions/browser/updater/extension_downloader_delegate.h
+++ b/extensions/browser/updater/extension_downloader_delegate.h
@@ -127,12 +127,6 @@ class ExtensionDownloaderDelegate {
// that extension is not installed.
virtual bool GetExtensionExistingVersion(const std::string& id,
std::string* version) = 0;
-
- // Determines if a given extension should be forced to update and (if so)
- // what the source of this forcing is (i.e. what string will be passed
- // in |installsource| as part of the update query parameters). The default
- // implementation always returns |false|.
- virtual bool ShouldForceUpdate(const std::string& id, std::string* source);
};
} // namespace extensions
diff --git a/extensions/browser/updater/manifest_fetch_data.cc b/extensions/browser/updater/manifest_fetch_data.cc
index f72f32e..5bec4f6 100644
--- a/extensions/browser/updater/manifest_fetch_data.cc
+++ b/extensions/browser/updater/manifest_fetch_data.cc
@@ -85,24 +85,16 @@ bool ManifestFetchData::AddExtension(const std::string& id,
const std::string& version,
const PingData* ping_data,
const std::string& update_url_data,
- const std::string& install_source,
- bool force_update) {
+ const std::string& install_source) {
if (extension_ids_.find(id) != extension_ids_.end()) {
NOTREACHED() << "Duplicate extension id " << id;
return false;
}
- if (force_update)
- forced_updates_.insert(id);
-
- // If we want to force an update, we send 0.0.0.0 as the installed version
- // number.
- const std::string installed_version = force_update ? "0.0.0.0" : version;
-
// Compute the string we'd append onto the full_url_, and see if it fits.
std::vector<std::string> parts;
parts.push_back("id=" + id);
- parts.push_back("v=" + installed_version);
+ parts.push_back("v=" + version);
if (!install_source.empty())
parts.push_back("installsource=" + install_source);
parts.push_back("uc");
@@ -184,8 +176,4 @@ void ManifestFetchData::Merge(const ManifestFetchData& other) {
request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end());
}
-bool ManifestFetchData::DidForceUpdate(const std::string& extension_id) const {
- return forced_updates_.find(extension_id) != forced_updates_.end();
-}
-
} // namespace extensions
diff --git a/extensions/browser/updater/manifest_fetch_data.h b/extensions/browser/updater/manifest_fetch_data.h
index 6ff3396..d55e2fd 100644
--- a/extensions/browser/updater/manifest_fetch_data.h
+++ b/extensions/browser/updater/manifest_fetch_data.h
@@ -84,8 +84,7 @@ class ManifestFetchData {
const std::string& version,
const PingData* ping_data,
const std::string& update_url_data,
- const std::string& install_source,
- bool force_update);
+ const std::string& install_source);
const GURL& base_url() const { return base_url_; }
const GURL& full_url() const { return full_url_; }
@@ -105,9 +104,6 @@ class ManifestFetchData {
// to this ManifestFetchData).
void Merge(const ManifestFetchData& other);
- // Returns |true| if a given extension was forced to update.
- bool DidForceUpdate(const std::string& extension_id) const;
-
private:
// The set of extension id's for this ManifestFetchData.
std::set<std::string> extension_ids_;
@@ -136,9 +132,6 @@ class ManifestFetchData {
// (and possibly extra metrics) will be included in the fetch query.
const PingMode ping_mode_;
- // The set of extension IDs for which this fetch forced a CRX update.
- std::set<std::string> forced_updates_;
-
DISALLOW_COPY_AND_ASSIGN(ManifestFetchData);
};