| 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 617 } |
| 618 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, params); | 618 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, params); |
| 619 login_display_->OnFadeOut(); | 619 login_display_->OnFadeOut(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 void ExistingUserController::ShowResetScreen() { | 622 void ExistingUserController::ShowResetScreen() { |
| 623 host_->StartWizard(WizardController::kResetScreenName, NULL); | 623 host_->StartWizard(WizardController::kResetScreenName, NULL); |
| 624 login_display_->OnFadeOut(); | 624 login_display_->OnFadeOut(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 void ExistingUserController::ShowTPMErrorAndScheduleReboot() { | 627 void ExistingUserController::ShowTPMError() { |
| 628 login_display_->SetUIEnabled(false); | 628 login_display_->SetUIEnabled(false); |
| 629 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); | 629 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); |
| 630 reboot_timer_.Start( | |
| 631 FROM_HERE, | |
| 632 base::TimeDelta::FromMilliseconds(kCriticalErrorRebootDelayMs), | |
| 633 this, | |
| 634 &ExistingUserController::OnRebootTimeElapsed); | |
| 635 } | |
| 636 | |
| 637 void ExistingUserController::OnRebootTimeElapsed() { | |
| 638 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | |
| 639 } | 630 } |
| 640 | 631 |
| 641 //////////////////////////////////////////////////////////////////////////////// | 632 //////////////////////////////////////////////////////////////////////////////// |
| 642 // ExistingUserController, LoginPerformer::Delegate implementation: | 633 // ExistingUserController, LoginPerformer::Delegate implementation: |
| 643 // | 634 // |
| 644 | 635 |
| 645 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { | 636 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { |
| 646 is_login_in_progress_ = false; | 637 is_login_in_progress_ = false; |
| 647 offline_failed_ = true; | 638 offline_failed_ = true; |
| 648 | 639 |
| 649 guest_mode_url_ = GURL::EmptyGURL(); | 640 guest_mode_url_ = GURL::EmptyGURL(); |
| 650 std::string error = failure.GetErrorString(); | 641 std::string error = failure.GetErrorString(); |
| 651 | 642 |
| 652 if (failure.reason() == LoginFailure::OWNER_REQUIRED) { | 643 if (failure.reason() == LoginFailure::OWNER_REQUIRED) { |
| 653 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); | 644 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); |
| 654 content::BrowserThread::PostDelayedTask( | 645 content::BrowserThread::PostDelayedTask( |
| 655 content::BrowserThread::UI, FROM_HERE, | 646 content::BrowserThread::UI, FROM_HERE, |
| 656 base::Bind(&SessionManagerClient::StopSession, | 647 base::Bind(&SessionManagerClient::StopSession, |
| 657 base::Unretained(DBusThreadManager::Get()-> | 648 base::Unretained(DBusThreadManager::Get()-> |
| 658 GetSessionManagerClient())), | 649 GetSessionManagerClient())), |
| 659 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); | 650 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); |
| 660 } else if (failure.reason() == LoginFailure::TPM_ERROR) { | 651 } else if (failure.reason() == LoginFailure::TPM_ERROR) { |
| 661 ShowTPMErrorAndScheduleReboot(); | 652 ShowTPMError(); |
| 662 } else if (!online_succeeded_for_.empty()) { | 653 } else if (!online_succeeded_for_.empty()) { |
| 663 ShowGaiaPasswordChanged(online_succeeded_for_); | 654 ShowGaiaPasswordChanged(online_succeeded_for_); |
| 664 } else { | 655 } else { |
| 665 // Check networking after trying to login in case user is | 656 // Check networking after trying to login in case user is |
| 666 // cached locally or the local admin account. | 657 // cached locally or the local admin account. |
| 667 bool is_known_user = | 658 bool is_known_user = |
| 668 UserManager::Get()->IsKnownUser(last_login_attempt_username_); | 659 UserManager::Get()->IsKnownUser(last_login_attempt_username_); |
| 669 if (!ConnectivityStateHelper::Get()->IsConnected()) { | 660 if (!ConnectivityStateHelper::Get()->IsConnected()) { |
| 670 if (is_known_user) | 661 if (is_known_user) |
| 671 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); | 662 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 // changed. | 995 // changed. |
| 1005 UserManager::Get()->SaveUserOAuthStatus( | 996 UserManager::Get()->SaveUserOAuthStatus( |
| 1006 username, | 997 username, |
| 1007 User::OAUTH2_TOKEN_STATUS_INVALID); | 998 User::OAUTH2_TOKEN_STATUS_INVALID); |
| 1008 | 999 |
| 1009 login_display_->SetUIEnabled(true); | 1000 login_display_->SetUIEnabled(true); |
| 1010 login_display_->ShowGaiaPasswordChanged(username); | 1001 login_display_->ShowGaiaPasswordChanged(username); |
| 1011 } | 1002 } |
| 1012 | 1003 |
| 1013 } // namespace chromeos | 1004 } // namespace chromeos |
| OLD | NEW |