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

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

Issue 2663033002: Merge "cros: Fix multiple LoadCredentials on network change" (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/chromeos/login/signin/oauth2_login_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 69f2f86365b4b207bc3bdf65cd4a5ca35cbb6a95..3a7680624a81ee6246128c975e7bdbb28a2aafbc 100644
--- a/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc
+++ b/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc
@@ -96,6 +96,12 @@ void OAuth2LoginManager::ContinueSessionRestore() {
}
void OAuth2LoginManager::RestoreSessionFromSavedTokens() {
+ // Just return if there is a pending TokenService::LoadCredentials call.
+ // Session restore continues in OnRefreshTokenAvailable when the call
+ // finishes.
+ if (pending_token_service_load_)
+ return;
+
ProfileOAuth2TokenService* token_service = GetTokenService();
const std::string& primary_account_id = GetPrimaryAccountId();
if (token_service->RefreshTokenIsAvailable(primary_account_id)) {
@@ -113,6 +119,7 @@ void OAuth2LoginManager::RestoreSessionFromSavedTokens() {
AccountId::FromUserEmail(primary_account_id),
user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN);
+ pending_token_service_load_ = true;
token_service->LoadCredentials(primary_account_id);
}
}
@@ -153,6 +160,8 @@ void OAuth2LoginManager::OnRefreshTokenAvailable(
user_manager::UserManager::Get()->SaveUserOAuthStatus(
AccountId::FromUserEmail(user_email),
user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
+
+ pending_token_service_load_ = false;
VerifySessionCookies();
}
}
« no previous file with comments | « chrome/browser/chromeos/login/signin/oauth2_login_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698