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

Unified Diff: chrome/browser/chromeos/login/signin/oauth2_login_manager.cc

Issue 1097663003: Fetch OAuth2 tokens prior to profile creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set up default networks Created 5 years, 8 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/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(

Powered by Google App Engine
This is Rietveld 408576698