Chromium Code Reviews| Index: chrome/browser/chromeos/login/signin/oauth2_login_manager.cc |
| diff --git a/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc b/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc |
| index 61023ea0f62914fb8272be54232c9572b66f259e..87a7c359f8da9877e325e67fa101375d14df5a88 100644 |
| --- a/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc |
| +++ b/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc |
| @@ -74,21 +74,19 @@ void OAuth2LoginManager::RestoreSession( |
| net::URLRequestContextGetter* auth_request_context, |
| SessionRestoreStrategy restore_strategy, |
| const std::string& oauth2_refresh_token, |
| - const std::string& auth_code) { |
| + const std::string& oauth2_access_token) { |
| DCHECK(user_profile_); |
| auth_request_context_ = auth_request_context; |
| restore_strategy_ = restore_strategy; |
| refresh_token_ = oauth2_refresh_token; |
| - oauthlogin_access_token_ = std::string(); |
| - auth_code_ = auth_code; |
| + oauthlogin_access_token_ = oauth2_access_token; |
| session_restore_start_ = base::Time::Now(); |
| SetSessionRestoreState(OAuth2LoginManager::SESSION_RESTORE_PREPARING); |
| ContinueSessionRestore(); |
| } |
| void OAuth2LoginManager::ContinueSessionRestore() { |
| - if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR || |
| - restore_strategy_ == RESTORE_FROM_AUTH_CODE) { |
| + if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) { |
| FetchOAuth2Tokens(); |
| return; |
| } |
| @@ -239,28 +237,19 @@ void OAuth2LoginManager::OnNetworkError(int response_code) { |
| void OAuth2LoginManager::FetchOAuth2Tokens() { |
| DCHECK(auth_request_context_.get()); |
| + DCHECK_EQ(RESTORE_FROM_COOKIE_JAR, restore_strategy_); |
| + |
| // If we have authenticated cookie jar, get OAuth1 token first, then fetch |
| // SID/LSID cookies through OAuthLogin call. |
| - if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) { |
| - SigninClient* signin_client = |
| - ChromeSigninClientFactory::GetForProfile(user_profile_); |
| - std::string signin_scoped_device_id = |
| - signin_client->GetSigninScopedDeviceId(); |
| - |
| - oauth2_token_fetcher_.reset( |
| - new OAuth2TokenFetcher(this, auth_request_context_.get())); |
| - oauth2_token_fetcher_->StartExchangeFromCookies(std::string(), |
| - signin_scoped_device_id); |
| - } else if (restore_strategy_ == RESTORE_FROM_AUTH_CODE) { |
| - DCHECK(!auth_code_.empty()); |
| - oauth2_token_fetcher_.reset( |
| - new OAuth2TokenFetcher(this, |
| - g_browser_process->system_request_context())); |
| - oauth2_token_fetcher_->StartExchangeFromAuthCode(auth_code_); |
| - } else { |
| - NOTREACHED(); |
| - SetSessionRestoreState(OAuth2LoginManager::SESSION_RESTORE_FAILED); |
|
Nikita (slow)
2015/04/23 10:59:25
I suggest keeping this code as a safety net when F
achuithb
2015/04/23 22:11:16
Done.
|
| - } |
| + SigninClient* signin_client = |
| + ChromeSigninClientFactory::GetForProfile(user_profile_); |
| + std::string signin_scoped_device_id = |
| + signin_client->GetSigninScopedDeviceId(); |
| + |
| + oauth2_token_fetcher_.reset( |
| + new OAuth2TokenFetcher(this, auth_request_context_.get())); |
| + oauth2_token_fetcher_->StartExchangeFromCookies(std::string(), |
| + signin_scoped_device_id); |
| } |
| void OAuth2LoginManager::OnOAuth2TokensAvailable( |