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

Unified Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: Address review comments 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/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());
}
}

Powered by Google App Engine
This is Rietveld 408576698