| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 16 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 18 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
| 19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 20 #include "base/values.h" | 21 #include "base/values.h" |
| 21 #include "base/version.h" | 22 #include "base/version.h" |
| 22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 24 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 // LoginPerformer instance has state of the user so it should exist. | 600 // LoginPerformer instance has state of the user so it should exist. |
| 600 if (login_performer_.get()) | 601 if (login_performer_.get()) |
| 601 login_performer_->ResyncEncryptedData(); | 602 login_performer_->ResyncEncryptedData(); |
| 602 } | 603 } |
| 603 | 604 |
| 604 void ExistingUserController::SetDisplayEmail(const std::string& email) { | 605 void ExistingUserController::SetDisplayEmail(const std::string& email) { |
| 605 display_email_ = email; | 606 display_email_ = email; |
| 606 } | 607 } |
| 607 | 608 |
| 608 void ExistingUserController::ShowWrongHWIDScreen() { | 609 void ExistingUserController::ShowWrongHWIDScreen() { |
| 609 host_->StartWizard(WizardController::kWrongHWIDScreenName, NULL); | 610 scoped_ptr<DictionaryValue> params; |
| 611 host_->StartWizard(WizardController::kWrongHWIDScreenName, params.Pass()); |
| 610 login_display_->OnFadeOut(); | 612 login_display_->OnFadeOut(); |
| 611 } | 613 } |
| 612 | 614 |
| 613 void ExistingUserController::Signout() { | 615 void ExistingUserController::Signout() { |
| 614 NOTREACHED(); | 616 NOTREACHED(); |
| 615 } | 617 } |
| 616 | 618 |
| 617 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( | 619 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( |
| 618 DeviceSettingsService::OwnershipStatus status, | 620 DeviceSettingsService::OwnershipStatus status, |
| 619 bool current_user_is_owner) { | 621 bool current_user_is_owner) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 631 ShowEnrollmentScreen(false, std::string()); | 633 ShowEnrollmentScreen(false, std::string()); |
| 632 } else { | 634 } else { |
| 633 // OwnershipService::GetStatusAsync is supposed to return either | 635 // OwnershipService::GetStatusAsync is supposed to return either |
| 634 // OWNERSHIP_NONE or OWNERSHIP_TAKEN. | 636 // OWNERSHIP_NONE or OWNERSHIP_TAKEN. |
| 635 NOTREACHED(); | 637 NOTREACHED(); |
| 636 } | 638 } |
| 637 } | 639 } |
| 638 | 640 |
| 639 void ExistingUserController::ShowEnrollmentScreen(bool is_auto_enrollment, | 641 void ExistingUserController::ShowEnrollmentScreen(bool is_auto_enrollment, |
| 640 const std::string& user) { | 642 const std::string& user) { |
| 641 DictionaryValue* params = NULL; | 643 scoped_ptr<DictionaryValue> params; |
| 642 if (is_auto_enrollment) { | 644 if (is_auto_enrollment) { |
| 643 params = new DictionaryValue; | 645 params.reset(new DictionaryValue()); |
| 644 params->SetBoolean("is_auto_enrollment", true); | 646 params->SetBoolean("is_auto_enrollment", true); |
| 645 params->SetString("user", user); | 647 params->SetString("user", user); |
| 646 } | 648 } |
| 647 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, params); | 649 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, |
| 650 params.Pass()); |
| 648 login_display_->OnFadeOut(); | 651 login_display_->OnFadeOut(); |
| 649 } | 652 } |
| 650 | 653 |
| 651 void ExistingUserController::ShowResetScreen() { | 654 void ExistingUserController::ShowResetScreen() { |
| 652 host_->StartWizard(WizardController::kResetScreenName, NULL); | 655 scoped_ptr<DictionaryValue> params; |
| 656 host_->StartWizard(WizardController::kResetScreenName, params.Pass()); |
| 653 login_display_->OnFadeOut(); | 657 login_display_->OnFadeOut(); |
| 654 } | 658 } |
| 655 | 659 |
| 656 void ExistingUserController::ShowTPMError() { | 660 void ExistingUserController::ShowTPMError() { |
| 657 login_display_->SetUIEnabled(false); | 661 login_display_->SetUIEnabled(false); |
| 658 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); | 662 login_display_->ShowErrorScreen(LoginDisplay::TPM_ERROR); |
| 659 } | 663 } |
| 660 | 664 |
| 661 //////////////////////////////////////////////////////////////////////////////// | 665 //////////////////////////////////////////////////////////////////////////////// |
| 662 // ExistingUserController, LoginPerformer::Delegate implementation: | 666 // ExistingUserController, LoginPerformer::Delegate implementation: |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // Wait for login attempt to end, if it hasn't yet. | 892 // Wait for login attempt to end, if it hasn't yet. |
| 889 if (offline_failed_ && !is_login_in_progress_) | 893 if (offline_failed_ && !is_login_in_progress_) |
| 890 ShowGaiaPasswordChanged(username); | 894 ShowGaiaPasswordChanged(username); |
| 891 } | 895 } |
| 892 } | 896 } |
| 893 | 897 |
| 894 //////////////////////////////////////////////////////////////////////////////// | 898 //////////////////////////////////////////////////////////////////////////////// |
| 895 // ExistingUserController, private: | 899 // ExistingUserController, private: |
| 896 | 900 |
| 897 void ExistingUserController::ActivateWizard(const std::string& screen_name) { | 901 void ExistingUserController::ActivateWizard(const std::string& screen_name) { |
| 898 host_->StartWizard(screen_name, NULL); | 902 scoped_ptr<DictionaryValue> params; |
| 903 host_->StartWizard(screen_name, params.Pass()); |
| 899 } | 904 } |
| 900 | 905 |
| 901 void ExistingUserController::ConfigurePublicSessionAutoLogin() { | 906 void ExistingUserController::ConfigurePublicSessionAutoLogin() { |
| 902 if (!cros_settings_->GetString( | 907 if (!cros_settings_->GetString( |
| 903 kAccountsPrefDeviceLocalAccountAutoLoginId, | 908 kAccountsPrefDeviceLocalAccountAutoLoginId, |
| 904 &public_session_auto_login_username_)) { | 909 &public_session_auto_login_username_)) { |
| 905 public_session_auto_login_username_.clear(); | 910 public_session_auto_login_username_.clear(); |
| 906 } | 911 } |
| 907 if (!cros_settings_->GetInteger( | 912 if (!cros_settings_->GetInteger( |
| 908 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 913 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 // changed. | 1100 // changed. |
| 1096 UserManager::Get()->SaveUserOAuthStatus( | 1101 UserManager::Get()->SaveUserOAuthStatus( |
| 1097 username, | 1102 username, |
| 1098 User::OAUTH2_TOKEN_STATUS_INVALID); | 1103 User::OAUTH2_TOKEN_STATUS_INVALID); |
| 1099 | 1104 |
| 1100 login_display_->SetUIEnabled(true); | 1105 login_display_->SetUIEnabled(true); |
| 1101 login_display_->ShowGaiaPasswordChanged(username); | 1106 login_display_->ShowGaiaPasswordChanged(username); |
| 1102 } | 1107 } |
| 1103 | 1108 |
| 1104 } // namespace chromeos | 1109 } // namespace chromeos |
| OLD | NEW |