Chromium Code Reviews| Index: chrome/browser/chromeos/login/existing_user_controller.cc |
| diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc |
| index 53ca8696e39366d2b8ba8b02ed8edbb77411e762..55e9eb79a8ea957f35d01de7f132c99d2d89a2ca 100644 |
| --- a/chrome/browser/chromeos/login/existing_user_controller.cc |
| +++ b/chrome/browser/chromeos/login/existing_user_controller.cc |
| @@ -124,7 +124,8 @@ void RecordPasswordLoginEvent(const UserContext& user_context) { |
| if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR && |
| user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE && |
| easy_unlock_service) { |
| - easy_unlock_service->RecordPasswordLoginEvent(user_context.GetUserID()); |
| + easy_unlock_service->RecordPasswordLoginEvent( |
| + user_context.GetUserID().GetUserEmail()); |
| } |
| } |
| @@ -147,6 +148,7 @@ ExistingUserController* ExistingUserController::current_controller_ = NULL; |
| ExistingUserController::ExistingUserController(LoginDisplayHost* host) |
| : auth_status_consumer_(NULL), |
| + last_login_attempt_account_(EmptyAccountId()), |
|
achuithb
2015/10/23 00:08:49
use in-class data member initialization
Alexander Alekseev
2015/10/23 09:11:21
Done.
|
| host_(host), |
| login_display_(host_->CreateLoginDisplay(this)), |
| num_login_attempts_(0), |
| @@ -367,7 +369,7 @@ void ExistingUserController::PerformLogin( |
| login_performer_.reset(new ChromeLoginPerformer(this)); |
| } |
| - if (gaia::ExtractDomainName(user_context.GetUserID()) == |
| + if (gaia::ExtractDomainName(user_context.GetUserID().GetUserEmail()) == |
| chromeos::login::kSupervisedUserDomain) { |
| login_performer_->LoginAsSupervisedUser(user_context); |
| } else { |
| @@ -508,7 +510,7 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { |
| PerformLoginFinishedActions(false /* don't start public session timer */); |
| if (ChromeUserManager::Get() |
| - ->GetUserFlow(last_login_attempt_username_) |
| + ->GetUserFlow(last_login_attempt_account_) |
| ->HandleLoginFailure(failure)) { |
| return; |
| } |
| @@ -523,7 +525,7 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { |
| base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); |
| } else if (failure.reason() == AuthFailure::TPM_ERROR) { |
| ShowTPMError(); |
| - } else if (last_login_attempt_username_ == chromeos::login::kGuestUserName) { |
| + } else if (last_login_attempt_account_ == chromeos::login::GuestAccountId()) { |
|
achuithb
2015/10/23 00:08:49
drop chromeos::
Alexander Alekseev
2015/10/23 09:11:21
Done.
|
| // Show no errors, just re-enable input. |
| login_display_->ClearAndEnablePassword(); |
| StartPublicSessionAutoLoginTimer(); |
| @@ -531,7 +533,7 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { |
| // Check networking after trying to login in case user is |
| // cached locally or the local admin account. |
| bool is_known_user = user_manager::UserManager::Get()->IsKnownUser( |
| - last_login_attempt_username_); |
| + last_login_attempt_account_); |
| if (!network_state_helper_->IsConnected()) { |
| if (is_known_user) |
| ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
| @@ -556,7 +558,7 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { |
| // Reset user flow to default, so that special flow will not affect next |
| // attempt. |
| - ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_username_); |
| + ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_); |
| if (auth_status_consumer_) |
| auth_status_consumer_->OnAuthFailure(failure); |
| @@ -567,7 +569,7 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { |
| // TODO(ginkage): Fix this case once crbug.com/469990 is ready. |
| /* |
| if (failure.reason() == AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME) { |
| - RecordReauthReason(last_login_attempt_username_, |
| + RecordReauthReason(last_login_attempt_account_, |
| ReauthReason::MISSING_CRYPTOHOME); |
| } |
| */ |
| @@ -631,8 +633,8 @@ void ExistingUserController::OnProfilePrepared(Profile* profile, |
| // Inform |auth_status_consumer_| about successful login. |
| // TODO(nkostylev): Pass UserContext back crbug.com/424550 |
| if (auth_status_consumer_) { |
| - auth_status_consumer_-> |
| - OnAuthSuccess(UserContext(last_login_attempt_username_)); |
| + auth_status_consumer_->OnAuthSuccess( |
| + UserContext(last_login_attempt_account_)); |
| } |
| } |
| @@ -662,7 +664,7 @@ void ExistingUserController::OnPasswordChangeDetected() { |
| } |
| if (ChromeUserManager::Get() |
| - ->GetUserFlow(last_login_attempt_username_) |
| + ->GetUserFlow(last_login_attempt_account_) |
| ->HandlePasswordChangeDetected()) { |
| return; |
| } |
| @@ -772,11 +774,15 @@ void ExistingUserController::LoginAsPublicSession( |
| // whether a list of recommended locales was set by policy. If so, use its |
| // first entry. Otherwise, |locale| will remain blank, indicating that the |
| // public session should use the current UI locale. |
| - const policy::PolicyMap::Entry* entry = g_browser_process->platform_part()-> |
| - browser_policy_connector_chromeos()-> |
| - GetDeviceLocalAccountPolicyService()-> |
| - GetBrokerForUser(user_context.GetUserID())->core()->store()-> |
| - policy_map().Get(policy::key::kSessionLocales); |
| + const policy::PolicyMap::Entry* entry = |
| + g_browser_process->platform_part() |
| + ->browser_policy_connector_chromeos() |
| + ->GetDeviceLocalAccountPolicyService() |
| + ->GetBrokerForUser(user_context.GetUserID().GetUserEmail()) |
| + ->core() |
| + ->store() |
| + ->policy_map() |
| + .Get(policy::key::kSessionLocales); |
| base::ListValue const* list = NULL; |
| if (entry && |
| entry->level == policy::POLICY_LEVEL_RECOMMENDED && |
| @@ -842,7 +848,7 @@ void ExistingUserController::ConfigurePublicSessionAutoLogin() { |
| } |
| const user_manager::User* user = user_manager::UserManager::Get()->FindUser( |
| - public_session_auto_login_username_); |
| + AccountId::FromUserEmail(public_session_auto_login_username_)); |
| if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| public_session_auto_login_username_.clear(); |
| @@ -928,7 +934,7 @@ void ExistingUserController::ShowError(int error_id, |
| if (num_login_attempts_ > 1) { |
| const user_manager::User* user = |
| user_manager::UserManager::Get()->FindUser( |
| - last_login_attempt_username_); |
| + last_login_attempt_account_); |
| if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) |
| error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; |
| } |
| @@ -979,8 +985,8 @@ void ExistingUserController::PerformPreLoginActions( |
| // Disable clicking on other windows and status tray. |
| login_display_->SetUIEnabled(false); |
| - if (last_login_attempt_username_ != user_context.GetUserID()) { |
| - last_login_attempt_username_ = user_context.GetUserID(); |
| + if (last_login_attempt_account_ != user_context.GetUserID()) { |
| + last_login_attempt_account_ = user_context.GetUserID(); |
| num_login_attempts_ = 0; |
| } |
| @@ -1064,7 +1070,7 @@ void ExistingUserController::DoCompleteLogin( |
| if (device_id.empty()) { |
| bool is_ephemeral = |
| ChromeUserManager::Get()->AreEphemeralUsersEnabled() && |
| - user_context.GetUserID() != ChromeUserManager::Get()->GetOwnerEmail(); |
| + user_context.GetUserID() != ChromeUserManager::Get()->GetOwnerId(); |
| device_id = SigninClient::GenerateSigninScopedDeviceID(is_ephemeral); |
| } |
| user_context.SetDeviceId(device_id); |
| @@ -1144,7 +1150,8 @@ void ExistingUserController::DoLogin(const UserContext& user_context, |
| } |
| if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { |
| - LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); |
| + LoginAsKioskApp(user_context.GetUserID().GetUserEmail(), |
| + specifics.kiosk_diagnostic_mode); |
| return; |
| } |