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

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

Issue 456063002: ExtensionUpdater: Abstract ExtensionDownloader creation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments and some cleanup 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 47c02bd7324e05c6320a02f94d746590d25aba69..58463804bf8bb59cd53896c90f08f51b61e769b3 100644
--- a/chrome/browser/extensions/updater/extension_downloader.cc
+++ b/chrome/browser/extensions/updater/extension_downloader.cc
@@ -176,8 +176,7 @@ ExtensionDownloader::ExtensionFetch::~ExtensionFetch() {}
ExtensionDownloader::ExtensionDownloader(
ExtensionDownloaderDelegate* delegate,
- net::URLRequestContextGetter* request_context,
- IdentityProvider* webstore_identity_provider)
+ net::URLRequestContextGetter* request_context)
: OAuth2TokenService::Consumer(kTokenServiceConsumerId),
delegate_(delegate),
request_context_(request_context),
@@ -188,8 +187,7 @@ ExtensionDownloader::ExtensionDownloader(
extensions_queue_(&kDefaultBackoffPolicy,
base::Bind(&ExtensionDownloader::CreateExtensionFetcher,
base::Unretained(this))),
- extension_cache_(NULL),
- identity_provider_(webstore_identity_provider) {
+ extension_cache_(NULL) {
DCHECK(delegate_);
DCHECK(request_context_);
}
@@ -279,6 +277,11 @@ void ExtensionDownloader::StartBlacklistUpdate(
StartUpdateCheck(blacklist_fetch.Pass());
}
+void ExtensionDownloader::SetWebstoreIdentityProvider(
+ scoped_ptr<IdentityProvider> identity_provider) {
+ identity_provider_.swap(identity_provider);
+}
+
bool ExtensionDownloader::AddExtensionData(const std::string& id,
const Version& version,
Manifest::Type extension_type,
@@ -746,7 +749,7 @@ void ExtensionDownloader::CreateExtensionFetcher() {
// We should try OAuth2, but we have no token cached. This
// ExtensionFetcher will be started once the token fetch is complete,
// in either OnTokenFetchSuccess or OnTokenFetchFailure.
- DCHECK(identity_provider_);
+ DCHECK(identity_provider_.get());
OAuth2TokenService::ScopeSet webstore_scopes;
webstore_scopes.insert(kWebstoreOAuth2Scope);
access_token_request_ =
@@ -871,7 +874,7 @@ bool ExtensionDownloader::IterateFetchCredentialsAfterFailure(
// should invalidate the token and try again.
if (response_code == net::HTTP_UNAUTHORIZED &&
fetch->oauth2_attempt_count <= kMaxOAuth2Attempts) {
- DCHECK(identity_provider_ != NULL);
+ DCHECK(identity_provider_.get());
OAuth2TokenService::ScopeSet webstore_scopes;
webstore_scopes.insert(kWebstoreOAuth2Scope);
identity_provider_->GetTokenService()->InvalidateToken(
« no previous file with comments | « chrome/browser/extensions/updater/extension_downloader.h ('k') | chrome/browser/extensions/updater/extension_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698