| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // Do an ownership check now to avoid auto-enrolling if the device has | 346 // Do an ownership check now to avoid auto-enrolling if the device has |
| 347 // already been owned. | 347 // already been owned. |
| 348 DeviceSettingsService::Get()->GetOwnershipStatusAsync( | 348 DeviceSettingsService::Get()->GetOwnershipStatusAsync( |
| 349 base::Bind(&ExistingUserController::CompleteLoginInternal, | 349 base::Bind(&ExistingUserController::CompleteLoginInternal, |
| 350 weak_factory_.GetWeakPtr(), | 350 weak_factory_.GetWeakPtr(), |
| 351 user_context)); | 351 user_context)); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void ExistingUserController::CompleteLoginInternal( | 354 void ExistingUserController::CompleteLoginInternal( |
| 355 const UserContext& user_context, | 355 const UserContext& user_context, |
| 356 DeviceSettingsService::OwnershipStatus ownership_status, | 356 DeviceSettingsService::OwnershipStatus ownership_status) { |
| 357 bool is_owner) { | |
| 358 // Auto-enrollment must have made a decision by now. It's too late to enroll | 357 // Auto-enrollment must have made a decision by now. It's too late to enroll |
| 359 // if the protocol isn't done at this point. | 358 // if the protocol isn't done at this point. |
| 360 if (do_auto_enrollment_ && | 359 if (do_auto_enrollment_ && |
| 361 ownership_status == DeviceSettingsService::OWNERSHIP_NONE) { | 360 ownership_status == DeviceSettingsService::OWNERSHIP_NONE) { |
| 362 VLOG(1) << "Forcing auto-enrollment before completing login"; | 361 VLOG(1) << "Forcing auto-enrollment before completing login"; |
| 363 // The only way to get out of the enrollment screen from now on is to either | 362 // The only way to get out of the enrollment screen from now on is to either |
| 364 // complete enrollment, or opt-out of it. So this controller shouldn't force | 363 // complete enrollment, or opt-out of it. So this controller shouldn't force |
| 365 // enrollment again if it is reused for another sign-in. | 364 // enrollment again if it is reused for another sign-in. |
| 366 do_auto_enrollment_ = false; | 365 do_auto_enrollment_ = false; |
| 367 auto_enrollment_username_ = user_context.username; | 366 auto_enrollment_username_ = user_context.username; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 NOTREACHED(); | 625 NOTREACHED(); |
| 627 } | 626 } |
| 628 | 627 |
| 629 void ExistingUserController::OnConsumerKioskModeCheckCompleted( | 628 void ExistingUserController::OnConsumerKioskModeCheckCompleted( |
| 630 KioskAppManager::ConsumerKioskModeStatus status) { | 629 KioskAppManager::ConsumerKioskModeStatus status) { |
| 631 if (status == KioskAppManager::CONSUMER_KIOSK_MODE_CONFIGURABLE) | 630 if (status == KioskAppManager::CONSUMER_KIOSK_MODE_CONFIGURABLE) |
| 632 ShowKioskEnableScreen(); | 631 ShowKioskEnableScreen(); |
| 633 } | 632 } |
| 634 | 633 |
| 635 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( | 634 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( |
| 636 DeviceSettingsService::OwnershipStatus status, | 635 DeviceSettingsService::OwnershipStatus status) { |
| 637 bool current_user_is_owner) { | |
| 638 if (status == DeviceSettingsService::OWNERSHIP_NONE) { | 636 if (status == DeviceSettingsService::OWNERSHIP_NONE) { |
| 639 ShowEnrollmentScreen(false, std::string()); | 637 ShowEnrollmentScreen(false, std::string()); |
| 640 } else if (status == DeviceSettingsService::OWNERSHIP_TAKEN) { | 638 } else if (status == DeviceSettingsService::OWNERSHIP_TAKEN) { |
| 641 // On a device that is already owned we might want to allow users to | 639 // On a device that is already owned we might want to allow users to |
| 642 // re-enroll if the policy information is invalid. | 640 // re-enroll if the policy information is invalid. |
| 643 CrosSettingsProvider::TrustedStatus trusted_status = | 641 CrosSettingsProvider::TrustedStatus trusted_status = |
| 644 CrosSettings::Get()->PrepareTrustedValues( | 642 CrosSettings::Get()->PrepareTrustedValues( |
| 645 base::Bind( | 643 base::Bind( |
| 646 &ExistingUserController::OnEnrollmentOwnershipCheckCompleted, | 644 &ExistingUserController::OnEnrollmentOwnershipCheckCompleted, |
| 647 weak_factory_.GetWeakPtr(), | 645 weak_factory_.GetWeakPtr(), status)); |
| 648 status, current_user_is_owner)); | |
| 649 if (trusted_status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { | 646 if (trusted_status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { |
| 650 ShowEnrollmentScreen(false, std::string()); | 647 ShowEnrollmentScreen(false, std::string()); |
| 651 } | 648 } |
| 652 } else { | 649 } else { |
| 653 // OwnershipService::GetStatusAsync is supposed to return either | 650 // OwnershipService::GetStatusAsync is supposed to return either |
| 654 // OWNERSHIP_NONE or OWNERSHIP_TAKEN. | 651 // OWNERSHIP_NONE or OWNERSHIP_TAKEN. |
| 655 NOTREACHED(); | 652 NOTREACHED(); |
| 656 } | 653 } |
| 657 } | 654 } |
| 658 | 655 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 // changed. | 1111 // changed. |
| 1115 UserManager::Get()->SaveUserOAuthStatus( | 1112 UserManager::Get()->SaveUserOAuthStatus( |
| 1116 username, | 1113 username, |
| 1117 User::OAUTH2_TOKEN_STATUS_INVALID); | 1114 User::OAUTH2_TOKEN_STATUS_INVALID); |
| 1118 | 1115 |
| 1119 login_display_->SetUIEnabled(true); | 1116 login_display_->SetUIEnabled(true); |
| 1120 login_display_->ShowGaiaPasswordChanged(username); | 1117 login_display_->ShowGaiaPasswordChanged(username); |
| 1121 } | 1118 } |
| 1122 | 1119 |
| 1123 } // namespace chromeos | 1120 } // namespace chromeos |
| OLD | NEW |