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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 base::Bind(&RefreshPoliciesOnUIThread)); 117 base::Bind(&RefreshPoliciesOnUIThread));
118 } 118 }
119 119
120 // Record UMA for password login of regular user when Easy sign-in is enabled. 120 // Record UMA for password login of regular user when Easy sign-in is enabled.
121 void RecordPasswordLoginEvent(const UserContext& user_context) { 121 void RecordPasswordLoginEvent(const UserContext& user_context) {
122 EasyUnlockService* easy_unlock_service = 122 EasyUnlockService* easy_unlock_service =
123 EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); 123 EasyUnlockService::Get(ProfileHelper::GetSigninProfile());
124 if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR && 124 if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR &&
125 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE && 125 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE &&
126 easy_unlock_service) { 126 easy_unlock_service) {
127 easy_unlock_service->RecordPasswordLoginEvent(user_context.GetUserID()); 127 easy_unlock_service->RecordPasswordLoginEvent(
128 user_context.GetUserID().GetUserEmail());
128 } 129 }
129 } 130 }
130 131
131 bool CanShowDebuggingFeatures() { 132 bool CanShowDebuggingFeatures() {
132 // We need to be on the login screen and in dev mode to show this menu item. 133 // We need to be on the login screen and in dev mode to show this menu item.
133 return base::CommandLine::ForCurrentProcess()->HasSwitch( 134 return base::CommandLine::ForCurrentProcess()->HasSwitch(
134 chromeos::switches::kSystemDevMode) && 135 chromeos::switches::kSystemDevMode) &&
135 base::CommandLine::ForCurrentProcess()->HasSwitch( 136 base::CommandLine::ForCurrentProcess()->HasSwitch(
136 chromeos::switches::kLoginManager) && 137 chromeos::switches::kLoginManager) &&
137 !user_manager::UserManager::Get()->IsSessionStarted(); 138 !user_manager::UserManager::Get()->IsSessionStarted();
138 } 139 }
139 140
140 } // namespace 141 } // namespace
141 142
142 // static 143 // static
143 ExistingUserController* ExistingUserController::current_controller_ = NULL; 144 ExistingUserController* ExistingUserController::current_controller_ = NULL;
144 145
145 //////////////////////////////////////////////////////////////////////////////// 146 ////////////////////////////////////////////////////////////////////////////////
146 // ExistingUserController, public: 147 // ExistingUserController, public:
147 148
148 ExistingUserController::ExistingUserController(LoginDisplayHost* host) 149 ExistingUserController::ExistingUserController(LoginDisplayHost* host)
149 : auth_status_consumer_(NULL), 150 : auth_status_consumer_(NULL),
151 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.
150 host_(host), 152 host_(host),
151 login_display_(host_->CreateLoginDisplay(this)), 153 login_display_(host_->CreateLoginDisplay(this)),
152 num_login_attempts_(0), 154 num_login_attempts_(0),
153 cros_settings_(CrosSettings::Get()), 155 cros_settings_(CrosSettings::Get()),
154 is_login_in_progress_(false), 156 is_login_in_progress_(false),
155 password_changed_(false), 157 password_changed_(false),
156 auth_mode_(LoginPerformer::AUTH_MODE_EXTENSION), 158 auth_mode_(LoginPerformer::AUTH_MODE_EXTENSION),
157 signin_screen_ready_(false), 159 signin_screen_ready_(false),
158 network_state_helper_(new login::NetworkStateHelper), 160 network_state_helper_(new login::NetworkStateHelper),
159 weak_factory_(this) { 161 weak_factory_(this) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 BootTimesRecorder::Get()->RecordLoginAttempted(); 362 BootTimesRecorder::Get()->RecordLoginAttempted();
361 363
362 // Use the same LoginPerformer for subsequent login as it has state 364 // Use the same LoginPerformer for subsequent login as it has state
363 // such as Authenticator instance. 365 // such as Authenticator instance.
364 if (!login_performer_.get() || num_login_attempts_ <= 1) { 366 if (!login_performer_.get() || num_login_attempts_ <= 1) {
365 // Only one instance of LoginPerformer should exist at a time. 367 // Only one instance of LoginPerformer should exist at a time.
366 login_performer_.reset(NULL); 368 login_performer_.reset(NULL);
367 login_performer_.reset(new ChromeLoginPerformer(this)); 369 login_performer_.reset(new ChromeLoginPerformer(this));
368 } 370 }
369 371
370 if (gaia::ExtractDomainName(user_context.GetUserID()) == 372 if (gaia::ExtractDomainName(user_context.GetUserID().GetUserEmail()) ==
371 chromeos::login::kSupervisedUserDomain) { 373 chromeos::login::kSupervisedUserDomain) {
372 login_performer_->LoginAsSupervisedUser(user_context); 374 login_performer_->LoginAsSupervisedUser(user_context);
373 } else { 375 } else {
374 login_performer_->PerformLogin(user_context, auth_mode); 376 login_performer_->PerformLogin(user_context, auth_mode);
375 RecordPasswordLoginEvent(user_context); 377 RecordPasswordLoginEvent(user_context);
376 } 378 }
377 SendAccessibilityAlert( 379 SendAccessibilityAlert(
378 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); 380 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN));
379 } 381 }
380 382
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // ExistingUserController, LoginPerformer::Delegate implementation: 503 // ExistingUserController, LoginPerformer::Delegate implementation:
502 // 504 //
503 505
504 void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { 506 void ExistingUserController::OnAuthFailure(const AuthFailure& failure) {
505 guest_mode_url_ = GURL::EmptyGURL(); 507 guest_mode_url_ = GURL::EmptyGURL();
506 std::string error = failure.GetErrorString(); 508 std::string error = failure.GetErrorString();
507 509
508 PerformLoginFinishedActions(false /* don't start public session timer */); 510 PerformLoginFinishedActions(false /* don't start public session timer */);
509 511
510 if (ChromeUserManager::Get() 512 if (ChromeUserManager::Get()
511 ->GetUserFlow(last_login_attempt_username_) 513 ->GetUserFlow(last_login_attempt_account_)
512 ->HandleLoginFailure(failure)) { 514 ->HandleLoginFailure(failure)) {
513 return; 515 return;
514 } 516 }
515 517
516 if (failure.reason() == AuthFailure::OWNER_REQUIRED) { 518 if (failure.reason() == AuthFailure::OWNER_REQUIRED) {
517 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); 519 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error);
518 content::BrowserThread::PostDelayedTask( 520 content::BrowserThread::PostDelayedTask(
519 content::BrowserThread::UI, FROM_HERE, 521 content::BrowserThread::UI, FROM_HERE,
520 base::Bind(&SessionManagerClient::StopSession, 522 base::Bind(&SessionManagerClient::StopSession,
521 base::Unretained(DBusThreadManager::Get()-> 523 base::Unretained(DBusThreadManager::Get()->
522 GetSessionManagerClient())), 524 GetSessionManagerClient())),
523 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); 525 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs));
524 } else if (failure.reason() == AuthFailure::TPM_ERROR) { 526 } else if (failure.reason() == AuthFailure::TPM_ERROR) {
525 ShowTPMError(); 527 ShowTPMError();
526 } else if (last_login_attempt_username_ == chromeos::login::kGuestUserName) { 528 } 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.
527 // Show no errors, just re-enable input. 529 // Show no errors, just re-enable input.
528 login_display_->ClearAndEnablePassword(); 530 login_display_->ClearAndEnablePassword();
529 StartPublicSessionAutoLoginTimer(); 531 StartPublicSessionAutoLoginTimer();
530 } else { 532 } else {
531 // Check networking after trying to login in case user is 533 // Check networking after trying to login in case user is
532 // cached locally or the local admin account. 534 // cached locally or the local admin account.
533 bool is_known_user = user_manager::UserManager::Get()->IsKnownUser( 535 bool is_known_user = user_manager::UserManager::Get()->IsKnownUser(
534 last_login_attempt_username_); 536 last_login_attempt_account_);
535 if (!network_state_helper_->IsConnected()) { 537 if (!network_state_helper_->IsConnected()) {
536 if (is_known_user) 538 if (is_known_user)
537 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); 539 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
538 else 540 else
539 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); 541 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error);
540 } else { 542 } else {
541 // TODO(nkostylev): Cleanup rest of ClientLogin related code. 543 // TODO(nkostylev): Cleanup rest of ClientLogin related code.
542 if (failure.reason() == AuthFailure::NETWORK_AUTH_FAILED && 544 if (failure.reason() == AuthFailure::NETWORK_AUTH_FAILED &&
543 failure.error().state() == 545 failure.error().state() ==
544 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) { 546 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) {
545 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error); 547 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error);
546 } else { 548 } else {
547 if (!is_known_user) 549 if (!is_known_user)
548 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); 550 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error);
549 else 551 else
550 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); 552 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
551 } 553 }
552 } 554 }
553 login_display_->ClearAndEnablePassword(); 555 login_display_->ClearAndEnablePassword();
554 StartPublicSessionAutoLoginTimer(); 556 StartPublicSessionAutoLoginTimer();
555 } 557 }
556 558
557 // Reset user flow to default, so that special flow will not affect next 559 // Reset user flow to default, so that special flow will not affect next
558 // attempt. 560 // attempt.
559 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_username_); 561 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_);
560 562
561 if (auth_status_consumer_) 563 if (auth_status_consumer_)
562 auth_status_consumer_->OnAuthFailure(failure); 564 auth_status_consumer_->OnAuthFailure(failure);
563 565
564 // Clear the recorded displayed email so it won't affect any future attempts. 566 // Clear the recorded displayed email so it won't affect any future attempts.
565 display_email_.clear(); 567 display_email_.clear();
566 568
567 // TODO(ginkage): Fix this case once crbug.com/469990 is ready. 569 // TODO(ginkage): Fix this case once crbug.com/469990 is ready.
568 /* 570 /*
569 if (failure.reason() == AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME) { 571 if (failure.reason() == AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME) {
570 RecordReauthReason(last_login_attempt_username_, 572 RecordReauthReason(last_login_attempt_account_,
571 ReauthReason::MISSING_CRYPTOHOME); 573 ReauthReason::MISSING_CRYPTOHOME);
572 } 574 }
573 */ 575 */
574 } 576 }
575 577
576 void ExistingUserController::OnAuthSuccess(const UserContext& user_context) { 578 void ExistingUserController::OnAuthSuccess(const UserContext& user_context) {
577 is_login_in_progress_ = false; 579 is_login_in_progress_ = false;
578 login_display_->set_signin_completed(true); 580 login_display_->set_signin_completed(true);
579 581
580 // Login performer will be gone so cache this value to use 582 // Login performer will be gone so cache this value to use
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 bool browser_launched) { 626 bool browser_launched) {
625 // Reenable clicking on other windows and status area. 627 // Reenable clicking on other windows and status area.
626 login_display_->SetUIEnabled(true); 628 login_display_->SetUIEnabled(true);
627 629
628 if (browser_launched) 630 if (browser_launched)
629 host_ = NULL; 631 host_ = NULL;
630 632
631 // Inform |auth_status_consumer_| about successful login. 633 // Inform |auth_status_consumer_| about successful login.
632 // TODO(nkostylev): Pass UserContext back crbug.com/424550 634 // TODO(nkostylev): Pass UserContext back crbug.com/424550
633 if (auth_status_consumer_) { 635 if (auth_status_consumer_) {
634 auth_status_consumer_-> 636 auth_status_consumer_->OnAuthSuccess(
635 OnAuthSuccess(UserContext(last_login_attempt_username_)); 637 UserContext(last_login_attempt_account_));
636 } 638 }
637 } 639 }
638 640
639 void ExistingUserController::OnOffTheRecordAuthSuccess() { 641 void ExistingUserController::OnOffTheRecordAuthSuccess() {
640 is_login_in_progress_ = false; 642 is_login_in_progress_ = false;
641 643
642 // Mark the device as registered., i.e. the second part of OOBE as completed. 644 // Mark the device as registered., i.e. the second part of OOBE as completed.
643 if (!StartupUtils::IsDeviceRegistered()) 645 if (!StartupUtils::IsDeviceRegistered())
644 StartupUtils::MarkDeviceRegistered(base::Closure()); 646 StartupUtils::MarkDeviceRegistered(base::Closure());
645 647
646 UserSessionManager::GetInstance()->CompleteGuestSessionLogin(guest_mode_url_); 648 UserSessionManager::GetInstance()->CompleteGuestSessionLogin(guest_mode_url_);
647 649
648 if (auth_status_consumer_) 650 if (auth_status_consumer_)
649 auth_status_consumer_->OnOffTheRecordAuthSuccess(); 651 auth_status_consumer_->OnOffTheRecordAuthSuccess();
650 } 652 }
651 653
652 void ExistingUserController::OnPasswordChangeDetected() { 654 void ExistingUserController::OnPasswordChangeDetected() {
653 is_login_in_progress_ = false; 655 is_login_in_progress_ = false;
654 656
655 // Must not proceed without signature verification. 657 // Must not proceed without signature verification.
656 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( 658 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues(
657 base::Bind(&ExistingUserController::OnPasswordChangeDetected, 659 base::Bind(&ExistingUserController::OnPasswordChangeDetected,
658 weak_factory_.GetWeakPtr()))) { 660 weak_factory_.GetWeakPtr()))) {
659 // Value of owner email is still not verified. 661 // Value of owner email is still not verified.
660 // Another attempt will be invoked after verification completion. 662 // Another attempt will be invoked after verification completion.
661 return; 663 return;
662 } 664 }
663 665
664 if (ChromeUserManager::Get() 666 if (ChromeUserManager::Get()
665 ->GetUserFlow(last_login_attempt_username_) 667 ->GetUserFlow(last_login_attempt_account_)
666 ->HandlePasswordChangeDetected()) { 668 ->HandlePasswordChangeDetected()) {
667 return; 669 return;
668 } 670 }
669 671
670 // True if user has already made an attempt to enter old password and failed. 672 // True if user has already made an attempt to enter old password and failed.
671 bool show_invalid_old_password_error = 673 bool show_invalid_old_password_error =
672 login_performer_->password_changed_callback_count() > 1; 674 login_performer_->password_changed_callback_count() > 1;
673 675
674 // Note: We allow owner using "full sync" mode which will recreate 676 // Note: We allow owner using "full sync" mode which will recreate
675 // cryptohome and deal with owner private key being lost. This also allows 677 // cryptohome and deal with owner private key being lost. This also allows
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 return; 767 return;
766 } 768 }
767 769
768 UserContext new_user_context = user_context; 770 UserContext new_user_context = user_context;
769 std::string locale = user_context.GetPublicSessionLocale(); 771 std::string locale = user_context.GetPublicSessionLocale();
770 if (locale.empty()) { 772 if (locale.empty()) {
771 // When performing auto-login, no locale is chosen by the user. Check 773 // When performing auto-login, no locale is chosen by the user. Check
772 // whether a list of recommended locales was set by policy. If so, use its 774 // whether a list of recommended locales was set by policy. If so, use its
773 // first entry. Otherwise, |locale| will remain blank, indicating that the 775 // first entry. Otherwise, |locale| will remain blank, indicating that the
774 // public session should use the current UI locale. 776 // public session should use the current UI locale.
775 const policy::PolicyMap::Entry* entry = g_browser_process->platform_part()-> 777 const policy::PolicyMap::Entry* entry =
776 browser_policy_connector_chromeos()-> 778 g_browser_process->platform_part()
777 GetDeviceLocalAccountPolicyService()-> 779 ->browser_policy_connector_chromeos()
778 GetBrokerForUser(user_context.GetUserID())->core()->store()-> 780 ->GetDeviceLocalAccountPolicyService()
779 policy_map().Get(policy::key::kSessionLocales); 781 ->GetBrokerForUser(user_context.GetUserID().GetUserEmail())
782 ->core()
783 ->store()
784 ->policy_map()
785 .Get(policy::key::kSessionLocales);
780 base::ListValue const* list = NULL; 786 base::ListValue const* list = NULL;
781 if (entry && 787 if (entry &&
782 entry->level == policy::POLICY_LEVEL_RECOMMENDED && 788 entry->level == policy::POLICY_LEVEL_RECOMMENDED &&
783 entry->value && 789 entry->value &&
784 entry->value->GetAsList(&list)) { 790 entry->value->GetAsList(&list)) {
785 if (list->GetString(0, &locale)) 791 if (list->GetString(0, &locale))
786 new_user_context.SetPublicSessionLocale(locale); 792 new_user_context.SetPublicSessionLocale(locale);
787 } 793 }
788 } 794 }
789 795
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 for (std::vector<policy::DeviceLocalAccount>::const_iterator 841 for (std::vector<policy::DeviceLocalAccount>::const_iterator
836 it = device_local_accounts.begin(); 842 it = device_local_accounts.begin();
837 it != device_local_accounts.end(); ++it) { 843 it != device_local_accounts.end(); ++it) {
838 if (it->account_id == auto_login_account_id) { 844 if (it->account_id == auto_login_account_id) {
839 public_session_auto_login_username_ = it->user_id; 845 public_session_auto_login_username_ = it->user_id;
840 break; 846 break;
841 } 847 }
842 } 848 }
843 849
844 const user_manager::User* user = user_manager::UserManager::Get()->FindUser( 850 const user_manager::User* user = user_manager::UserManager::Get()->FindUser(
845 public_session_auto_login_username_); 851 AccountId::FromUserEmail(public_session_auto_login_username_));
846 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) 852 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
847 public_session_auto_login_username_.clear(); 853 public_session_auto_login_username_.clear();
848 854
849 if (!cros_settings_->GetInteger( 855 if (!cros_settings_->GetInteger(
850 kAccountsPrefDeviceLocalAccountAutoLoginDelay, 856 kAccountsPrefDeviceLocalAccountAutoLoginDelay,
851 &public_session_auto_login_delay_)) { 857 &public_session_auto_login_delay_)) {
852 public_session_auto_login_delay_ = 0; 858 public_session_auto_login_delay_ = 0;
853 } 859 }
854 860
855 if (!public_session_auto_login_username_.empty()) 861 if (!public_session_auto_login_username_.empty())
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 } else { 927 } else {
922 // login_performer_ will be null if an error occurred during OAuth2 token 928 // login_performer_ will be null if an error occurred during OAuth2 token
923 // fetch. In this case, show a generic error. 929 // fetch. In this case, show a generic error.
924 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; 930 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT;
925 } 931 }
926 932
927 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { 933 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) {
928 if (num_login_attempts_ > 1) { 934 if (num_login_attempts_ > 1) {
929 const user_manager::User* user = 935 const user_manager::User* user =
930 user_manager::UserManager::Get()->FindUser( 936 user_manager::UserManager::Get()->FindUser(
931 last_login_attempt_username_); 937 last_login_attempt_account_);
932 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) 938 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED))
933 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; 939 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED;
934 } 940 }
935 } 941 }
936 942
937 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id); 943 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id);
938 } 944 }
939 945
940 void ExistingUserController::SendAccessibilityAlert( 946 void ExistingUserController::SendAccessibilityAlert(
941 const std::string& alert_text) { 947 const std::string& alert_text) {
(...skipping 30 matching lines...) Expand all
972 login_performer_->LoginAsPublicSession(user_context); 978 login_performer_->LoginAsPublicSession(user_context);
973 SendAccessibilityAlert( 979 SendAccessibilityAlert(
974 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT)); 980 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT));
975 } 981 }
976 982
977 void ExistingUserController::PerformPreLoginActions( 983 void ExistingUserController::PerformPreLoginActions(
978 const UserContext& user_context) { 984 const UserContext& user_context) {
979 // Disable clicking on other windows and status tray. 985 // Disable clicking on other windows and status tray.
980 login_display_->SetUIEnabled(false); 986 login_display_->SetUIEnabled(false);
981 987
982 if (last_login_attempt_username_ != user_context.GetUserID()) { 988 if (last_login_attempt_account_ != user_context.GetUserID()) {
983 last_login_attempt_username_ = user_context.GetUserID(); 989 last_login_attempt_account_ = user_context.GetUserID();
984 num_login_attempts_ = 0; 990 num_login_attempts_ = 0;
985 } 991 }
986 992
987 // Guard in cases when we're called twice but login process is still active. 993 // Guard in cases when we're called twice but login process is still active.
988 // This might happen when login process is paused till signed settings status 994 // This might happen when login process is paused till signed settings status
989 // is verified which results in Login* method called again as a callback. 995 // is verified which results in Login* method called again as a callback.
990 if (!is_login_in_progress_) 996 if (!is_login_in_progress_)
991 num_login_attempts_++; 997 num_login_attempts_++;
992 998
993 is_login_in_progress_ = true; 999 is_login_in_progress_ = true;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 1063
1058 void ExistingUserController::DoCompleteLogin( 1064 void ExistingUserController::DoCompleteLogin(
1059 const UserContext& user_context_wo_device_id) { 1065 const UserContext& user_context_wo_device_id) {
1060 UserContext user_context = user_context_wo_device_id; 1066 UserContext user_context = user_context_wo_device_id;
1061 std::string device_id = 1067 std::string device_id =
1062 user_manager::UserManager::Get()->GetKnownUserDeviceId( 1068 user_manager::UserManager::Get()->GetKnownUserDeviceId(
1063 user_context.GetUserID()); 1069 user_context.GetUserID());
1064 if (device_id.empty()) { 1070 if (device_id.empty()) {
1065 bool is_ephemeral = 1071 bool is_ephemeral =
1066 ChromeUserManager::Get()->AreEphemeralUsersEnabled() && 1072 ChromeUserManager::Get()->AreEphemeralUsersEnabled() &&
1067 user_context.GetUserID() != ChromeUserManager::Get()->GetOwnerEmail(); 1073 user_context.GetUserID() != ChromeUserManager::Get()->GetOwnerId();
1068 device_id = SigninClient::GenerateSigninScopedDeviceID(is_ephemeral); 1074 device_id = SigninClient::GenerateSigninScopedDeviceID(is_ephemeral);
1069 } 1075 }
1070 user_context.SetDeviceId(device_id); 1076 user_context.SetDeviceId(device_id);
1071 1077
1072 const std::string& gaps_cookie = user_context.GetGAPSCookie(); 1078 const std::string& gaps_cookie = user_context.GetGAPSCookie();
1073 if (!gaps_cookie.empty()) { 1079 if (!gaps_cookie.empty()) {
1074 user_manager::UserManager::Get()->SetKnownUserGAPSCookie( 1080 user_manager::UserManager::Get()->SetKnownUserGAPSCookie(
1075 user_context.GetUserID(), gaps_cookie); 1081 user_context.GetUserID(), gaps_cookie);
1076 } 1082 }
1077 1083
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 LoginAsGuest(); 1143 LoginAsGuest();
1138 return; 1144 return;
1139 } 1145 }
1140 1146
1141 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { 1147 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) {
1142 LoginAsPublicSession(user_context); 1148 LoginAsPublicSession(user_context);
1143 return; 1149 return;
1144 } 1150 }
1145 1151
1146 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { 1152 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) {
1147 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); 1153 LoginAsKioskApp(user_context.GetUserID().GetUserEmail(),
1154 specifics.kiosk_diagnostic_mode);
1148 return; 1155 return;
1149 } 1156 }
1150 1157
1151 // Regular user or supervised user login. 1158 // Regular user or supervised user login.
1152 1159
1153 if (!user_context.HasCredentials()) { 1160 if (!user_context.HasCredentials()) {
1154 // If credentials are missing, refuse to log in. 1161 // If credentials are missing, refuse to log in.
1155 1162
1156 // Reenable clicking on other windows and status area. 1163 // Reenable clicking on other windows and status area.
1157 login_display_->SetUIEnabled(true); 1164 login_display_->SetUIEnabled(true);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 if (!success) { 1196 if (!success) {
1190 LOG(ERROR) << "OAuth2 token fetch failed."; 1197 LOG(ERROR) << "OAuth2 token fetch failed.";
1191 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN)); 1198 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN));
1192 return; 1199 return;
1193 } 1200 }
1194 UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context); 1201 UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context);
1195 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); 1202 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
1196 } 1203 }
1197 1204
1198 } // namespace chromeos 1205 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698