Chromium Code Reviews| Index: chrome/browser/chromeos/login/session/user_session_manager.cc |
| diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc |
| index a55f332c30478c15ab4a16301ac7cf227062db0b..47ef69e426cee0c6e28a4f9efe0db8daf7b1fc7e 100644 |
| --- a/chrome/browser/chromeos/login/session/user_session_manager.cc |
| +++ b/chrome/browser/chromeos/login/session/user_session_manager.cc |
| @@ -915,15 +915,18 @@ void UserSessionManager::InitProfilePreferences( |
| supervised_user_sync_id); |
| } else if (user_manager::UserManager::Get()-> |
| IsLoggedInAsUserWithGaiaAccount()) { |
| - // Prime the account tracker with this combination of gaia id/display email. |
| - // Don't do this unless both email and gaia_id are valid. They may not |
| - // be when simply unlocking the profile. |
| - if (!user_context.GetGaiaID().empty() && |
| - !user_context.GetUserID().empty()) { |
| + // Get the Gaia ID from the user context. If it's not available, this may |
| + // not be available when unlocking a previously opened profile, or when |
| + // creating a supervised users. However, in these cases the gaia_id should |
| + // be already available in the account tracker. |
| + std::string gaia_id = user_context.GetGaiaID(); |
| + if (gaia_id.empty()) { |
| AccountTrackerService* account_tracker = |
| AccountTrackerServiceFactory::GetForProfile(profile); |
| - account_tracker->SeedAccountInfo(user_context.GetGaiaID(), |
| - user_context.GetUserID()); |
| + AccountTrackerService::AccountInfo info = |
| + account_tracker->FindAccountInfoByEmail(user_context.GetUserID()); |
| + gaia_id = info.gaia; |
| + DCHECK(!gaia_id.empty()); |
| } |
| // Make sure that the google service username is properly set (we do this |
| @@ -931,7 +934,8 @@ void UserSessionManager::InitProfilePreferences( |
| // profiles that might not have it set yet). |
| SigninManagerBase* signin_manager = |
| SigninManagerFactory::GetForProfile(profile); |
| - signin_manager->SetAuthenticatedUsername(user_context.GetUserID()); |
| + signin_manager->SetAuthenticatedAccountInfo(user_context.GetGaiaID(), |
|
xiyuan
2015/04/09 20:59:21
Did you mean to use |gaia_id| here?
Roger Tawa OOO till Jul 10th
2015/04/10 01:52:57
Yes. First param is gaia-id, second is email.
xiyuan
2015/04/10 02:50:45
user_context.GetGaiaID() could return an empty str
Roger Tawa OOO till Jul 10th
2015/04/10 12:22:13
Oops, you are correct, totally missed that. Done.
|
| + user_context.GetUserID()); |
| } |
| } |