Chromium Code Reviews| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { | 465 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { |
| 466 OwnershipService::GetSharedInstance()->GetStatusAsync( | 466 OwnershipService::GetSharedInstance()->GetStatusAsync( |
| 467 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, | 467 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, |
| 468 weak_factory_.GetWeakPtr())); | 468 weak_factory_.GetWeakPtr())); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 | 471 |
| 472 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( | 472 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( |
| 473 OwnershipService::Status status, | 473 OwnershipService::Status status, |
| 474 bool current_user_is_owner) { | 474 bool current_user_is_owner) { |
| 475 if (status == OwnershipService::OWNERSHIP_NONE) | 475 if (status == OwnershipService::OWNERSHIP_NONE) { |
| 476 ShowEnrollmentScreen(false, std::string()); | 476 ShowEnrollmentScreen(false, std::string()); |
| 477 } else if (status == OwnershipService::OWNERSHIP_TAKEN) { | |
| 478 // On a device that is already owned we might want to allow users to | |
| 479 // re-enroll if the policy information has been screwed. | |
|
Mattias Nissler (ping if slow)
2012/06/08 13:13:44
s/has been screwed/is invalid/, we really don't kn
pastarmovj
2012/06/08 15:07:12
Done.
| |
| 480 CrosSettingsProvider::TrustedStatus trusted_status = | |
| 481 CrosSettings::Get()->PrepareTrustedValues( | |
| 482 base::Bind( | |
| 483 &ExistingUserController::OnEnrollmentOwnershipCheckCompleted, | |
| 484 weak_factory_.GetWeakPtr(), status, current_user_is_owner)); | |
| 485 if (trusted_status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) | |
| 486 ShowEnrollmentScreen(false, std::string()); | |
| 487 } else { | |
| 488 // OwnershipService::GetStatusAsync is supposed to return either | |
| 489 // OWNERSHIP_NONE or OWNERSHIP_TAKEN. | |
| 490 NOTREACHED(); | |
| 491 } | |
| 477 } | 492 } |
| 478 | 493 |
| 479 void ExistingUserController::ShowEnrollmentScreen(bool is_auto_enrollment, | 494 void ExistingUserController::ShowEnrollmentScreen(bool is_auto_enrollment, |
| 480 const std::string& user) { | 495 const std::string& user) { |
| 481 DictionaryValue* params = NULL; | 496 DictionaryValue* params = NULL; |
| 482 if (is_auto_enrollment) { | 497 if (is_auto_enrollment) { |
| 483 params = new DictionaryValue; | 498 params = new DictionaryValue; |
| 484 params->SetBoolean("is_auto_enrollment", true); | 499 params->SetBoolean("is_auto_enrollment", true); |
| 485 params->SetString("user", user); | 500 params->SetString("user", user); |
| 486 } | 501 } |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 898 // Invalidate OAuth token, since it can't be correct after password is | 913 // Invalidate OAuth token, since it can't be correct after password is |
| 899 // changed. | 914 // changed. |
| 900 UserManager::Get()->SaveUserOAuthStatus(username, | 915 UserManager::Get()->SaveUserOAuthStatus(username, |
| 901 User::OAUTH_TOKEN_STATUS_INVALID); | 916 User::OAUTH_TOKEN_STATUS_INVALID); |
| 902 | 917 |
| 903 login_display_->SetUIEnabled(true); | 918 login_display_->SetUIEnabled(true); |
| 904 login_display_->ShowGaiaPasswordChanged(username); | 919 login_display_->ShowGaiaPasswordChanged(username); |
| 905 } | 920 } |
| 906 | 921 |
| 907 } // namespace chromeos | 922 } // namespace chromeos |
| OLD | NEW |