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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { | 449 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { |
| 450 OwnershipService::GetSharedInstance()->GetStatusAsync( | 450 OwnershipService::GetSharedInstance()->GetStatusAsync( |
| 451 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, | 451 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, |
| 452 weak_factory_.GetWeakPtr())); | 452 weak_factory_.GetWeakPtr())); |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 | 455 |
| 456 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( | 456 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( |
| 457 OwnershipService::Status status, | 457 OwnershipService::Status status, |
| 458 bool current_user_is_owner) { | 458 bool current_user_is_owner) { |
| 459 if (status == OwnershipService::OWNERSHIP_NONE) | 459 if (status == OwnershipService::OWNERSHIP_NONE) { |
| 460 ShowEnrollmentScreen(false, std::string()); | 460 ShowEnrollmentScreen(false, std::string()); |
| 461 } else { | |
|
Mattias Nissler (ping if slow)
2012/06/04 10:17:52
shouldn't this be else if (status == OwnershipServ
pastarmovj
2012/06/08 09:54:32
OwnershipServoce::GetStatusAsync is guaranteed to
Mattias Nissler (ping if slow)
2012/06/08 12:06:11
I'm aware of that. To somebody new to this, it may
pastarmovj
2012/06/08 12:56:39
Done.
| |
| 462 // On a device that is already owned we might want to allow users to | |
| 463 // re-enroll if the policy information has been screwed. | |
| 464 CrosSettingsProvider::TrustedStatus trusted_status = | |
| 465 CrosSettings::Get()->PrepareTrustedValues(base::Bind( | |
|
Mattias Nissler (ping if slow)
2012/06/04 10:17:52
nit: can you break before base::Bind?
pastarmovj
2012/06/08 09:54:32
Done. However the huge size of the function name e
| |
| 466 &ExistingUserController::OnEnrollmentOwnershipCheckCompleted, | |
| 467 weak_factory_.GetWeakPtr(), status, current_user_is_owner)); | |
| 468 if (trusted_status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) | |
| 469 ShowEnrollmentScreen(false, std::string()); | |
| 470 } | |
| 461 } | 471 } |
| 462 | 472 |
| 463 void ExistingUserController::ShowEnrollmentScreen(bool is_auto_enrollment, | 473 void ExistingUserController::ShowEnrollmentScreen(bool is_auto_enrollment, |
| 464 const std::string& user) { | 474 const std::string& user) { |
| 465 DictionaryValue* params = NULL; | 475 DictionaryValue* params = NULL; |
| 466 if (is_auto_enrollment) { | 476 if (is_auto_enrollment) { |
| 467 params = new DictionaryValue; | 477 params = new DictionaryValue; |
| 468 params->SetBoolean("is_auto_enrollment", true); | 478 params->SetBoolean("is_auto_enrollment", true); |
| 469 params->SetString("user", user); | 479 params->SetString("user", user); |
| 470 } | 480 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 // Invalidate OAuth token, since it can't be correct after password is | 880 // Invalidate OAuth token, since it can't be correct after password is |
| 871 // changed. | 881 // changed. |
| 872 UserManager::Get()->SaveUserOAuthStatus(username, | 882 UserManager::Get()->SaveUserOAuthStatus(username, |
| 873 User::OAUTH_TOKEN_STATUS_INVALID); | 883 User::OAUTH_TOKEN_STATUS_INVALID); |
| 874 | 884 |
| 875 login_display_->SetUIEnabled(true); | 885 login_display_->SetUIEnabled(true); |
| 876 login_display_->ShowGaiaPasswordChanged(username); | 886 login_display_->ShowGaiaPasswordChanged(username); |
| 877 } | 887 } |
| 878 | 888 |
| 879 } // namespace chromeos | 889 } // namespace chromeos |
| OLD | NEW |