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

Unified Diff: chrome/browser/managed_mode/managed_user_refresh_token_fetcher.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to include the update to ProfileSyncService: r224220 Created 7 years, 3 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/managed_mode/managed_user_refresh_token_fetcher.cc
diff --git a/chrome/browser/managed_mode/managed_user_refresh_token_fetcher.cc b/chrome/browser/managed_mode/managed_user_refresh_token_fetcher.cc
index 1d9e410c7078f701956de794e2f64475fffe4afb..aade31388e161897b8ccbfcce131bdf88d34edc3 100644
--- a/chrome/browser/managed_mode/managed_user_refresh_token_fetcher.cc
+++ b/chrome/browser/managed_mode/managed_user_refresh_token_fetcher.cc
@@ -52,7 +52,8 @@ class ManagedUserRefreshTokenFetcherImpl
public GaiaOAuthClient::Delegate {
public:
ManagedUserRefreshTokenFetcherImpl(OAuth2TokenService* oauth2_token_service,
- URLRequestContextGetter* context);
+ const std::string& account_id,
+ URLRequestContextGetter* context);
virtual ~ManagedUserRefreshTokenFetcherImpl();
// ManagedUserRefreshTokenFetcher implementation:
@@ -89,6 +90,7 @@ class ManagedUserRefreshTokenFetcherImpl
void DispatchGoogleServiceAuthError(const GoogleServiceAuthError& error,
const std::string& token);
OAuth2TokenService* oauth2_token_service_;
+ std::string account_id_;
URLRequestContextGetter* context_;
std::string device_name_;
@@ -104,8 +106,10 @@ class ManagedUserRefreshTokenFetcherImpl
ManagedUserRefreshTokenFetcherImpl::ManagedUserRefreshTokenFetcherImpl(
OAuth2TokenService* oauth2_token_service,
+ const std::string& account_id,
URLRequestContextGetter* context)
: oauth2_token_service_(oauth2_token_service),
+ account_id_(account_id),
context_(context),
access_token_expired_(false) {}
@@ -125,7 +129,8 @@ void ManagedUserRefreshTokenFetcherImpl::Start(
void ManagedUserRefreshTokenFetcherImpl::StartFetching() {
OAuth2TokenService::ScopeSet scopes;
scopes.insert(GaiaUrls::GetInstance()->oauth1_login_scope());
- access_token_request_ = oauth2_token_service_->StartRequest(scopes, this);
+ access_token_request_ = oauth2_token_service_->StartRequest(
+ account_id_, scopes, this);
}
void ManagedUserRefreshTokenFetcherImpl::OnGetTokenSuccess(
@@ -180,7 +185,8 @@ void ManagedUserRefreshTokenFetcherImpl::OnURLFetchComplete(
int response_code = source->GetResponseCode();
if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) {
access_token_expired_ = true;
- oauth2_token_service_->InvalidateToken(OAuth2TokenService::ScopeSet(),
+ oauth2_token_service_->InvalidateToken(account_id_,
+ OAuth2TokenService::ScopeSet(),
access_token_);
StartFetching();
return;
@@ -265,9 +271,11 @@ void ManagedUserRefreshTokenFetcherImpl::DispatchGoogleServiceAuthError(
// static
scoped_ptr<ManagedUserRefreshTokenFetcher>
ManagedUserRefreshTokenFetcher::Create(OAuth2TokenService* oauth2_token_service,
+ const std::string& account_id,
URLRequestContextGetter* context) {
scoped_ptr<ManagedUserRefreshTokenFetcher> fetcher(
- new ManagedUserRefreshTokenFetcherImpl(oauth2_token_service, context));
+ new ManagedUserRefreshTokenFetcherImpl(oauth2_token_service, account_id,
+ context));
return fetcher.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698