Chromium Code Reviews| Index: chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| index 915e0762c200f34c164f88f235f5ce1b7d0a2a64..69e6c8bb7fe94d0ef78d612368fb10a2e0fc7aaf 100644 |
| --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| @@ -55,36 +55,6 @@ int GetSanitizedArg(const std::string& switch_name) { |
| return int_value; |
| } |
| -// Returns whether the auto-enrollment check is required. When |
| -// kCheckEnrollmentKey VPD entry is present, it is explicitly stating whether |
| -// the forced re-enrollment is required or not. Otherwise, for backward |
| -// compatibility with devices upgrading from an older version of Chrome OS, the |
| -// kActivateDateKey VPD entry is queried. If it's missing, FRE is not required. |
| -// This enables factories to start full guest sessions for testing, see |
| -// http://crbug.com/397354 for more context. The requirement for the machine |
| -// serial number to be present is a sanity-check to ensure that the VPD has |
| -// actually been read successfully. If VPD read failed, the FRE check is |
| -// required. |
| -AutoEnrollmentController::FRERequirement GetFRERequirement() { |
| - std::string check_enrollment_value; |
| - system::StatisticsProvider* provider = |
| - system::StatisticsProvider::GetInstance(); |
| - bool fre_flag_found = provider->GetMachineStatistic( |
| - system::kCheckEnrollmentKey, &check_enrollment_value); |
| - |
| - if (fre_flag_found) { |
| - if (check_enrollment_value == "0") |
| - return AutoEnrollmentController::EXPLICITLY_NOT_REQUIRED; |
| - if (check_enrollment_value == "1") |
| - return AutoEnrollmentController::EXPLICITLY_REQUIRED; |
| - } |
| - if (!provider->GetMachineStatistic(system::kActivateDateKey, nullptr) && |
| - !provider->GetEnterpriseMachineID().empty()) { |
| - return AutoEnrollmentController::NOT_REQUIRED; |
| - } |
| - return AutoEnrollmentController::REQUIRED; |
| -} |
| - |
| std::string FRERequirementToString( |
| AutoEnrollmentController::FRERequirement requirement) { |
| switch (requirement) { |
| @@ -136,6 +106,27 @@ AutoEnrollmentController::Mode AutoEnrollmentController::GetMode() { |
| return MODE_NONE; |
| } |
| +AutoEnrollmentController::FRERequirement |
|
Thiemo Nagel
2017/05/24 10:50:39
Nit: Add "// static" above.
|
| +AutoEnrollmentController::GetFRERequirement() { |
| + std::string check_enrollment_value; |
| + system::StatisticsProvider* provider = |
| + system::StatisticsProvider::GetInstance(); |
| + bool fre_flag_found = provider->GetMachineStatistic( |
| + system::kCheckEnrollmentKey, &check_enrollment_value); |
| + |
| + if (fre_flag_found) { |
| + if (check_enrollment_value == "0") |
| + return AutoEnrollmentController::EXPLICITLY_NOT_REQUIRED; |
| + if (check_enrollment_value == "1") |
| + return AutoEnrollmentController::EXPLICITLY_REQUIRED; |
| + } |
| + if (!provider->GetMachineStatistic(system::kActivateDateKey, nullptr) && |
| + !provider->GetEnterpriseMachineID().empty()) { |
| + return AutoEnrollmentController::NOT_REQUIRED; |
| + } |
| + return AutoEnrollmentController::REQUIRED; |
| +} |
| + |
| AutoEnrollmentController::AutoEnrollmentController() {} |
| AutoEnrollmentController::~AutoEnrollmentController() {} |