| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 login_performer_.reset(NULL); | 464 login_performer_.reset(NULL); |
| 465 num_login_attempts_ = 0; | 465 num_login_attempts_ = 0; |
| 466 } | 466 } |
| 467 | 467 |
| 468 void ExistingUserController::OnStartEnterpriseEnrollment() { | 468 void ExistingUserController::OnStartEnterpriseEnrollment() { |
| 469 DeviceSettingsService::Get()->GetOwnershipStatusAsync( | 469 DeviceSettingsService::Get()->GetOwnershipStatusAsync( |
| 470 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, | 470 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, |
| 471 weak_factory_.GetWeakPtr())); | 471 weak_factory_.GetWeakPtr())); |
| 472 } | 472 } |
| 473 | 473 |
| 474 void ExistingUserController::OnStartDeviceReset() { |
| 475 ShowResetScreen(); |
| 476 } |
| 477 |
| 474 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( | 478 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( |
| 475 DeviceSettingsService::OwnershipStatus status, | 479 DeviceSettingsService::OwnershipStatus status, |
| 476 bool current_user_is_owner) { | 480 bool current_user_is_owner) { |
| 477 if (status == DeviceSettingsService::OWNERSHIP_NONE) { | 481 if (status == DeviceSettingsService::OWNERSHIP_NONE) { |
| 478 ShowEnrollmentScreen(false, std::string()); | 482 ShowEnrollmentScreen(false, std::string()); |
| 479 } else if (status == DeviceSettingsService::OWNERSHIP_TAKEN) { | 483 } else if (status == DeviceSettingsService::OWNERSHIP_TAKEN) { |
| 480 // On a device that is already owned we might want to allow users to | 484 // On a device that is already owned we might want to allow users to |
| 481 // re-enroll if the policy information is invalid. | 485 // re-enroll if the policy information is invalid. |
| 482 CrosSettingsProvider::TrustedStatus trusted_status = | 486 CrosSettingsProvider::TrustedStatus trusted_status = |
| 483 CrosSettings::Get()->PrepareTrustedValues( | 487 CrosSettings::Get()->PrepareTrustedValues( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 498 DictionaryValue* params = NULL; | 502 DictionaryValue* params = NULL; |
| 499 if (is_auto_enrollment) { | 503 if (is_auto_enrollment) { |
| 500 params = new DictionaryValue; | 504 params = new DictionaryValue; |
| 501 params->SetBoolean("is_auto_enrollment", true); | 505 params->SetBoolean("is_auto_enrollment", true); |
| 502 params->SetString("user", user); | 506 params->SetString("user", user); |
| 503 } | 507 } |
| 504 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, params); | 508 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, params); |
| 505 login_display_->OnFadeOut(); | 509 login_display_->OnFadeOut(); |
| 506 } | 510 } |
| 507 | 511 |
| 512 void ExistingUserController::ShowResetScreen() { |
| 513 host_->StartWizard(WizardController::kResetScreenName, NULL); |
| 514 login_display_->OnFadeOut(); |
| 515 } |
| 516 |
| 508 //////////////////////////////////////////////////////////////////////////////// | 517 //////////////////////////////////////////////////////////////////////////////// |
| 509 // ExistingUserController, LoginPerformer::Delegate implementation: | 518 // ExistingUserController, LoginPerformer::Delegate implementation: |
| 510 // | 519 // |
| 511 | 520 |
| 512 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { | 521 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { |
| 513 is_login_in_progress_ = false; | 522 is_login_in_progress_ = false; |
| 514 offline_failed_ = true; | 523 offline_failed_ = true; |
| 515 | 524 |
| 516 guest_mode_url_ = GURL::EmptyGURL(); | 525 guest_mode_url_ = GURL::EmptyGURL(); |
| 517 std::string error = failure.GetErrorString(); | 526 std::string error = failure.GetErrorString(); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 // Invalidate OAuth token, since it can't be correct after password is | 931 // Invalidate OAuth token, since it can't be correct after password is |
| 923 // changed. | 932 // changed. |
| 924 UserManager::Get()->SaveUserOAuthStatus(username, | 933 UserManager::Get()->SaveUserOAuthStatus(username, |
| 925 User::OAUTH_TOKEN_STATUS_INVALID); | 934 User::OAUTH_TOKEN_STATUS_INVALID); |
| 926 | 935 |
| 927 login_display_->SetUIEnabled(true); | 936 login_display_->SetUIEnabled(true); |
| 928 login_display_->ShowGaiaPasswordChanged(username); | 937 login_display_->ShowGaiaPasswordChanged(username); |
| 929 } | 938 } |
| 930 | 939 |
| 931 } // namespace chromeos | 940 } // namespace chromeos |
| OLD | NEW |