Chromium Code Reviews| Index: components/signin/core/browser/gaia_cookie_manager_service.cc |
| diff --git a/components/signin/core/browser/gaia_cookie_manager_service.cc b/components/signin/core/browser/gaia_cookie_manager_service.cc |
| index e8a0cb76802947ef5702a025e003df2f7c585d55..c0785fcad0c5bd4dee3e7d95edf86fee3f4a7e7b 100644 |
| --- a/components/signin/core/browser/gaia_cookie_manager_service.cc |
| +++ b/components/signin/core/browser/gaia_cookie_manager_service.cc |
| @@ -309,6 +309,11 @@ void GaiaCookieManagerService::Shutdown() { |
| void GaiaCookieManagerService::AddAccountToCookie( |
| const std::string& account_id) { |
| + AddAccountToCookieWithToken(account_id, std::string()); |
| +} |
| + |
| +void GaiaCookieManagerService::AddAccountToCookieWithToken( |
| + const std::string& account_id, const std::string& access_token) { |
| if (!signin_client_->AreSigninCookiesAllowed()) { |
| SignalComplete(account_id, |
| GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); |
| @@ -318,8 +323,9 @@ void GaiaCookieManagerService::AddAccountToCookie( |
| DCHECK(!account_id.empty()); |
| VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id; |
| requests_.push_back(GaiaCookieRequest::CreateAddAccountRequest(account_id)); |
| - if (requests_.size() == 1) |
| - StartFetchingUbertoken(); |
| + if (requests_.size() == 1) { |
| + StartFetchingUbertoken(access_token); |
| + } |
|
Roger Tawa OOO till Jul 10th
2015/05/11 16:56:15
Nit: no need for { and }
Mike Lerman
2015/05/12 20:51:44
Done.
|
| } |
| bool GaiaCookieManagerService::ListAccounts( |
| @@ -566,13 +572,19 @@ void GaiaCookieManagerService::OnListAccountsFailure( |
| HandleNextRequest(); |
| } |
| -void GaiaCookieManagerService::StartFetchingUbertoken() { |
| +void GaiaCookieManagerService::StartFetchingUbertoken( |
| + const std::string& access_token) { |
| VLOG(1) << "GaiaCookieManagerService::StartFetching account_id=" |
| << requests_.front().account_id(); |
| uber_token_fetcher_.reset( |
| new UbertokenFetcher(token_service_, this, source_, |
| signin_client_->GetURLRequestContext())); |
| - uber_token_fetcher_->StartFetchingToken(requests_.front().account_id()); |
| + if (access_token.empty()) { |
| + uber_token_fetcher_->StartFetchingToken(requests_.front().account_id()); |
| + } else { |
| + uber_token_fetcher_->StartFetchingTokenWithAccessToken( |
| + requests_.front().account_id(), access_token); |
| + } |
| } |
| void GaiaCookieManagerService::StartFetchingMergeSession() { |
| @@ -635,7 +647,7 @@ void GaiaCookieManagerService::HandleNextRequest() { |
| } else { |
| switch (requests_.front().request_type()) { |
| case GaiaCookieRequestType::ADD_ACCOUNT: |
| - StartFetchingUbertoken(); |
| + StartFetchingUbertoken(std::string()); |
| break; |
| case GaiaCookieRequestType::LOG_OUT: |
| StartLogOutUrlFetch(); |