| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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(); |
| 447 } |
| 448 |
| 449 void ExistingUserController::OnGaiaScreenReady() { |
| 450 // Treat GAIA screen same as signin screen. |
| 451 signin_screen_ready_ = true; |
| 452 StartAutoLoginTimer(); |
| 439 } | 453 } |
| 440 | 454 |
| 441 void ExistingUserController::OnStartEnterpriseEnrollment() { | 455 void ExistingUserController::OnStartEnterpriseEnrollment() { |
| 442 if (KioskAppManager::Get()->IsConsumerKioskDeviceWithAutoLaunch()) { | 456 if (KioskAppManager::Get()->IsConsumerKioskDeviceWithAutoLaunch()) { |
| 443 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto " | 457 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto " |
| 444 "launch is set."; | 458 "launch is set."; |
| 445 return; | 459 return; |
| 446 } | 460 } |
| 447 | 461 |
| 448 DeviceSettingsService::Get()->GetOwnershipStatusAsync( | 462 DeviceSettingsService::Get()->GetOwnershipStatusAsync( |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 content::BrowserThread::UI, FROM_HERE, | 603 content::BrowserThread::UI, FROM_HERE, |
| 590 base::Bind(&SessionManagerClient::StopSession, | 604 base::Bind(&SessionManagerClient::StopSession, |
| 591 base::Unretained(DBusThreadManager::Get()-> | 605 base::Unretained(DBusThreadManager::Get()-> |
| 592 GetSessionManagerClient())), | 606 GetSessionManagerClient())), |
| 593 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); | 607 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); |
| 594 } else if (failure.reason() == AuthFailure::TPM_ERROR) { | 608 } else if (failure.reason() == AuthFailure::TPM_ERROR) { |
| 595 ShowTPMError(); | 609 ShowTPMError(); |
| 596 } else if (last_login_attempt_account_id_ == user_manager::GuestAccountId()) { | 610 } else if (last_login_attempt_account_id_ == user_manager::GuestAccountId()) { |
| 597 // Show no errors, just re-enable input. | 611 // Show no errors, just re-enable input. |
| 598 login_display_->ClearAndEnablePassword(); | 612 login_display_->ClearAndEnablePassword(); |
| 599 StartPublicSessionAutoLoginTimer(); | 613 StartAutoLoginTimer(); |
| 600 } else { | 614 } else { |
| 601 // Check networking after trying to login in case user is | 615 // Check networking after trying to login in case user is |
| 602 // cached locally or the local admin account. | 616 // cached locally or the local admin account. |
| 603 const bool is_known_user = user_manager::UserManager::Get()->IsKnownUser( | 617 const bool is_known_user = user_manager::UserManager::Get()->IsKnownUser( |
| 604 last_login_attempt_account_id_); | 618 last_login_attempt_account_id_); |
| 605 if (!network_state_helper_->IsConnected()) { | 619 if (!network_state_helper_->IsConnected()) { |
| 606 if (is_known_user) | 620 if (is_known_user) |
| 607 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 621 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
| 608 else | 622 else |
| 609 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); | 623 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); |
| 610 } else { | 624 } else { |
| 611 // TODO(nkostylev): Cleanup rest of ClientLogin related code. | 625 // TODO(nkostylev): Cleanup rest of ClientLogin related code. |
| 612 if (!is_known_user) | 626 if (!is_known_user) |
| 613 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); | 627 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); |
| 614 else | 628 else |
| 615 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 629 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
| 616 } | 630 } |
| 617 if (auth_flow_offline_) | 631 if (auth_flow_offline_) |
| 618 UMA_HISTOGRAM_BOOLEAN("Login.OfflineFailure.IsKnownUser", is_known_user); | 632 UMA_HISTOGRAM_BOOLEAN("Login.OfflineFailure.IsKnownUser", is_known_user); |
| 619 | 633 |
| 620 login_display_->ClearAndEnablePassword(); | 634 login_display_->ClearAndEnablePassword(); |
| 621 StartPublicSessionAutoLoginTimer(); | 635 StartAutoLoginTimer(); |
| 622 } | 636 } |
| 623 | 637 |
| 624 // Reset user flow to default, so that special flow will not affect next | 638 // Reset user flow to default, so that special flow will not affect next |
| 625 // attempt. | 639 // attempt. |
| 626 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_); | 640 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_); |
| 627 | 641 |
| 628 if (auth_status_consumer_) | 642 if (auth_status_consumer_) |
| 629 auth_status_consumer_->OnAuthFailure(failure); | 643 auth_status_consumer_->OnAuthFailure(failure); |
| 630 | 644 |
| 631 // Clear the recorded displayed email so it won't affect any future attempts. | 645 // Clear the recorded displayed email so it won't affect any future attempts. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 646 | 660 |
| 647 // Login performer will be gone so cache this value to use | 661 // Login performer will be gone so cache this value to use |
| 648 // once profile is loaded. | 662 // once profile is loaded. |
| 649 password_changed_ = login_performer_->password_changed(); | 663 password_changed_ = login_performer_->password_changed(); |
| 650 auth_mode_ = login_performer_->auth_mode(); | 664 auth_mode_ = login_performer_->auth_mode(); |
| 651 | 665 |
| 652 ChromeUserManager::Get() | 666 ChromeUserManager::Get() |
| 653 ->GetUserFlow(user_context.GetAccountId()) | 667 ->GetUserFlow(user_context.GetAccountId()) |
| 654 ->HandleLoginSuccess(user_context); | 668 ->HandleLoginSuccess(user_context); |
| 655 | 669 |
| 656 StopPublicSessionAutoLoginTimer(); | 670 StopAutoLoginTimer(); |
| 657 | 671 |
| 658 // Truth table of |has_auth_cookies|: | 672 // Truth table of |has_auth_cookies|: |
| 659 // Regular SAML | 673 // Regular SAML |
| 660 // /ServiceLogin T T | 674 // /ServiceLogin T T |
| 661 // /ChromeOsEmbeddedSetup F T | 675 // /ChromeOsEmbeddedSetup F T |
| 662 // Bootstrap experiment F N/A | 676 // Bootstrap experiment F N/A |
| 663 const bool has_auth_cookies = | 677 const bool has_auth_cookies = |
| 664 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && | 678 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && |
| 665 (user_context.GetAccessToken().empty() || | 679 (user_context.GetAccessToken().empty() || |
| 666 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML) && | 680 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML) && |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 799 |
| 786 //////////////////////////////////////////////////////////////////////////////// | 800 //////////////////////////////////////////////////////////////////////////////// |
| 787 // ExistingUserController, private: | 801 // ExistingUserController, private: |
| 788 | 802 |
| 789 void ExistingUserController::DeviceSettingsChanged() { | 803 void ExistingUserController::DeviceSettingsChanged() { |
| 790 // If login was already completed, we should avoid any signin screen | 804 // If login was already completed, we should avoid any signin screen |
| 791 // transitions, see http://crbug.com/461604 for example. | 805 // transitions, see http://crbug.com/461604 for example. |
| 792 if (host_ != nullptr && !login_display_->is_signin_completed()) { | 806 if (host_ != nullptr && !login_display_->is_signin_completed()) { |
| 793 // Signed settings or user list changed. Notify views and update them. | 807 // Signed settings or user list changed. Notify views and update them. |
| 794 UpdateLoginDisplay(user_manager::UserManager::Get()->GetUsers()); | 808 UpdateLoginDisplay(user_manager::UserManager::Get()->GetUsers()); |
| 795 ConfigurePublicSessionAutoLogin(); | 809 ConfigureAutoLogin(); |
| 796 } | 810 } |
| 797 } | 811 } |
| 798 | 812 |
| 799 LoginPerformer::AuthorizationMode ExistingUserController::auth_mode() const { | 813 LoginPerformer::AuthorizationMode ExistingUserController::auth_mode() const { |
| 800 if (login_performer_) | 814 if (login_performer_) |
| 801 return login_performer_->auth_mode(); | 815 return login_performer_->auth_mode(); |
| 802 | 816 |
| 803 return auth_mode_; | 817 return auth_mode_; |
| 804 } | 818 } |
| 805 | 819 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 const bool auto_start = false; | 921 const bool auto_start = false; |
| 908 host_->StartAppLaunch(app_id, diagnostic_mode, auto_start); | 922 host_->StartAppLaunch(app_id, diagnostic_mode, auto_start); |
| 909 } | 923 } |
| 910 | 924 |
| 911 void ExistingUserController::LoginAsArcKioskApp(const AccountId& account_id) { | 925 void ExistingUserController::LoginAsArcKioskApp(const AccountId& account_id) { |
| 912 login_performer_.reset(nullptr); | 926 login_performer_.reset(nullptr); |
| 913 login_performer_.reset(new ChromeLoginPerformer(this)); | 927 login_performer_.reset(new ChromeLoginPerformer(this)); |
| 914 login_performer_->LoginAsArcKioskAccount(account_id); | 928 login_performer_->LoginAsArcKioskAccount(account_id); |
| 915 } | 929 } |
| 916 | 930 |
| 917 void ExistingUserController::ConfigurePublicSessionAutoLogin() { | 931 void ExistingUserController::ConfigureAutoLogin() { |
| 918 std::string auto_login_account_id; | 932 std::string auto_login_account_id; |
| 919 cros_settings_->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, | 933 cros_settings_->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, |
| 920 &auto_login_account_id); | 934 &auto_login_account_id); |
| 921 const std::vector<policy::DeviceLocalAccount> device_local_accounts = | 935 const std::vector<policy::DeviceLocalAccount> device_local_accounts = |
| 922 policy::GetDeviceLocalAccounts(cros_settings_); | 936 policy::GetDeviceLocalAccounts(cros_settings_); |
| 923 | 937 |
| 924 public_session_auto_login_account_id_ = EmptyAccountId(); | 938 public_session_auto_login_account_id_ = EmptyAccountId(); |
| 925 for (std::vector<policy::DeviceLocalAccount>::const_iterator | 939 for (std::vector<policy::DeviceLocalAccount>::const_iterator |
| 926 it = device_local_accounts.begin(); | 940 it = device_local_accounts.begin(); |
| 927 it != device_local_accounts.end(); ++it) { | 941 it != device_local_accounts.end(); ++it) { |
| 928 if (it->account_id == auto_login_account_id) { | 942 if (it->account_id == auto_login_account_id) { |
| 929 public_session_auto_login_account_id_ = | 943 public_session_auto_login_account_id_ = |
| 930 AccountId::FromUserEmail(it->user_id); | 944 AccountId::FromUserEmail(it->user_id); |
| 931 break; | 945 break; |
| 932 } | 946 } |
| 933 } | 947 } |
| 934 | 948 |
| 935 const user_manager::User* user = user_manager::UserManager::Get()->FindUser( | 949 const user_manager::User* public_session_user = |
| 936 public_session_auto_login_account_id_); | 950 user_manager::UserManager::Get()->FindUser( |
| 937 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 951 public_session_auto_login_account_id_); |
| 952 if (!public_session_user || |
| 953 public_session_user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| 938 public_session_auto_login_account_id_ = EmptyAccountId(); | 954 public_session_auto_login_account_id_ = EmptyAccountId(); |
| 939 | 955 |
| 940 if (!cros_settings_->GetInteger( | 956 arc_kiosk_auto_login_account_id_ = |
| 941 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 957 ArcKioskAppManager::Get()->GetAutoLaunchAccountId(); |
| 942 &public_session_auto_login_delay_)) { | 958 const user_manager::User* arc_kiosk_user = |
| 943 public_session_auto_login_delay_ = 0; | 959 user_manager::UserManager::Get()->FindUser( |
| 960 arc_kiosk_auto_login_account_id_); |
| 961 if (!arc_kiosk_user || |
| 962 arc_kiosk_user->GetType() != user_manager::USER_TYPE_ARC_KIOSK_APP) |
| 963 arc_kiosk_auto_login_account_id_ = EmptyAccountId(); |
| 964 |
| 965 if (!cros_settings_->GetInteger(kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
| 966 &auto_login_delay_)) { |
| 967 auto_login_delay_ = 0; |
| 944 } | 968 } |
| 945 | 969 |
| 946 if (public_session_auto_login_account_id_.is_valid()) | 970 if (public_session_auto_login_account_id_.is_valid() || |
| 947 StartPublicSessionAutoLoginTimer(); | 971 arc_kiosk_auto_login_account_id_.is_valid()) |
| 972 StartAutoLoginTimer(); |
| 948 else | 973 else |
| 949 StopPublicSessionAutoLoginTimer(); | 974 StopAutoLoginTimer(); |
| 950 } | 975 } |
| 951 | 976 |
| 952 void ExistingUserController::ResetPublicSessionAutoLoginTimer() { | 977 void ExistingUserController::ResetPublicSessionAutoLoginTimer() { |
| 953 // Only restart the auto-login timer if it's already running. | 978 // Only restart the auto-login timer if it's already running. |
| 954 if (auto_login_timer_ && auto_login_timer_->IsRunning()) { | 979 if (auto_login_timer_ && auto_login_timer_->IsRunning()) { |
| 955 StopPublicSessionAutoLoginTimer(); | 980 StopAutoLoginTimer(); |
| 956 StartPublicSessionAutoLoginTimer(); | 981 StartAutoLoginTimer(); |
| 957 } | 982 } |
| 958 } | 983 } |
| 959 | 984 |
| 960 void ExistingUserController::OnPublicSessionAutoLoginTimerFire() { | 985 void ExistingUserController::OnPublicSessionAutoLoginTimerFire() { |
| 961 CHECK(signin_screen_ready_ && | 986 CHECK(signin_screen_ready_ && |
| 962 public_session_auto_login_account_id_.is_valid()); | 987 public_session_auto_login_account_id_.is_valid()); |
| 963 Login(UserContext(user_manager::USER_TYPE_PUBLIC_ACCOUNT, | 988 Login(UserContext(user_manager::USER_TYPE_PUBLIC_ACCOUNT, |
| 964 public_session_auto_login_account_id_), | 989 public_session_auto_login_account_id_), |
| 965 SigninSpecifics()); | 990 SigninSpecifics()); |
| 966 } | 991 } |
| 967 | 992 |
| 968 void ExistingUserController::StopPublicSessionAutoLoginTimer() { | 993 void ExistingUserController::OnArcKioskAutoLoginTimerFire() { |
| 994 CHECK(signin_screen_ready_ && (arc_kiosk_auto_login_account_id_.is_valid())); |
| 995 Login(UserContext(user_manager::USER_TYPE_ARC_KIOSK_APP, |
| 996 arc_kiosk_auto_login_account_id_), |
| 997 SigninSpecifics()); |
| 998 } |
| 999 |
| 1000 void ExistingUserController::StopAutoLoginTimer() { |
| 969 if (auto_login_timer_) | 1001 if (auto_login_timer_) |
| 970 auto_login_timer_->Stop(); | 1002 auto_login_timer_->Stop(); |
| 971 } | 1003 } |
| 972 | 1004 |
| 973 void ExistingUserController::StartPublicSessionAutoLoginTimer() { | 1005 void ExistingUserController::StartAutoLoginTimer() { |
| 974 if (!signin_screen_ready_ || is_login_in_progress_ || | 1006 if (!signin_screen_ready_ || is_login_in_progress_ || |
| 975 !public_session_auto_login_account_id_.is_valid()) { | 1007 (!public_session_auto_login_account_id_.is_valid() && |
| 1008 !arc_kiosk_auto_login_account_id_.is_valid())) { |
| 976 return; | 1009 return; |
| 977 } | 1010 } |
| 978 | 1011 |
| 979 // Start the auto-login timer. | 1012 // Start the auto-login timer. |
| 980 if (!auto_login_timer_) | 1013 if (!auto_login_timer_) |
| 981 auto_login_timer_.reset(new base::OneShotTimer); | 1014 auto_login_timer_.reset(new base::OneShotTimer); |
| 982 | 1015 |
| 983 auto_login_timer_->Start( | 1016 if (public_session_auto_login_account_id_.is_valid()) { |
| 984 FROM_HERE, | 1017 auto_login_timer_->Start( |
| 985 base::TimeDelta::FromMilliseconds( | 1018 FROM_HERE, base::TimeDelta::FromMilliseconds(auto_login_delay_), |
| 986 public_session_auto_login_delay_), | 1019 base::Bind(&ExistingUserController::OnPublicSessionAutoLoginTimerFire, |
| 987 base::Bind( | 1020 weak_factory_.GetWeakPtr())); |
| 988 &ExistingUserController::OnPublicSessionAutoLoginTimerFire, | 1021 } else { |
| 989 weak_factory_.GetWeakPtr())); | 1022 auto_login_timer_->Start( |
| 1023 FROM_HERE, base::TimeDelta::FromMilliseconds(auto_login_delay_), |
| 1024 base::Bind(&ExistingUserController::OnArcKioskAutoLoginTimerFire, |
| 1025 weak_factory_.GetWeakPtr())); |
| 1026 } |
| 990 } | 1027 } |
| 991 | 1028 |
| 992 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 1029 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
| 993 return host_->GetNativeWindow(); | 1030 return host_->GetNativeWindow(); |
| 994 } | 1031 } |
| 995 | 1032 |
| 996 void ExistingUserController::ShowError(int error_id, | 1033 void ExistingUserController::ShowError(int error_id, |
| 997 const std::string& details) { | 1034 const std::string& details) { |
| 998 VLOG(1) << details; | 1035 VLOG(1) << details; |
| 999 HelpAppLauncher::HelpTopic help_topic_id; | 1036 HelpAppLauncher::HelpTopic help_topic_id; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 // Disable clicking on other windows and status tray. | 1104 // Disable clicking on other windows and status tray. |
| 1068 login_display_->SetUIEnabled(false); | 1105 login_display_->SetUIEnabled(false); |
| 1069 | 1106 |
| 1070 if (last_login_attempt_account_id_ != user_context.GetAccountId()) { | 1107 if (last_login_attempt_account_id_ != user_context.GetAccountId()) { |
| 1071 last_login_attempt_account_id_ = user_context.GetAccountId(); | 1108 last_login_attempt_account_id_ = user_context.GetAccountId(); |
| 1072 num_login_attempts_ = 0; | 1109 num_login_attempts_ = 0; |
| 1073 } | 1110 } |
| 1074 num_login_attempts_++; | 1111 num_login_attempts_++; |
| 1075 | 1112 |
| 1076 // Stop the auto-login timer when attempting login. | 1113 // Stop the auto-login timer when attempting login. |
| 1077 StopPublicSessionAutoLoginTimer(); | 1114 StopAutoLoginTimer(); |
| 1078 } | 1115 } |
| 1079 | 1116 |
| 1080 void ExistingUserController::PerformLoginFinishedActions( | 1117 void ExistingUserController::PerformLoginFinishedActions( |
| 1081 bool start_public_session_timer) { | 1118 bool start_public_session_timer) { |
| 1082 is_login_in_progress_ = false; | 1119 is_login_in_progress_ = false; |
| 1083 | 1120 |
| 1084 // Reenable clicking on other windows and status area. | 1121 // Reenable clicking on other windows and status area. |
| 1085 login_display_->SetUIEnabled(true); | 1122 login_display_->SetUIEnabled(true); |
| 1086 | 1123 |
| 1087 if (start_public_session_timer) | 1124 if (start_public_session_timer) |
| 1088 StartPublicSessionAutoLoginTimer(); | 1125 StartAutoLoginTimer(); |
| 1089 } | 1126 } |
| 1090 | 1127 |
| 1091 void ExistingUserController::ContinueLoginIfDeviceNotDisabled( | 1128 void ExistingUserController::ContinueLoginIfDeviceNotDisabled( |
| 1092 const base::Closure& continuation) { | 1129 const base::Closure& continuation) { |
| 1093 // Disable clicking on other windows and status tray. | 1130 // Disable clicking on other windows and status tray. |
| 1094 login_display_->SetUIEnabled(false); | 1131 login_display_->SetUIEnabled(false); |
| 1095 | 1132 |
| 1096 // Stop the auto-login timer. | 1133 // Stop the auto-login timer. |
| 1097 StopPublicSessionAutoLoginTimer(); | 1134 StopAutoLoginTimer(); |
| 1098 | 1135 |
| 1099 // Wait for the |cros_settings_| to become either trusted or permanently | 1136 // Wait for the |cros_settings_| to become either trusted or permanently |
| 1100 // untrusted. | 1137 // untrusted. |
| 1101 const CrosSettingsProvider::TrustedStatus status = | 1138 const CrosSettingsProvider::TrustedStatus status = |
| 1102 cros_settings_->PrepareTrustedValues(base::Bind( | 1139 cros_settings_->PrepareTrustedValues(base::Bind( |
| 1103 &ExistingUserController::ContinueLoginIfDeviceNotDisabled, | 1140 &ExistingUserController::ContinueLoginIfDeviceNotDisabled, |
| 1104 weak_factory_.GetWeakPtr(), | 1141 weak_factory_.GetWeakPtr(), |
| 1105 continuation)); | 1142 continuation)); |
| 1106 if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED) | 1143 if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED) |
| 1107 return; | 1144 return; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 } | 1256 } |
| 1220 | 1257 |
| 1221 // Regular user or supervised user login. | 1258 // Regular user or supervised user login. |
| 1222 | 1259 |
| 1223 if (!user_context.HasCredentials()) { | 1260 if (!user_context.HasCredentials()) { |
| 1224 // If credentials are missing, refuse to log in. | 1261 // If credentials are missing, refuse to log in. |
| 1225 | 1262 |
| 1226 // Reenable clicking on other windows and status area. | 1263 // Reenable clicking on other windows and status area. |
| 1227 login_display_->SetUIEnabled(true); | 1264 login_display_->SetUIEnabled(true); |
| 1228 // Restart the auto-login timer. | 1265 // Restart the auto-login timer. |
| 1229 StartPublicSessionAutoLoginTimer(); | 1266 StartAutoLoginTimer(); |
| 1230 } | 1267 } |
| 1231 | 1268 |
| 1232 PerformPreLoginActions(user_context); | 1269 PerformPreLoginActions(user_context); |
| 1233 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); | 1270 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); |
| 1234 } | 1271 } |
| 1235 | 1272 |
| 1236 void ExistingUserController::OnBootstrapUserContextInitialized( | 1273 void ExistingUserController::OnBootstrapUserContextInitialized( |
| 1237 bool success, | 1274 bool success, |
| 1238 const UserContext& user_context) { | 1275 const UserContext& user_context) { |
| 1239 if (!success) { | 1276 if (!success) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 } | 1314 } |
| 1278 | 1315 |
| 1279 // Otherwise, show the unrecoverable cryptohome error UI and ask user's | 1316 // Otherwise, show the unrecoverable cryptohome error UI and ask user's |
| 1280 // permission to collect a feedback. | 1317 // permission to collect a feedback. |
| 1281 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); | 1318 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); |
| 1282 VLOG(1) << "Show unrecoverable cryptohome error dialog."; | 1319 VLOG(1) << "Show unrecoverable cryptohome error dialog."; |
| 1283 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); | 1320 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); |
| 1284 } | 1321 } |
| 1285 | 1322 |
| 1286 } // namespace chromeos | 1323 } // namespace chromeos |
| OLD | NEW |