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

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

Issue 465543004: Factor Chrome details out of update manifest fetching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
Index: chrome/browser/extensions/updater/extension_downloader.cc
diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc
index 58463804bf8bb59cd53896c90f08f51b61e769b3..aaf2b53052a67f93aa0546758eb7f6e9f55535fa 100644
--- a/chrome/browser/extensions/updater/extension_downloader.cc
+++ b/chrome/browser/extensions/updater/extension_downloader.cc
@@ -31,6 +31,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
+#include "extensions/browser/updater/default_manifest_fetch_data_delegate.h"
#include "google_apis/gaia/identity_provider.h"
#include "net/base/backoff_entry.h"
#include "net/base/load_flags.h"
@@ -187,7 +188,8 @@ ExtensionDownloader::ExtensionDownloader(
extensions_queue_(&kDefaultBackoffPolicy,
base::Bind(&ExtensionDownloader::CreateExtensionFetcher,
base::Unretained(this))),
- extension_cache_(NULL) {
+ extension_cache_(NULL),
+ manifest_fetch_data_delegate_(new DefaultManifestFetchDataDelegate()) {
DCHECK(delegate_);
DCHECK(request_context_);
}
@@ -267,7 +269,8 @@ void ExtensionDownloader::StartBlacklistUpdate(
// by a public key signature like .crx files are.
scoped_ptr<ManifestFetchData> blacklist_fetch(
new ManifestFetchData(extension_urls::GetWebstoreUpdateUrl(),
- request_id));
+ request_id,
+ manifest_fetch_data_delegate_.get()));
DCHECK(blacklist_fetch->base_url().SchemeIsSecure());
blacklist_fetch->AddExtension(kBlacklistAppID,
version,
@@ -282,6 +285,11 @@ void ExtensionDownloader::SetWebstoreIdentityProvider(
identity_provider_.swap(identity_provider);
}
+void ExtensionDownloader::SetManifestFetchDataDelegate(
+ scoped_ptr<ManifestFetchDataDelegate> delegate) {
+ manifest_fetch_data_delegate_.swap(delegate);
+}
+
bool ExtensionDownloader::AddExtensionData(const std::string& id,
const Version& version,
Manifest::Type extension_type,
@@ -343,7 +351,7 @@ bool ExtensionDownloader::AddExtensionData(const std::string& id,
// If UMA is enabled, also add to ManifestFetchData for the
// webstore update URL.
if (!extension_urls::IsWebstoreUpdateUrl(update_url) &&
- ChromeMetricsServiceAccessor::IsMetricsReportingEnabled()) {
+ manifest_fetch_data_delegate_->ShouldAlwaysCheckWebstore()) {
update_urls.push_back(extension_urls::GetWebstoreUpdateUrl());
}
@@ -376,8 +384,8 @@ bool ExtensionDownloader::AddExtensionData(const std::string& id,
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(
- new ManifestFetchData(update_urls[i], request_id));
+ linked_ptr<ManifestFetchData> fetch(new ManifestFetchData(
+ update_urls[i], request_id, manifest_fetch_data_delegate_.get()));
fetches_preparing_[std::make_pair(request_id, update_urls[i])].
push_back(fetch);
added = fetch->AddExtension(id, version.GetString(),

Powered by Google App Engine
This is Rietveld 408576698