| 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..415d14baf4c8e003686194c5d617bc66b43d47e2 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& oauth2_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(oauth2_token);
|
| + }
|
| }
|
|
|
| bool GaiaCookieManagerService::ListAccounts(
|
| @@ -566,13 +572,17 @@ 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_->OnGetTokenSuccess(nullptr, access_token, base::Time());
|
| }
|
|
|
| void GaiaCookieManagerService::StartFetchingMergeSession() {
|
| @@ -635,7 +645,7 @@ void GaiaCookieManagerService::HandleNextRequest() {
|
| } else {
|
| switch (requests_.front().request_type()) {
|
| case GaiaCookieRequestType::ADD_ACCOUNT:
|
| - StartFetchingUbertoken();
|
| + StartFetchingUbertoken(std::string());
|
| break;
|
| case GaiaCookieRequestType::LOG_OUT:
|
| StartLogOutUrlFetch();
|
|
|