| 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 <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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void ExistingUserController::UpdateLoginDisplay(const UserList& users) { | 192 void ExistingUserController::UpdateLoginDisplay(const UserList& users) { |
| 193 bool show_users_on_signin; | 193 bool show_users_on_signin; |
| 194 UserList filtered_users; | 194 UserList filtered_users; |
| 195 | 195 |
| 196 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | 196 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, |
| 197 &show_users_on_signin); | 197 &show_users_on_signin); |
| 198 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 198 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
| 199 // TODO(xiyuan): Clean user profile whose email is not in whitelist. | 199 // TODO(xiyuan): Clean user profile whose email is not in whitelist. |
| 200 bool meets_locally_managed_requirements = | 200 bool meets_locally_managed_requirements = |
| 201 (*it)->GetType() != user_manager::USER_TYPE_LOCALLY_MANAGED || | 201 (*it)->GetType() != user_manager::USER_TYPE_LOCALLY_MANAGED || |
| 202 UserManager::Get()->AreLocallyManagedUsersAllowed(); | 202 GetUserManager()->AreLocallyManagedUsersAllowed(); |
| 203 bool meets_whitelist_requirements = | 203 bool meets_whitelist_requirements = |
| 204 LoginUtils::IsWhitelisted((*it)->email(), NULL) || | 204 LoginUtils::IsWhitelisted((*it)->email(), NULL) || |
| 205 (*it)->GetType() != user_manager::USER_TYPE_REGULAR; | 205 (*it)->GetType() != user_manager::USER_TYPE_REGULAR; |
| 206 | 206 |
| 207 // Public session accounts are always shown on login screen. | 207 // Public session accounts are always shown on login screen. |
| 208 bool meets_show_users_requirements = | 208 bool meets_show_users_requirements = |
| 209 show_users_on_signin || | 209 show_users_on_signin || |
| 210 (*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 210 (*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
| 211 if (meets_locally_managed_requirements && | 211 if (meets_locally_managed_requirements && |
| 212 meets_whitelist_requirements && | 212 meets_whitelist_requirements && |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 offline_failed_ = false; | 424 offline_failed_ = false; |
| 425 online_succeeded_for_.clear(); | 425 online_succeeded_for_.clear(); |
| 426 } | 426 } |
| 427 num_login_attempts_++; | 427 num_login_attempts_++; |
| 428 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); | 428 PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void ExistingUserController::PerformLogin( | 431 void ExistingUserController::PerformLogin( |
| 432 const UserContext& user_context, | 432 const UserContext& user_context, |
| 433 LoginPerformer::AuthorizationMode auth_mode) { | 433 LoginPerformer::AuthorizationMode auth_mode) { |
| 434 UserManager::Get()->GetUserFlow(last_login_attempt_username_)-> | 434 GetUserManager()->GetUserFlow(last_login_attempt_username_)->set_host(host_); |
| 435 set_host(host_); | |
| 436 | 435 |
| 437 BootTimesLoader::Get()->RecordLoginAttempted(); | 436 BootTimesLoader::Get()->RecordLoginAttempted(); |
| 438 | 437 |
| 439 // Disable UI while loading user profile. | 438 // Disable UI while loading user profile. |
| 440 login_display_->SetUIEnabled(false); | 439 login_display_->SetUIEnabled(false); |
| 441 | 440 |
| 442 // Use the same LoginPerformer for subsequent login as it has state | 441 // Use the same LoginPerformer for subsequent login as it has state |
| 443 // such as Authenticator instance. | 442 // such as Authenticator instance. |
| 444 if (!login_performer_.get() || num_login_attempts_ <= 1) { | 443 if (!login_performer_.get() || num_login_attempts_ <= 1) { |
| 445 LoginPerformer::Delegate* delegate = this; | 444 LoginPerformer::Delegate* delegate = this; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 473 // Only one instance of LoginPerformer should exist at a time. | 472 // Only one instance of LoginPerformer should exist at a time. |
| 474 login_performer_.reset(NULL); | 473 login_performer_.reset(NULL); |
| 475 login_performer_.reset(new LoginPerformer(this)); | 474 login_performer_.reset(new LoginPerformer(this)); |
| 476 is_login_in_progress_ = true; | 475 is_login_in_progress_ = true; |
| 477 login_performer_->LoginRetailMode(); | 476 login_performer_->LoginRetailMode(); |
| 478 SendAccessibilityAlert( | 477 SendAccessibilityAlert( |
| 479 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); | 478 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); |
| 480 } | 479 } |
| 481 | 480 |
| 482 void ExistingUserController::LoginAsGuest() { | 481 void ExistingUserController::LoginAsGuest() { |
| 483 if (is_login_in_progress_ || UserManager::Get()->IsUserLoggedIn()) | 482 if (is_login_in_progress_ || GetUserManager()->IsUserLoggedIn()) |
| 484 return; | 483 return; |
| 485 | 484 |
| 486 // Stop the auto-login timer when attempting login. | 485 // Stop the auto-login timer when attempting login. |
| 487 StopPublicSessionAutoLoginTimer(); | 486 StopPublicSessionAutoLoginTimer(); |
| 488 | 487 |
| 489 // Disable clicking on other windows. | 488 // Disable clicking on other windows. |
| 490 login_display_->SetUIEnabled(false); | 489 login_display_->SetUIEnabled(false); |
| 491 | 490 |
| 492 CrosSettingsProvider::TrustedStatus status = | 491 CrosSettingsProvider::TrustedStatus status = |
| 493 cros_settings_->PrepareTrustedValues( | 492 cros_settings_->PrepareTrustedValues( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 } | 532 } |
| 534 | 533 |
| 535 void ExistingUserController::MigrateUserData(const std::string& old_password) { | 534 void ExistingUserController::MigrateUserData(const std::string& old_password) { |
| 536 // LoginPerformer instance has state of the user so it should exist. | 535 // LoginPerformer instance has state of the user so it should exist. |
| 537 if (login_performer_.get()) | 536 if (login_performer_.get()) |
| 538 login_performer_->RecoverEncryptedData(old_password); | 537 login_performer_->RecoverEncryptedData(old_password); |
| 539 } | 538 } |
| 540 | 539 |
| 541 void ExistingUserController::LoginAsPublicAccount( | 540 void ExistingUserController::LoginAsPublicAccount( |
| 542 const std::string& username) { | 541 const std::string& username) { |
| 543 if (is_login_in_progress_ || UserManager::Get()->IsUserLoggedIn()) | 542 if (is_login_in_progress_ || GetUserManager()->IsUserLoggedIn()) |
| 544 return; | 543 return; |
| 545 | 544 |
| 546 // Stop the auto-login timer when attempting login. | 545 // Stop the auto-login timer when attempting login. |
| 547 StopPublicSessionAutoLoginTimer(); | 546 StopPublicSessionAutoLoginTimer(); |
| 548 | 547 |
| 549 // Disable clicking on other windows. | 548 // Disable clicking on other windows. |
| 550 login_display_->SetUIEnabled(false); | 549 login_display_->SetUIEnabled(false); |
| 551 | 550 |
| 552 CrosSettingsProvider::TrustedStatus status = | 551 CrosSettingsProvider::TrustedStatus status = |
| 553 cros_settings_->PrepareTrustedValues( | 552 cros_settings_->PrepareTrustedValues( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 564 return; | 563 return; |
| 565 } | 564 } |
| 566 | 565 |
| 567 // If device policy is not verified yet, this function will be called again | 566 // If device policy is not verified yet, this function will be called again |
| 568 // when verification finishes. | 567 // when verification finishes. |
| 569 if (status != CrosSettingsProvider::TRUSTED) | 568 if (status != CrosSettingsProvider::TRUSTED) |
| 570 return; | 569 return; |
| 571 | 570 |
| 572 // If there is no public account with the given |username|, logging in is not | 571 // If there is no public account with the given |username|, logging in is not |
| 573 // possible. | 572 // possible. |
| 574 const User* user = UserManager::Get()->FindUser(username); | 573 const User* user = GetUserManager()->FindUser(username); |
| 575 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 574 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
| 576 // Re-enable clicking on other windows. | 575 // Re-enable clicking on other windows. |
| 577 login_display_->SetUIEnabled(true); | 576 login_display_->SetUIEnabled(true); |
| 578 StartPublicSessionAutoLoginTimer(); | 577 StartPublicSessionAutoLoginTimer(); |
| 579 return; | 578 return; |
| 580 } | 579 } |
| 581 | 580 |
| 582 // Only one instance of LoginPerformer should exist at a time. | 581 // Only one instance of LoginPerformer should exist at a time. |
| 583 login_performer_.reset(NULL); | 582 login_performer_.reset(NULL); |
| 584 login_performer_.reset(new LoginPerformer(this)); | 583 login_performer_.reset(new LoginPerformer(this)); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 // ExistingUserController, LoginPerformer::Delegate implementation: | 704 // ExistingUserController, LoginPerformer::Delegate implementation: |
| 706 // | 705 // |
| 707 | 706 |
| 708 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { | 707 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { |
| 709 is_login_in_progress_ = false; | 708 is_login_in_progress_ = false; |
| 710 offline_failed_ = true; | 709 offline_failed_ = true; |
| 711 | 710 |
| 712 guest_mode_url_ = GURL::EmptyGURL(); | 711 guest_mode_url_ = GURL::EmptyGURL(); |
| 713 std::string error = failure.GetErrorString(); | 712 std::string error = failure.GetErrorString(); |
| 714 | 713 |
| 715 if (UserManager::Get()->GetUserFlow(last_login_attempt_username_)-> | 714 if (GetUserManager() |
| 716 HandleLoginFailure(failure)) { | 715 ->GetUserFlow(last_login_attempt_username_) |
| 716 ->HandleLoginFailure(failure)) { |
| 717 login_display_->SetUIEnabled(true); | 717 login_display_->SetUIEnabled(true); |
| 718 return; | 718 return; |
| 719 } | 719 } |
| 720 | 720 |
| 721 if (failure.reason() == LoginFailure::OWNER_REQUIRED) { | 721 if (failure.reason() == LoginFailure::OWNER_REQUIRED) { |
| 722 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); | 722 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); |
| 723 content::BrowserThread::PostDelayedTask( | 723 content::BrowserThread::PostDelayedTask( |
| 724 content::BrowserThread::UI, FROM_HERE, | 724 content::BrowserThread::UI, FROM_HERE, |
| 725 base::Bind(&SessionManagerClient::StopSession, | 725 base::Bind(&SessionManagerClient::StopSession, |
| 726 base::Unretained(DBusThreadManager::Get()-> | 726 base::Unretained(DBusThreadManager::Get()-> |
| 727 GetSessionManagerClient())), | 727 GetSessionManagerClient())), |
| 728 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); | 728 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); |
| 729 } else if (failure.reason() == LoginFailure::TPM_ERROR) { | 729 } else if (failure.reason() == LoginFailure::TPM_ERROR) { |
| 730 ShowTPMError(); | 730 ShowTPMError(); |
| 731 } else if (!online_succeeded_for_.empty()) { | 731 } else if (!online_succeeded_for_.empty()) { |
| 732 ShowGaiaPasswordChanged(online_succeeded_for_); | 732 ShowGaiaPasswordChanged(online_succeeded_for_); |
| 733 } else { | 733 } else { |
| 734 // Check networking after trying to login in case user is | 734 // Check networking after trying to login in case user is |
| 735 // cached locally or the local admin account. | 735 // cached locally or the local admin account. |
| 736 bool is_known_user = | 736 bool is_known_user = |
| 737 UserManager::Get()->IsKnownUser(last_login_attempt_username_); | 737 GetUserManager()->IsKnownUser(last_login_attempt_username_); |
| 738 if (!network_state_helper_->IsConnected()) { | 738 if (!network_state_helper_->IsConnected()) { |
| 739 if (is_known_user) | 739 if (is_known_user) |
| 740 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 740 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
| 741 else | 741 else |
| 742 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); | 742 ShowError(IDS_LOGIN_ERROR_OFFLINE_FAILED_NETWORK_NOT_CONNECTED, error); |
| 743 } else { | 743 } else { |
| 744 // TODO(nkostylev): Cleanup rest of ClientLogin related code. | 744 // TODO(nkostylev): Cleanup rest of ClientLogin related code. |
| 745 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && | 745 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && |
| 746 failure.error().state() == | 746 failure.error().state() == |
| 747 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) { | 747 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) { |
| 748 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error); | 748 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error); |
| 749 } else { | 749 } else { |
| 750 if (!is_known_user) | 750 if (!is_known_user) |
| 751 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); | 751 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); |
| 752 else | 752 else |
| 753 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 753 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
| 754 } | 754 } |
| 755 } | 755 } |
| 756 // Reenable clicking on other windows and status area. | 756 // Reenable clicking on other windows and status area. |
| 757 login_display_->SetUIEnabled(true); | 757 login_display_->SetUIEnabled(true); |
| 758 login_display_->ClearAndEnablePassword(); | 758 login_display_->ClearAndEnablePassword(); |
| 759 StartPublicSessionAutoLoginTimer(); | 759 StartPublicSessionAutoLoginTimer(); |
| 760 } | 760 } |
| 761 | 761 |
| 762 // Reset user flow to default, so that special flow will not affect next | 762 // Reset user flow to default, so that special flow will not affect next |
| 763 // attempt. | 763 // attempt. |
| 764 UserManager::Get()->ResetUserFlow(last_login_attempt_username_); | 764 GetUserManager()->ResetUserFlow(last_login_attempt_username_); |
| 765 | 765 |
| 766 if (login_status_consumer_) | 766 if (login_status_consumer_) |
| 767 login_status_consumer_->OnLoginFailure(failure); | 767 login_status_consumer_->OnLoginFailure(failure); |
| 768 | 768 |
| 769 // Clear the recorded displayed email so it won't affect any future attempts. | 769 // Clear the recorded displayed email so it won't affect any future attempts. |
| 770 display_email_.clear(); | 770 display_email_.clear(); |
| 771 } | 771 } |
| 772 | 772 |
| 773 void ExistingUserController::OnLoginSuccess(const UserContext& user_context) { | 773 void ExistingUserController::OnLoginSuccess(const UserContext& user_context) { |
| 774 is_login_in_progress_ = false; | 774 is_login_in_progress_ = false; |
| 775 offline_failed_ = false; | 775 offline_failed_ = false; |
| 776 login_display_->set_signin_completed(true); | 776 login_display_->set_signin_completed(true); |
| 777 | 777 |
| 778 // Login performer will be gone so cache this value to use | 778 // Login performer will be gone so cache this value to use |
| 779 // once profile is loaded. | 779 // once profile is loaded. |
| 780 password_changed_ = login_performer_->password_changed(); | 780 password_changed_ = login_performer_->password_changed(); |
| 781 auth_mode_ = login_performer_->auth_mode(); | 781 auth_mode_ = login_performer_->auth_mode(); |
| 782 | 782 |
| 783 UserManager::Get()->GetUserFlow(user_context.GetUserID())-> | 783 GetUserManager()->GetUserFlow(user_context.GetUserID())->HandleLoginSuccess( |
| 784 HandleLoginSuccess(user_context); | 784 user_context); |
| 785 | 785 |
| 786 StopPublicSessionAutoLoginTimer(); | 786 StopPublicSessionAutoLoginTimer(); |
| 787 | 787 |
| 788 const bool has_auth_cookies = | 788 const bool has_auth_cookies = |
| 789 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && | 789 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && |
| 790 user_context.GetAuthCode().empty(); | 790 user_context.GetAuthCode().empty(); |
| 791 | 791 |
| 792 // LoginPerformer instance will delete itself once online auth result is OK. | 792 // LoginPerformer instance will delete itself once online auth result is OK. |
| 793 // In case of failure it'll bring up ScreenLock and ask for | 793 // In case of failure it'll bring up ScreenLock and ask for |
| 794 // correct password/display error message. | 794 // correct password/display error message. |
| 795 // Even in case when following online,offline protocol and returning | 795 // Even in case when following online,offline protocol and returning |
| 796 // requests_pending = false, let LoginPerformer delete itself. | 796 // requests_pending = false, let LoginPerformer delete itself. |
| 797 login_performer_->set_delegate(NULL); | 797 login_performer_->set_delegate(NULL); |
| 798 ignore_result(login_performer_.release()); | 798 ignore_result(login_performer_.release()); |
| 799 | 799 |
| 800 // Update user's displayed email. | 800 // Update user's displayed email. |
| 801 if (!display_email_.empty()) { | 801 if (!display_email_.empty()) { |
| 802 UserManager::Get()->SaveUserDisplayEmail(user_context.GetUserID(), | 802 GetUserManager()->SaveUserDisplayEmail(user_context.GetUserID(), |
| 803 display_email_); | 803 display_email_); |
| 804 display_email_.clear(); | 804 display_email_.clear(); |
| 805 } | 805 } |
| 806 | 806 |
| 807 // Will call OnProfilePrepared() in the end. | 807 // Will call OnProfilePrepared() in the end. |
| 808 LoginUtils::Get()->PrepareProfile(user_context, | 808 LoginUtils::Get()->PrepareProfile(user_context, |
| 809 has_auth_cookies, | 809 has_auth_cookies, |
| 810 false, // Start session for user. | 810 false, // Start session for user. |
| 811 this); | 811 this); |
| 812 } | 812 } |
| 813 | 813 |
| 814 void ExistingUserController::OnProfilePrepared(Profile* profile) { | 814 void ExistingUserController::OnProfilePrepared(Profile* profile) { |
| 815 // Reenable clicking on other windows and status area. | 815 // Reenable clicking on other windows and status area. |
| 816 login_display_->SetUIEnabled(true); | 816 login_display_->SetUIEnabled(true); |
| 817 | 817 |
| 818 UserManager* user_manager = UserManager::Get(); | 818 UserManager* user_manager = GetUserManager(); |
| 819 if (user_manager->IsCurrentUserNew() && | 819 if (user_manager->IsCurrentUserNew() && |
| 820 user_manager->IsLoggedInAsLocallyManagedUser()) { | 820 user_manager->IsLoggedInAsLocallyManagedUser()) { |
| 821 // Supervised users should launch into empty desktop on first run. | 821 // Supervised users should launch into empty desktop on first run. |
| 822 CommandLine::ForCurrentProcess()->AppendSwitch(::switches::kSilentLaunch); | 822 CommandLine::ForCurrentProcess()->AppendSwitch(::switches::kSilentLaunch); |
| 823 } | 823 } |
| 824 | 824 |
| 825 if (user_manager->IsCurrentUserNew() && | 825 if (user_manager->IsCurrentUserNew() && |
| 826 !user_manager->GetCurrentUserFlow()->ShouldSkipPostLoginScreens() && | 826 !user_manager->GetCurrentUserFlow()->ShouldSkipPostLoginScreens() && |
| 827 !WizardController::default_controller()->skip_post_login_screens()) { | 827 !WizardController::default_controller()->skip_post_login_screens()) { |
| 828 // Don't specify start URLs if the administrator has configured the start | 828 // Don't specify start URLs if the administrator has configured the start |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 | 871 |
| 872 // Must not proceed without signature verification. | 872 // Must not proceed without signature verification. |
| 873 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( | 873 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( |
| 874 base::Bind(&ExistingUserController::OnPasswordChangeDetected, | 874 base::Bind(&ExistingUserController::OnPasswordChangeDetected, |
| 875 weak_factory_.GetWeakPtr()))) { | 875 weak_factory_.GetWeakPtr()))) { |
| 876 // Value of owner email is still not verified. | 876 // Value of owner email is still not verified. |
| 877 // Another attempt will be invoked after verification completion. | 877 // Another attempt will be invoked after verification completion. |
| 878 return; | 878 return; |
| 879 } | 879 } |
| 880 | 880 |
| 881 if (UserManager::Get()->GetUserFlow(last_login_attempt_username_)-> | 881 if (GetUserManager() |
| 882 HandlePasswordChangeDetected()) { | 882 ->GetUserFlow(last_login_attempt_username_) |
| 883 ->HandlePasswordChangeDetected()) { |
| 883 return; | 884 return; |
| 884 } | 885 } |
| 885 | 886 |
| 886 // True if user has already made an attempt to enter old password and failed. | 887 // True if user has already made an attempt to enter old password and failed. |
| 887 bool show_invalid_old_password_error = | 888 bool show_invalid_old_password_error = |
| 888 login_performer_->password_changed_callback_count() > 1; | 889 login_performer_->password_changed_callback_count() > 1; |
| 889 | 890 |
| 890 // Note: We allow owner using "full sync" mode which will recreate | 891 // Note: We allow owner using "full sync" mode which will recreate |
| 891 // cryptohome and deal with owner private key being lost. This also allows | 892 // cryptohome and deal with owner private key being lost. This also allows |
| 892 // us to recover from a lost owner password/homedir. | 893 // us to recover from a lost owner password/homedir. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 ShowGaiaPasswordChanged(username); | 944 ShowGaiaPasswordChanged(username); |
| 944 } | 945 } |
| 945 } | 946 } |
| 946 | 947 |
| 947 //////////////////////////////////////////////////////////////////////////////// | 948 //////////////////////////////////////////////////////////////////////////////// |
| 948 // ExistingUserController, private: | 949 // ExistingUserController, private: |
| 949 | 950 |
| 950 void ExistingUserController::DeviceSettingsChanged() { | 951 void ExistingUserController::DeviceSettingsChanged() { |
| 951 if (host_ != NULL) { | 952 if (host_ != NULL) { |
| 952 // Signed settings or user list changed. Notify views and update them. | 953 // Signed settings or user list changed. Notify views and update them. |
| 953 UpdateLoginDisplay(chromeos::UserManager::Get()->GetUsers()); | 954 UpdateLoginDisplay(chromeos::GetUserManager()->GetUsers()); |
| 954 ConfigurePublicSessionAutoLogin(); | 955 ConfigurePublicSessionAutoLogin(); |
| 955 return; | 956 return; |
| 956 } | 957 } |
| 957 } | 958 } |
| 958 | 959 |
| 959 void ExistingUserController::ActivateWizard(const std::string& screen_name) { | 960 void ExistingUserController::ActivateWizard(const std::string& screen_name) { |
| 960 scoped_ptr<base::DictionaryValue> params; | 961 scoped_ptr<base::DictionaryValue> params; |
| 961 host_->StartWizard(screen_name, params.Pass()); | 962 host_->StartWizard(screen_name, params.Pass()); |
| 962 } | 963 } |
| 963 | 964 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 986 for (std::vector<policy::DeviceLocalAccount>::const_iterator | 987 for (std::vector<policy::DeviceLocalAccount>::const_iterator |
| 987 it = device_local_accounts.begin(); | 988 it = device_local_accounts.begin(); |
| 988 it != device_local_accounts.end(); ++it) { | 989 it != device_local_accounts.end(); ++it) { |
| 989 if (it->account_id == auto_login_account_id) { | 990 if (it->account_id == auto_login_account_id) { |
| 990 public_session_auto_login_username_ = it->user_id; | 991 public_session_auto_login_username_ = it->user_id; |
| 991 break; | 992 break; |
| 992 } | 993 } |
| 993 } | 994 } |
| 994 | 995 |
| 995 const User* user = | 996 const User* user = |
| 996 UserManager::Get()->FindUser(public_session_auto_login_username_); | 997 GetUserManager()->FindUser(public_session_auto_login_username_); |
| 997 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 998 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| 998 public_session_auto_login_username_.clear(); | 999 public_session_auto_login_username_.clear(); |
| 999 | 1000 |
| 1000 if (!cros_settings_->GetInteger( | 1001 if (!cros_settings_->GetInteger( |
| 1001 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 1002 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
| 1002 &public_session_auto_login_delay_)) { | 1003 &public_session_auto_login_delay_)) { |
| 1003 public_session_auto_login_delay_ = 0; | 1004 public_session_auto_login_delay_ = 0; |
| 1004 } | 1005 } |
| 1005 | 1006 |
| 1006 if (!public_session_auto_login_username_.empty()) | 1007 if (!public_session_auto_login_username_.empty()) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 } | 1051 } |
| 1051 | 1052 |
| 1052 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 1053 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
| 1053 return host_->GetNativeWindow(); | 1054 return host_->GetNativeWindow(); |
| 1054 } | 1055 } |
| 1055 | 1056 |
| 1056 void ExistingUserController::InitializeStartUrls() const { | 1057 void ExistingUserController::InitializeStartUrls() const { |
| 1057 std::vector<std::string> start_urls; | 1058 std::vector<std::string> start_urls; |
| 1058 | 1059 |
| 1059 const base::ListValue *urls; | 1060 const base::ListValue *urls; |
| 1060 UserManager* user_manager = UserManager::Get(); | 1061 UserManager* user_manager = GetUserManager(); |
| 1061 bool can_show_getstarted_guide = | 1062 bool can_show_getstarted_guide = |
| 1062 user_manager->GetActiveUser()->GetType() == | 1063 user_manager->GetActiveUser()->GetType() == |
| 1063 user_manager::USER_TYPE_REGULAR && | 1064 user_manager::USER_TYPE_REGULAR && |
| 1064 !user_manager->IsCurrentUserNonCryptohomeDataEphemeral(); | 1065 !user_manager->IsCurrentUserNonCryptohomeDataEphemeral(); |
| 1065 if (user_manager->IsLoggedInAsDemoUser()) { | 1066 if (user_manager->IsLoggedInAsDemoUser()) { |
| 1066 if (CrosSettings::Get()->GetList(kStartUpUrls, &urls)) { | 1067 if (CrosSettings::Get()->GetList(kStartUpUrls, &urls)) { |
| 1067 // The retail mode user will get start URLs from a special policy if it is | 1068 // The retail mode user will get start URLs from a special policy if it is |
| 1068 // set. | 1069 // set. |
| 1069 for (base::ListValue::const_iterator it = urls->begin(); | 1070 for (base::ListValue::const_iterator it = urls->begin(); |
| 1070 it != urls->end(); ++it) { | 1071 it != urls->end(); ++it) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 default: | 1126 default: |
| 1126 help_topic_id = is_offline ? | 1127 help_topic_id = is_offline ? |
| 1127 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE : | 1128 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE : |
| 1128 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; | 1129 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; |
| 1129 break; | 1130 break; |
| 1130 } | 1131 } |
| 1131 | 1132 |
| 1132 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { | 1133 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { |
| 1133 if (num_login_attempts_ > 1) { | 1134 if (num_login_attempts_ > 1) { |
| 1134 const User* user = | 1135 const User* user = |
| 1135 UserManager::Get()->FindUser(last_login_attempt_username_); | 1136 GetUserManager()->FindUser(last_login_attempt_username_); |
| 1136 if (user && (user->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED)) | 1137 if (user && (user->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED)) |
| 1137 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; | 1138 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; |
| 1138 } | 1139 } |
| 1139 } | 1140 } |
| 1140 | 1141 |
| 1141 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id); | 1142 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id); |
| 1142 } | 1143 } |
| 1143 | 1144 |
| 1144 void ExistingUserController::ShowGaiaPasswordChanged( | 1145 void ExistingUserController::ShowGaiaPasswordChanged( |
| 1145 const std::string& username) { | 1146 const std::string& username) { |
| 1146 // Invalidate OAuth token, since it can't be correct after password is | 1147 // Invalidate OAuth token, since it can't be correct after password is |
| 1147 // changed. | 1148 // changed. |
| 1148 UserManager::Get()->SaveUserOAuthStatus( | 1149 GetUserManager()->SaveUserOAuthStatus(username, |
| 1149 username, | 1150 User::OAUTH2_TOKEN_STATUS_INVALID); |
| 1150 User::OAUTH2_TOKEN_STATUS_INVALID); | |
| 1151 | 1151 |
| 1152 login_display_->SetUIEnabled(true); | 1152 login_display_->SetUIEnabled(true); |
| 1153 login_display_->ShowGaiaPasswordChanged(username); | 1153 login_display_->ShowGaiaPasswordChanged(username); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 void ExistingUserController::SendAccessibilityAlert( | 1156 void ExistingUserController::SendAccessibilityAlert( |
| 1157 const std::string& alert_text) { | 1157 const std::string& alert_text) { |
| 1158 AccessibilityAlertInfo event(ProfileHelper::GetSigninProfile(), alert_text); | 1158 AccessibilityAlertInfo event(ProfileHelper::GetSigninProfile(), alert_text); |
| 1159 SendControlAccessibilityNotification( | 1159 SendControlAccessibilityNotification( |
| 1160 ui::AX_EVENT_VALUE_CHANGED, &event); | 1160 ui::AX_EVENT_VALUE_CHANGED, &event); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 } // namespace chromeos | 1163 } // namespace chromeos |
| OLD | NEW |