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

Unified Diff: chrome/browser/extensions/api/identity/identity_api.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/extensions/api/identity/identity_api.cc
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index c7707b4698757f4c084846baa308d2d4cd405fd3..73e3c9ee83952ee3c69ea0330a0cfb55c79be31b 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -219,9 +219,12 @@ void IdentityGetAuthTokenFunction::StartMintToken(
IsEnterpriseManaged()) {
OAuth2TokenService::ScopeSet scope_set(oauth2_info.scopes.begin(),
oauth2_info.scopes.end());
+ chromeos::DeviceOAuth2TokenService* token_service =
+ chromeos::DeviceOAuth2TokenServiceFactory::Get();
device_token_request_ =
- chromeos::DeviceOAuth2TokenServiceFactory::Get()->StartRequest(
- scope_set, this);
+ token_service->StartRequest(token_service->GetRobotAccountId(),
+ scope_set,
+ this);
} else {
gaia_mint_token_mode_ = OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE;
StartLoginAccessTokenRequest();
@@ -424,7 +427,8 @@ void IdentityGetAuthTokenFunction::StartLoginAccessTokenRequest() {
if (chromeos::UserManager::Get()->GetAppModeChromeClientOAuthInfo(
&app_client_id, &app_client_secret)) {
login_token_request_ =
- service->StartRequestForClient(app_client_id,
+ service->StartRequestForClient(service->GetPrimaryAccountId(),
+ app_client_id,
app_client_secret,
OAuth2TokenService::ScopeSet(),
this);
@@ -432,8 +436,8 @@ void IdentityGetAuthTokenFunction::StartLoginAccessTokenRequest() {
}
}
#endif
- login_token_request_ = service->StartRequest(OAuth2TokenService::ScopeSet(),
- this);
+ login_token_request_ = service->StartRequest(
+ service->GetPrimaryAccountId(), OAuth2TokenService::ScopeSet(), this);
}
void IdentityGetAuthTokenFunction::StartGaiaRequest(
@@ -477,8 +481,10 @@ OAuth2MintTokenFlow* IdentityGetAuthTokenFunction::CreateMintTokenFlow(
}
bool IdentityGetAuthTokenFunction::HasLoginToken() const {
- return ProfileOAuth2TokenServiceFactory::GetForProfile(profile())->
- RefreshTokenIsAvailable();
+ ProfileOAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ return token_service->RefreshTokenIsAvailable(
+ token_service->GetPrimaryAccountId());
}
std::string IdentityGetAuthTokenFunction::MapOAuth2ErrorToDescription(

Powered by Google App Engine
This is Rietveld 408576698