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

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

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Rebased. Created 5 years, 2 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 4da8df1bf1d54a655bb441120b2cba6a845a7dce..f953cf21ea9b2fa74192fde2334dcbfc6fec9da5 100644
--- a/chrome/browser/chromeos/login/session/user_session_manager.cc
+++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
@@ -450,7 +450,7 @@ void UserSessionManager::StartSession(
delegate_ = delegate;
start_session_type_ = start_session_type;
- VLOG(1) << "Starting session for " << user_context.GetUserID();
+ VLOG(1) << "Starting session for " << user_context.GetUserID().GetUserEmail();
PreStartSession();
CreateUserSession(user_context, has_auth_cookies);
@@ -758,7 +758,7 @@ void UserSessionManager::OnSessionRestoreStateChanged(
if (!connection_error) {
// We are in one of "done" states here.
user_manager::UserManager::Get()->SaveUserOAuthStatus(
- user_manager::UserManager::Get()->GetLoggedInUser()->email(),
+ user_manager::UserManager::Get()->GetLoggedInUser()->GetUserID(),
user_status);
}
@@ -869,8 +869,8 @@ void UserSessionManager::StoreUserContextDataBeforeProfileIsCreated() {
void UserSessionManager::StartCrosSession() {
BootTimesRecorder* btl = BootTimesRecorder::Get();
btl->AddLoginTimeMarker("StartSession-Start", false);
- DBusThreadManager::Get()->GetSessionManagerClient()->
- StartSession(user_context_.GetUserID());
+ DBusThreadManager::Get()->GetSessionManagerClient()->StartSession(
+ user_context_.GetUserID().GetUserEmail());
btl->AddLoginTimeMarker("StartSession-End", false);
}
@@ -885,8 +885,8 @@ void UserSessionManager::NotifyUserLoggedIn() {
}
void UserSessionManager::PrepareProfile() {
- bool is_demo_session =
- DemoAppLauncher::IsDemoAppSession(user_context_.GetUserID());
+ bool is_demo_session = DemoAppLauncher::IsDemoAppSession(
achuithb 2015/10/23 00:08:50 const bool
Alexander Alekseev 2015/10/23 09:11:22 Done.
+ user_context_.GetUserID().GetUserEmail());
// TODO(nkostylev): Figure out whether demo session is using the right profile
// path or not. See https://codereview.chromium.org/171423009
@@ -968,8 +968,8 @@ void UserSessionManager::InitProfilePreferences(
if (gaia_id.empty()) {
AccountTrackerService* account_tracker =
AccountTrackerServiceFactory::GetForProfile(profile);
- AccountInfo info =
- account_tracker->FindAccountInfoByEmail(user_context.GetUserID());
+ AccountInfo info = account_tracker->FindAccountInfoByEmail(
achuithb 2015/10/23 00:08:50 const
Alexander Alekseev 2015/10/23 09:11:22 Done.
+ user_context.GetUserID().GetUserEmail());
gaia_id = info.gaia;
DCHECK(!gaia_id.empty());
}
@@ -979,8 +979,8 @@ void UserSessionManager::InitProfilePreferences(
// profiles that might not have it set yet).
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile);
- signin_manager->SetAuthenticatedAccountInfo(gaia_id,
- user_context.GetUserID());
+ signin_manager->SetAuthenticatedAccountInfo(
+ gaia_id, user_context.GetUserID().GetUserEmail());
// Backfill GAIA ID in user prefs stored in Local State.
std::string tmp_gaia_id;
@@ -994,7 +994,7 @@ void UserSessionManager::InitProfilePreferences(
void UserSessionManager::UserProfileInitialized(Profile* profile,
bool is_incognito_profile,
- const std::string& user_id) {
+ const AccountId& user_id) {
achuithb 2015/10/23 00:08:50 account_id
Alexander Alekseev 2015/10/23 09:11:22 Done.
// Demo user signed in.
if (is_incognito_profile) {
profile->OnLogin();
@@ -1021,9 +1021,10 @@ void UserSessionManager::UserProfileInitialized(Profile* profile,
// first.
bool transfer_saml_auth_cookies_on_subsequent_login = false;
if (has_auth_cookies_ &&
- g_browser_process->platform_part()->
- browser_policy_connector_chromeos()->GetUserAffiliation(user_id) ==
- policy::USER_AFFILIATION_MANAGED) {
+ g_browser_process->platform_part()
+ ->browser_policy_connector_chromeos()
+ ->GetUserAffiliation(user_id.GetUserEmail()) ==
+ policy::USER_AFFILIATION_MANAGED) {
CrosSettings::Get()->GetBoolean(
kAccountsPrefTransferSAMLCookies,
&transfer_saml_auth_cookies_on_subsequent_login);
@@ -1440,7 +1441,7 @@ void UserSessionManager::RestorePendingUserSessions() {
DCHECK(!user_already_logged_in);
if (!user_already_logged_in) {
- UserContext user_context(user_id);
+ UserContext user_context(AccountId::FromUserEmail(user_id));
user_context.SetUserIDHash(user_id_hash);
user_context.SetIsUsingOAuth(false);
@@ -1503,7 +1504,7 @@ void UserSessionManager::UpdateEasyUnlockKeys(const UserContext& user_context) {
key_manager->RefreshKeys(
user_context, *device_list,
base::Bind(&UserSessionManager::OnEasyUnlockKeyOpsFinished, AsWeakPtr(),
- user_context.GetUserID()));
+ user_context.GetUserID().GetUserEmail()));
}
net::URLRequestContextGetter*
@@ -1564,8 +1565,8 @@ void UserSessionManager::OnEasyUnlockKeyOpsFinished(
if (!easy_unlock_key_ops_finished_callback_.is_null())
easy_unlock_key_ops_finished_callback_.Run();
- const user_manager::User* user =
- user_manager::UserManager::Get()->FindUser(user_id);
+ const user_manager::User* user = user_manager::UserManager::Get()->FindUser(
+ AccountId::FromUserEmail(user_id));
EasyUnlockService* easy_unlock_service =
EasyUnlockService::GetForUser(*user);
easy_unlock_service->CheckCryptohomeKeysAndMaybeHardlock();
@@ -1737,7 +1738,7 @@ void UserSessionManager::OnOAuth2TokensFetched(UserContext context) {
}
}
-void UserSessionManager::OnTokenHandleObtained(const user_manager::UserID& id,
+void UserSessionManager::OnTokenHandleObtained(const AccountId& id,
achuithb 2015/10/23 00:08:50 account_id
Alexander Alekseev 2015/10/23 09:11:22 Done.
bool success) {
if (!success)
LOG(ERROR) << "OAuth2 token handle fetch failed.";

Powered by Google App Engine
This is Rietveld 408576698