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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 2510203002: Implement auto-login for ARC kiosk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kiosk_session
Patch Set: Created 4 years, 1 month 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 <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 kAccountsPrefSupervisedUsersEnabled, 202 kAccountsPrefSupervisedUsersEnabled,
203 base::Bind(&ExistingUserController::DeviceSettingsChanged, 203 base::Bind(&ExistingUserController::DeviceSettingsChanged,
204 base::Unretained(this))); 204 base::Unretained(this)));
205 users_subscription_ = cros_settings_->AddSettingsObserver( 205 users_subscription_ = cros_settings_->AddSettingsObserver(
206 kAccountsPrefUsers, 206 kAccountsPrefUsers,
207 base::Bind(&ExistingUserController::DeviceSettingsChanged, 207 base::Bind(&ExistingUserController::DeviceSettingsChanged,
208 base::Unretained(this))); 208 base::Unretained(this)));
209 local_account_auto_login_id_subscription_ = 209 local_account_auto_login_id_subscription_ =
210 cros_settings_->AddSettingsObserver( 210 cros_settings_->AddSettingsObserver(
211 kAccountsPrefDeviceLocalAccountAutoLoginId, 211 kAccountsPrefDeviceLocalAccountAutoLoginId,
212 base::Bind(&ExistingUserController::ConfigurePublicSessionAutoLogin, 212 base::Bind(&ExistingUserController::ConfigureAutoLogin,
213 base::Unretained(this))); 213 base::Unretained(this)));
214 local_account_auto_login_delay_subscription_ = 214 local_account_auto_login_delay_subscription_ =
215 cros_settings_->AddSettingsObserver( 215 cros_settings_->AddSettingsObserver(
216 kAccountsPrefDeviceLocalAccountAutoLoginDelay, 216 kAccountsPrefDeviceLocalAccountAutoLoginDelay,
217 base::Bind(&ExistingUserController::ConfigurePublicSessionAutoLogin, 217 base::Bind(&ExistingUserController::ConfigureAutoLogin,
218 base::Unretained(this))); 218 base::Unretained(this)));
219 } 219 }
220 220
221 void ExistingUserController::Init(const user_manager::UserList& users) { 221 void ExistingUserController::Init(const user_manager::UserList& users) {
222 time_init_ = base::Time::Now(); 222 time_init_ = base::Time::Now();
223 UpdateLoginDisplay(users); 223 UpdateLoginDisplay(users);
224 ConfigurePublicSessionAutoLogin(); 224 ConfigureAutoLogin();
225 } 225 }
226 226
227 void ExistingUserController::UpdateLoginDisplay( 227 void ExistingUserController::UpdateLoginDisplay(
228 const user_manager::UserList& users) { 228 const user_manager::UserList& users) {
229 bool show_users_on_signin; 229 bool show_users_on_signin;
230 user_manager::UserList filtered_users; 230 user_manager::UserList filtered_users;
231 231
232 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, 232 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn,
233 &show_users_on_signin); 233 &show_users_on_signin);
234 for (auto* user : users) { 234 for (auto* user : users) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 content::BrowserThread::PostDelayedTask( 315 content::BrowserThread::PostDelayedTask(
316 content::BrowserThread::IO, FROM_HERE, 316 content::BrowserThread::IO, FROM_HERE,
317 base::Bind(&TransferContextAuthenticationsOnIOThread, 317 base::Bind(&TransferContextAuthenticationsOnIOThread,
318 base::RetainedRef(signin_profile_context_getter), 318 base::RetainedRef(signin_profile_context_getter),
319 base::RetainedRef(browser_process_context_getter)), 319 base::RetainedRef(browser_process_context_getter)),
320 base::TimeDelta::FromMilliseconds(kAuthCacheTransferDelayMs)); 320 base::TimeDelta::FromMilliseconds(kAuthCacheTransferDelayMs));
321 } 321 }
322 } 322 }
323 323
324 //////////////////////////////////////////////////////////////////////////////// 324 ////////////////////////////////////////////////////////////////////////////////
325 // ExistingUserController, ArcKioskAppManager::ArcKioskAppManagerObserver
326 // implementation:
327 //
328
329 void ExistingUserController::OnArcKioskAppsChanged() {
330 ConfigureAutoLogin();
331 }
332 ////////////////////////////////////////////////////////////////////////////////
325 // ExistingUserController, private: 333 // ExistingUserController, private:
326 334
327 ExistingUserController::~ExistingUserController() { 335 ExistingUserController::~ExistingUserController() {
328 UserSessionManager::GetInstance()->DelegateDeleted(this); 336 UserSessionManager::GetInstance()->DelegateDeleted(this);
329 337
330 if (current_controller_ == this) { 338 if (current_controller_ == this) {
331 current_controller_ = nullptr; 339 current_controller_ = nullptr;
332 } else { 340 } else {
333 NOTREACHED() << "More than one controller are alive."; 341 NOTREACHED() << "More than one controller are alive.";
334 } 342 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 void ExistingUserController::MigrateUserData(const std::string& old_password) { 436 void ExistingUserController::MigrateUserData(const std::string& old_password) {
429 // LoginPerformer instance has state of the user so it should exist. 437 // LoginPerformer instance has state of the user so it should exist.
430 if (login_performer_.get()) { 438 if (login_performer_.get()) {
431 VLOG(1) << "Migrate the existing cryptohome to new password."; 439 VLOG(1) << "Migrate the existing cryptohome to new password.";
432 login_performer_->RecoverEncryptedData(old_password); 440 login_performer_->RecoverEncryptedData(old_password);
433 } 441 }
434 } 442 }
435 443
436 void ExistingUserController::OnSigninScreenReady() { 444 void ExistingUserController::OnSigninScreenReady() {
437 signin_screen_ready_ = true; 445 signin_screen_ready_ = true;
438 StartPublicSessionAutoLoginTimer(); 446 StartAutoLoginTimer();
439 } 447 }
440 448
441 void ExistingUserController::OnStartEnterpriseEnrollment() { 449 void ExistingUserController::OnStartEnterpriseEnrollment() {
442 if (KioskAppManager::Get()->IsConsumerKioskDeviceWithAutoLaunch()) { 450 if (KioskAppManager::Get()->IsConsumerKioskDeviceWithAutoLaunch()) {
443 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto " 451 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto "
444 "launch is set."; 452 "launch is set.";
445 return; 453 return;
446 } 454 }
447 455
448 DeviceSettingsService::Get()->GetOwnershipStatusAsync( 456 DeviceSettingsService::Get()->GetOwnershipStatusAsync(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 content::BrowserThread::UI, FROM_HERE, 597 content::BrowserThread::UI, FROM_HERE,
590 base::Bind(&SessionManagerClient::StopSession, 598 base::Bind(&SessionManagerClient::StopSession,
591 base::Unretained(DBusThreadManager::Get()-> 599 base::Unretained(DBusThreadManager::Get()->
592 GetSessionManagerClient())), 600 GetSessionManagerClient())),
593 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); 601 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs));
594 } else if (failure.reason() == AuthFailure::TPM_ERROR) { 602 } else if (failure.reason() == AuthFailure::TPM_ERROR) {
595 ShowTPMError(); 603 ShowTPMError();
596 } else if (last_login_attempt_account_id_ == user_manager::GuestAccountId()) { 604 } else if (last_login_attempt_account_id_ == user_manager::GuestAccountId()) {
597 // Show no errors, just re-enable input. 605 // Show no errors, just re-enable input.
598 login_display_->ClearAndEnablePassword(); 606 login_display_->ClearAndEnablePassword();
599 StartPublicSessionAutoLoginTimer(); 607 StartAutoLoginTimer();
600 } else { 608 } else {
601 // Check networking after trying to login in case user is 609 // Check networking after trying to login in case user is
602 // cached locally or the local admin account. 610 // cached locally or the local admin account.
603 const bool is_known_user = user_manager::UserManager::Get()->IsKnownUser( 611 const bool is_known_user = user_manager::UserManager::Get()->IsKnownUser(
604 last_login_attempt_account_id_); 612 last_login_attempt_account_id_);
605 if (!network_state_helper_->IsConnected()) { 613 if (!network_state_helper_->IsConnected()) {
606 if (is_known_user) 614 if (is_known_user)
607 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); 615 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
608 else 616 else
609 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); 617 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error);
610 } else { 618 } else {
611 // TODO(nkostylev): Cleanup rest of ClientLogin related code. 619 // TODO(nkostylev): Cleanup rest of ClientLogin related code.
612 if (!is_known_user) 620 if (!is_known_user)
613 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); 621 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error);
614 else 622 else
615 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); 623 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
616 } 624 }
617 if (auth_flow_offline_) 625 if (auth_flow_offline_)
618 UMA_HISTOGRAM_BOOLEAN("Login.OfflineFailure.IsKnownUser", is_known_user); 626 UMA_HISTOGRAM_BOOLEAN("Login.OfflineFailure.IsKnownUser", is_known_user);
619 627
620 login_display_->ClearAndEnablePassword(); 628 login_display_->ClearAndEnablePassword();
621 StartPublicSessionAutoLoginTimer(); 629 StartAutoLoginTimer();
622 } 630 }
623 631
624 // Reset user flow to default, so that special flow will not affect next 632 // Reset user flow to default, so that special flow will not affect next
625 // attempt. 633 // attempt.
626 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_); 634 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_);
627 635
628 if (auth_status_consumer_) 636 if (auth_status_consumer_)
629 auth_status_consumer_->OnAuthFailure(failure); 637 auth_status_consumer_->OnAuthFailure(failure);
630 638
631 // Clear the recorded displayed email so it won't affect any future attempts. 639 // Clear the recorded displayed email so it won't affect any future attempts.
(...skipping 14 matching lines...) Expand all
646 654
647 // Login performer will be gone so cache this value to use 655 // Login performer will be gone so cache this value to use
648 // once profile is loaded. 656 // once profile is loaded.
649 password_changed_ = login_performer_->password_changed(); 657 password_changed_ = login_performer_->password_changed();
650 auth_mode_ = login_performer_->auth_mode(); 658 auth_mode_ = login_performer_->auth_mode();
651 659
652 ChromeUserManager::Get() 660 ChromeUserManager::Get()
653 ->GetUserFlow(user_context.GetAccountId()) 661 ->GetUserFlow(user_context.GetAccountId())
654 ->HandleLoginSuccess(user_context); 662 ->HandleLoginSuccess(user_context);
655 663
656 StopPublicSessionAutoLoginTimer(); 664 StopAutoLoginTimer();
657 665
658 // Truth table of |has_auth_cookies|: 666 // Truth table of |has_auth_cookies|:
659 // Regular SAML 667 // Regular SAML
660 // /ServiceLogin T T 668 // /ServiceLogin T T
661 // /ChromeOsEmbeddedSetup F T 669 // /ChromeOsEmbeddedSetup F T
662 // Bootstrap experiment F N/A 670 // Bootstrap experiment F N/A
663 const bool has_auth_cookies = 671 const bool has_auth_cookies =
664 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && 672 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION &&
665 (user_context.GetAccessToken().empty() || 673 (user_context.GetAccessToken().empty() ||
666 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML) && 674 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML) &&
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 793
786 //////////////////////////////////////////////////////////////////////////////// 794 ////////////////////////////////////////////////////////////////////////////////
787 // ExistingUserController, private: 795 // ExistingUserController, private:
788 796
789 void ExistingUserController::DeviceSettingsChanged() { 797 void ExistingUserController::DeviceSettingsChanged() {
790 // If login was already completed, we should avoid any signin screen 798 // If login was already completed, we should avoid any signin screen
791 // transitions, see http://crbug.com/461604 for example. 799 // transitions, see http://crbug.com/461604 for example.
792 if (host_ != nullptr && !login_display_->is_signin_completed()) { 800 if (host_ != nullptr && !login_display_->is_signin_completed()) {
793 // Signed settings or user list changed. Notify views and update them. 801 // Signed settings or user list changed. Notify views and update them.
794 UpdateLoginDisplay(user_manager::UserManager::Get()->GetUsers()); 802 UpdateLoginDisplay(user_manager::UserManager::Get()->GetUsers());
795 ConfigurePublicSessionAutoLogin(); 803 ConfigureAutoLogin();
796 } 804 }
797 } 805 }
798 806
799 LoginPerformer::AuthorizationMode ExistingUserController::auth_mode() const { 807 LoginPerformer::AuthorizationMode ExistingUserController::auth_mode() const {
800 if (login_performer_) 808 if (login_performer_)
801 return login_performer_->auth_mode(); 809 return login_performer_->auth_mode();
802 810
803 return auth_mode_; 811 return auth_mode_;
804 } 812 }
805 813
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 const bool auto_start = false; 915 const bool auto_start = false;
908 host_->StartAppLaunch(app_id, diagnostic_mode, auto_start); 916 host_->StartAppLaunch(app_id, diagnostic_mode, auto_start);
909 } 917 }
910 918
911 void ExistingUserController::LoginAsArcKioskApp(const AccountId& account_id) { 919 void ExistingUserController::LoginAsArcKioskApp(const AccountId& account_id) {
912 login_performer_.reset(nullptr); 920 login_performer_.reset(nullptr);
913 login_performer_.reset(new ChromeLoginPerformer(this)); 921 login_performer_.reset(new ChromeLoginPerformer(this));
914 login_performer_->LoginAsArcKioskAccount(account_id); 922 login_performer_->LoginAsArcKioskAccount(account_id);
915 } 923 }
916 924
917 void ExistingUserController::ConfigurePublicSessionAutoLogin() { 925 void ExistingUserController::ConfigureAutoLogin() {
918 std::string auto_login_account_id; 926 std::string auto_login_account_id;
919 cros_settings_->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, 927 cros_settings_->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId,
920 &auto_login_account_id); 928 &auto_login_account_id);
921 const std::vector<policy::DeviceLocalAccount> device_local_accounts = 929 const std::vector<policy::DeviceLocalAccount> device_local_accounts =
922 policy::GetDeviceLocalAccounts(cros_settings_); 930 policy::GetDeviceLocalAccounts(cros_settings_);
923 931
924 public_session_auto_login_account_id_ = EmptyAccountId(); 932 public_session_auto_login_account_id_ = EmptyAccountId();
925 for (std::vector<policy::DeviceLocalAccount>::const_iterator 933 for (std::vector<policy::DeviceLocalAccount>::const_iterator
926 it = device_local_accounts.begin(); 934 it = device_local_accounts.begin();
927 it != device_local_accounts.end(); ++it) { 935 it != device_local_accounts.end(); ++it) {
928 if (it->account_id == auto_login_account_id) { 936 if (it->account_id == auto_login_account_id) {
929 public_session_auto_login_account_id_ = 937 public_session_auto_login_account_id_ =
930 AccountId::FromUserEmail(it->user_id); 938 AccountId::FromUserEmail(it->user_id);
931 break; 939 break;
932 } 940 }
933 } 941 }
934 942
935 const user_manager::User* user = user_manager::UserManager::Get()->FindUser( 943 const user_manager::User* public_session_user =
936 public_session_auto_login_account_id_); 944 user_manager::UserManager::Get()->FindUser(
937 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) 945 public_session_auto_login_account_id_);
946 if (!public_session_user ||
947 public_session_user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
938 public_session_auto_login_account_id_ = EmptyAccountId(); 948 public_session_auto_login_account_id_ = EmptyAccountId();
Nikita (slow) 2016/11/18 15:12:58 nit: {}
Sergey Poromov 2016/11/18 15:47:26 Done.
939 949
940 if (!cros_settings_->GetInteger( 950 arc_kiosk_auto_login_account_id_ =
941 kAccountsPrefDeviceLocalAccountAutoLoginDelay, 951 ArcKioskAppManager::Get()->GetAutoLaunchAccountId();
942 &public_session_auto_login_delay_)) { 952 const user_manager::User* arc_kiosk_user =
943 public_session_auto_login_delay_ = 0; 953 user_manager::UserManager::Get()->FindUser(
954 arc_kiosk_auto_login_account_id_);
955 if (!arc_kiosk_user ||
956 arc_kiosk_user->GetType() != user_manager::USER_TYPE_ARC_KIOSK_APP)
957 arc_kiosk_auto_login_account_id_ = EmptyAccountId();
Nikita (slow) 2016/11/18 15:12:58 nit: {}
Sergey Poromov 2016/11/18 15:47:26 Done.
958
959 if (!cros_settings_->GetInteger(kAccountsPrefDeviceLocalAccountAutoLoginDelay,
960 &auto_login_delay_)) {
961 auto_login_delay_ = 0;
944 } 962 }
945 963
946 if (public_session_auto_login_account_id_.is_valid()) 964 if (public_session_auto_login_account_id_.is_valid() ||
Nikita (slow) 2016/11/18 15:12:58 nit: {}
Sergey Poromov 2016/11/18 15:47:26 Done.
947 StartPublicSessionAutoLoginTimer(); 965 arc_kiosk_auto_login_account_id_.is_valid())
966 StartAutoLoginTimer();
948 else 967 else
949 StopPublicSessionAutoLoginTimer(); 968 StopAutoLoginTimer();
950 } 969 }
951 970
952 void ExistingUserController::ResetPublicSessionAutoLoginTimer() { 971 void ExistingUserController::ResetPublicSessionAutoLoginTimer() {
Nikita (slow) 2016/11/18 15:12:58 nit: rename
Sergey Poromov 2016/11/18 15:47:26 Done.
953 // Only restart the auto-login timer if it's already running. 972 // Only restart the auto-login timer if it's already running.
954 if (auto_login_timer_ && auto_login_timer_->IsRunning()) { 973 if (auto_login_timer_ && auto_login_timer_->IsRunning()) {
955 StopPublicSessionAutoLoginTimer(); 974 StopAutoLoginTimer();
956 StartPublicSessionAutoLoginTimer(); 975 StartAutoLoginTimer();
957 } 976 }
958 } 977 }
959 978
960 void ExistingUserController::OnPublicSessionAutoLoginTimerFire() { 979 void ExistingUserController::OnPublicSessionAutoLoginTimerFire() {
961 CHECK(signin_screen_ready_ && 980 CHECK(signin_screen_ready_ &&
962 public_session_auto_login_account_id_.is_valid()); 981 public_session_auto_login_account_id_.is_valid());
963 Login(UserContext(user_manager::USER_TYPE_PUBLIC_ACCOUNT, 982 Login(UserContext(user_manager::USER_TYPE_PUBLIC_ACCOUNT,
964 public_session_auto_login_account_id_), 983 public_session_auto_login_account_id_),
965 SigninSpecifics()); 984 SigninSpecifics());
966 } 985 }
967 986
968 void ExistingUserController::StopPublicSessionAutoLoginTimer() { 987 void ExistingUserController::OnArcKioskAutoLoginTimerFire() {
988 CHECK(signin_screen_ready_ && (arc_kiosk_auto_login_account_id_.is_valid()));
989 Login(UserContext(user_manager::USER_TYPE_ARC_KIOSK_APP,
990 arc_kiosk_auto_login_account_id_),
991 SigninSpecifics());
992 }
993
994 void ExistingUserController::StopAutoLoginTimer() {
969 if (auto_login_timer_) 995 if (auto_login_timer_)
970 auto_login_timer_->Stop(); 996 auto_login_timer_->Stop();
971 } 997 }
972 998
973 void ExistingUserController::StartPublicSessionAutoLoginTimer() { 999 void ExistingUserController::StartAutoLoginTimer() {
974 if (!signin_screen_ready_ || is_login_in_progress_ || 1000 if (!signin_screen_ready_ || is_login_in_progress_ ||
975 !public_session_auto_login_account_id_.is_valid()) { 1001 (!public_session_auto_login_account_id_.is_valid() &&
1002 !arc_kiosk_auto_login_account_id_.is_valid())) {
976 return; 1003 return;
977 } 1004 }
978 1005
979 // Start the auto-login timer. 1006 // Start the auto-login timer.
980 if (!auto_login_timer_) 1007 if (!auto_login_timer_)
981 auto_login_timer_.reset(new base::OneShotTimer); 1008 auto_login_timer_.reset(new base::OneShotTimer);
982 1009
983 auto_login_timer_->Start( 1010 if (public_session_auto_login_account_id_.is_valid()) {
984 FROM_HERE, 1011 auto_login_timer_->Start(
985 base::TimeDelta::FromMilliseconds( 1012 FROM_HERE, base::TimeDelta::FromMilliseconds(auto_login_delay_),
986 public_session_auto_login_delay_), 1013 base::Bind(&ExistingUserController::OnPublicSessionAutoLoginTimerFire,
987 base::Bind( 1014 weak_factory_.GetWeakPtr()));
988 &ExistingUserController::OnPublicSessionAutoLoginTimerFire, 1015 } else {
989 weak_factory_.GetWeakPtr())); 1016 auto_login_timer_->Start(
1017 FROM_HERE, base::TimeDelta::FromMilliseconds(auto_login_delay_),
1018 base::Bind(&ExistingUserController::OnArcKioskAutoLoginTimerFire,
1019 weak_factory_.GetWeakPtr()));
1020 }
990 } 1021 }
991 1022
992 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { 1023 gfx::NativeWindow ExistingUserController::GetNativeWindow() const {
993 return host_->GetNativeWindow(); 1024 return host_->GetNativeWindow();
994 } 1025 }
995 1026
996 void ExistingUserController::ShowError(int error_id, 1027 void ExistingUserController::ShowError(int error_id,
997 const std::string& details) { 1028 const std::string& details) {
998 VLOG(1) << details; 1029 VLOG(1) << details;
999 HelpAppLauncher::HelpTopic help_topic_id; 1030 HelpAppLauncher::HelpTopic help_topic_id;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 // Disable clicking on other windows and status tray. 1098 // Disable clicking on other windows and status tray.
1068 login_display_->SetUIEnabled(false); 1099 login_display_->SetUIEnabled(false);
1069 1100
1070 if (last_login_attempt_account_id_ != user_context.GetAccountId()) { 1101 if (last_login_attempt_account_id_ != user_context.GetAccountId()) {
1071 last_login_attempt_account_id_ = user_context.GetAccountId(); 1102 last_login_attempt_account_id_ = user_context.GetAccountId();
1072 num_login_attempts_ = 0; 1103 num_login_attempts_ = 0;
1073 } 1104 }
1074 num_login_attempts_++; 1105 num_login_attempts_++;
1075 1106
1076 // Stop the auto-login timer when attempting login. 1107 // Stop the auto-login timer when attempting login.
1077 StopPublicSessionAutoLoginTimer(); 1108 StopAutoLoginTimer();
1078 } 1109 }
1079 1110
1080 void ExistingUserController::PerformLoginFinishedActions( 1111 void ExistingUserController::PerformLoginFinishedActions(
Nikita (slow) 2016/11/18 15:12:58 nit: rename method param
Sergey Poromov 2016/11/18 15:47:26 Done.
1081 bool start_public_session_timer) { 1112 bool start_public_session_timer) {
1082 is_login_in_progress_ = false; 1113 is_login_in_progress_ = false;
1083 1114
1084 // Reenable clicking on other windows and status area. 1115 // Reenable clicking on other windows and status area.
1085 login_display_->SetUIEnabled(true); 1116 login_display_->SetUIEnabled(true);
1086 1117
1087 if (start_public_session_timer) 1118 if (start_public_session_timer)
1088 StartPublicSessionAutoLoginTimer(); 1119 StartAutoLoginTimer();
1089 } 1120 }
1090 1121
1091 void ExistingUserController::ContinueLoginIfDeviceNotDisabled( 1122 void ExistingUserController::ContinueLoginIfDeviceNotDisabled(
1092 const base::Closure& continuation) { 1123 const base::Closure& continuation) {
1093 // Disable clicking on other windows and status tray. 1124 // Disable clicking on other windows and status tray.
1094 login_display_->SetUIEnabled(false); 1125 login_display_->SetUIEnabled(false);
1095 1126
1096 // Stop the auto-login timer. 1127 // Stop the auto-login timer.
1097 StopPublicSessionAutoLoginTimer(); 1128 StopAutoLoginTimer();
1098 1129
1099 // Wait for the |cros_settings_| to become either trusted or permanently 1130 // Wait for the |cros_settings_| to become either trusted or permanently
1100 // untrusted. 1131 // untrusted.
1101 const CrosSettingsProvider::TrustedStatus status = 1132 const CrosSettingsProvider::TrustedStatus status =
1102 cros_settings_->PrepareTrustedValues(base::Bind( 1133 cros_settings_->PrepareTrustedValues(base::Bind(
1103 &ExistingUserController::ContinueLoginIfDeviceNotDisabled, 1134 &ExistingUserController::ContinueLoginIfDeviceNotDisabled,
1104 weak_factory_.GetWeakPtr(), 1135 weak_factory_.GetWeakPtr(),
1105 continuation)); 1136 continuation));
1106 if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED) 1137 if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED)
1107 return; 1138 return;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 } 1250 }
1220 1251
1221 // Regular user or supervised user login. 1252 // Regular user or supervised user login.
1222 1253
1223 if (!user_context.HasCredentials()) { 1254 if (!user_context.HasCredentials()) {
1224 // If credentials are missing, refuse to log in. 1255 // If credentials are missing, refuse to log in.
1225 1256
1226 // Reenable clicking on other windows and status area. 1257 // Reenable clicking on other windows and status area.
1227 login_display_->SetUIEnabled(true); 1258 login_display_->SetUIEnabled(true);
1228 // Restart the auto-login timer. 1259 // Restart the auto-login timer.
1229 StartPublicSessionAutoLoginTimer(); 1260 StartAutoLoginTimer();
1230 } 1261 }
1231 1262
1232 PerformPreLoginActions(user_context); 1263 PerformPreLoginActions(user_context);
1233 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); 1264 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL);
1234 } 1265 }
1235 1266
1236 void ExistingUserController::OnBootstrapUserContextInitialized( 1267 void ExistingUserController::OnBootstrapUserContextInitialized(
1237 bool success, 1268 bool success,
1238 const UserContext& user_context) { 1269 const UserContext& user_context) {
1239 if (!success) { 1270 if (!success) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 } 1308 }
1278 1309
1279 // Otherwise, show the unrecoverable cryptohome error UI and ask user's 1310 // Otherwise, show the unrecoverable cryptohome error UI and ask user's
1280 // permission to collect a feedback. 1311 // permission to collect a feedback.
1281 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); 1312 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE);
1282 VLOG(1) << "Show unrecoverable cryptohome error dialog."; 1313 VLOG(1) << "Show unrecoverable cryptohome error dialog.";
1283 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); 1314 login_display_->ShowUnrecoverableCrypthomeErrorDialog();
1284 } 1315 }
1285 1316
1286 } // namespace chromeos 1317 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698