Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: extensions/browser/updater/extension_downloader.cc

Issue 1956893004: Don't send extension info for non-webstore extensions during update check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittests Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/updater/extension_downloader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/updater/extension_downloader.cc
diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc
index 0c95016c5e8837de70b9ea086fbef4aebd15629e..66cc2ee2ddf1c98674167407719c541f675e147b 100644
--- a/extensions/browser/updater/extension_downloader.cc
+++ b/extensions/browser/updater/extension_downloader.cc
@@ -193,7 +193,6 @@ ExtensionDownloader::ExtensionDownloader(
base::Bind(&ExtensionDownloader::CreateExtensionFetcher,
base::Unretained(this))),
extension_cache_(NULL),
- enable_extra_update_metrics_(false),
weak_ptr_factory_(this) {
DCHECK(delegate_);
DCHECK(request_context_.get());
@@ -343,53 +342,42 @@ bool ExtensionDownloader::AddExtensionData(const std::string& id,
break;
}
- std::vector<GURL> update_urls;
- update_urls.push_back(update_url);
- // If metrics are enabled, also add to ManifestFetchData for the
- // webstore update URL.
- if (!extension_urls::IsWebstoreUpdateUrl(update_url) &&
- enable_extra_update_metrics_) {
- update_urls.push_back(extension_urls::GetWebstoreUpdateUrl());
- }
-
- for (size_t i = 0; i < update_urls.size(); ++i) {
- DCHECK(!update_urls[i].is_empty());
- DCHECK(update_urls[i].is_valid());
-
- std::string install_source =
- i == 0 ? kDefaultInstallSource : kNotFromWebstoreInstallSource;
-
- ManifestFetchData::PingData ping_data;
- ManifestFetchData::PingData* optional_ping_data = NULL;
- if (delegate_->GetPingDataForExtension(id, &ping_data))
- optional_ping_data = &ping_data;
-
- // Find or create a ManifestFetchData to add this extension to.
- bool added = false;
- FetchMap::iterator existing_iter =
- fetches_preparing_.find(std::make_pair(request_id, update_urls[i]));
- if (existing_iter != fetches_preparing_.end() &&
- !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)) {
- added = true;
- }
- }
- if (!added) {
- // Otherwise add a new element to the list, if the list doesn't exist or
- // if its last element is already full.
- linked_ptr<ManifestFetchData> fetch(
- 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);
- DCHECK(added);
+ DCHECK(!update_url.is_empty());
+ DCHECK(update_url.is_valid());
+
+ std::string install_source = extension_urls::IsWebstoreUpdateUrl(update_url)
+ ? kDefaultInstallSource
+ : kNotFromWebstoreInstallSource;
+
+ ManifestFetchData::PingData ping_data;
+ ManifestFetchData::PingData* optional_ping_data = NULL;
+ if (delegate_->GetPingDataForExtension(id, &ping_data))
+ optional_ping_data = &ping_data;
+
+ // Find or create a ManifestFetchData to add this extension to.
+ bool added = false;
+ FetchMap::iterator existing_iter =
+ fetches_preparing_.find(std::make_pair(request_id, update_url));
+ if (existing_iter != fetches_preparing_.end() &&
+ !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)) {
+ added = true;
}
}
+ if (!added) {
+ // Otherwise add a new element to the list, if the list doesn't exist or
+ // if its last element is already full.
+ linked_ptr<ManifestFetchData> fetch(
+ CreateManifestFetchData(update_url, request_id));
+ fetches_preparing_[std::make_pair(request_id, update_url)].push_back(fetch);
+ added = fetch->AddExtension(id, version.GetString(), optional_ping_data,
+ update_url_data, install_source);
+ DCHECK(added);
+ }
return true;
}
« no previous file with comments | « extensions/browser/updater/extension_downloader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698