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 5e046a4b5de19f0f0119465f99fc3f2b1b9e13e1..8b79b2f5b4ab88ca845fc03079362ef02997f7ef 100644 |
--- a/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc |
+++ b/chrome/browser/chromeos/login/signin/oauth2_login_manager.cc |
@@ -16,6 +16,7 @@ |
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chromeos/chromeos_switches.h" |
+#include "components/signin/core/account_id/account_id.h" |
#include "components/signin/core/browser/account_tracker_service.h" |
#include "components/signin/core/browser/profile_oauth2_token_service.h" |
#include "components/signin/core/browser/signin_client.h" |
@@ -108,7 +109,8 @@ void OAuth2LoginManager::RestoreSessionFromSavedTokens() { |
// cause user to go through Gaia in next login to obtain a new refresh |
// token. |
user_manager::UserManager::Get()->SaveUserOAuthStatus( |
- primary_account_id, user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN); |
+ AccountId::FromUserEmail(primary_account_id), |
+ user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN); |
token_service->LoadCredentials(primary_account_id); |
} |
@@ -129,14 +131,14 @@ bool OAuth2LoginManager::ShouldBlockTabLoading() const { |
} |
void OAuth2LoginManager::OnRefreshTokenAvailable( |
- const std::string& account_id) { |
+ const std::string& user_email) { |
VLOG(1) << "OnRefreshTokenAvailable"; |
if (state_ == SESSION_RESTORE_NOT_STARTED) |
return; |
// TODO(fgorski): Once ProfileOAuth2TokenService supports multi-login, make |
- // sure to restore session cookies in the context of the correct account_id. |
+ // sure to restore session cookies in the context of the correct user_email. |
// Do not validate tokens for supervised users, as they don't actually have |
// oauth2 token. |
@@ -145,10 +147,11 @@ void OAuth2LoginManager::OnRefreshTokenAvailable( |
return; |
} |
// Only restore session cookies for the primary account in the profile. |
- if (GetPrimaryAccountId() == account_id) { |
+ if (GetPrimaryAccountId() == user_email) { |
// Token is loaded. Undo the flagging before token loading. |
user_manager::UserManager::Get()->SaveUserOAuthStatus( |
- account_id, user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
+ AccountId::FromUserEmail(user_email), |
+ user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
VerifySessionCookies(); |
} |
} |