| Index: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
|
| ===================================================================
|
| --- chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc (revision 255205)
|
| +++ chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc (working copy)
|
| @@ -34,6 +34,12 @@
|
|
|
| namespace {
|
|
|
| +// Overridden no requisition value.
|
| +const char kNoRequisition[] = "none";
|
| +
|
| +// Overridden no requisition value.
|
| +const char kRemoraRequisition[] = "remora";
|
| +
|
| // MachineInfo key names.
|
| const char kMachineInfoSystemHwqual[] = "hardware_class";
|
|
|
| @@ -118,6 +124,7 @@
|
| device_management_service_ = device_management_service;
|
| device_status_provider_ = device_status_provider.Pass();
|
|
|
| + InitalizeRequisition();
|
| StartIfManaged();
|
| }
|
|
|
| @@ -151,14 +158,12 @@
|
| std::string requisition;
|
| const PrefService::Preference* pref = local_state_->FindPreference(
|
| prefs::kDeviceEnrollmentRequisition);
|
| - if (pref->IsDefaultValue() && !chromeos::StartupUtils::IsOobeCompleted()) {
|
| - // OEM statistics are only loaded when OOBE is not completed.
|
| - requisition =
|
| - GetMachineStatistic(chromeos::system::kOemDeviceRequisitionKey);
|
| - } else {
|
| + if (!pref->IsDefaultValue())
|
| pref->GetValue()->GetAsString(&requisition);
|
| - }
|
|
|
| + if (requisition == kNoRequisition)
|
| + requisition.clear();
|
| +
|
| return requisition;
|
| }
|
|
|
| @@ -171,8 +176,13 @@
|
| local_state_->ClearPref(prefs::kDeviceEnrollmentCanExit);
|
| } else {
|
| local_state_->SetString(prefs::kDeviceEnrollmentRequisition, requisition);
|
| - local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
|
| - local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
|
| + if (requisition == kNoRequisition) {
|
| + local_state_->ClearPref(prefs::kDeviceEnrollmentAutoStart);
|
| + local_state_->ClearPref(prefs::kDeviceEnrollmentCanExit);
|
| + } else {
|
| + local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
|
| + local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
|
| + }
|
| }
|
| }
|
| }
|
| @@ -292,4 +302,35 @@
|
| }
|
| }
|
|
|
| +void DeviceCloudPolicyManagerChromeOS::InitalizeRequisition() {
|
| + // OEM statistics are only loaded when OOBE is not completed.
|
| + if (chromeos::StartupUtils::IsOobeCompleted())
|
| + return;
|
| +
|
| + const PrefService::Preference* pref = local_state_->FindPreference(
|
| + prefs::kDeviceEnrollmentRequisition);
|
| + if (pref->IsDefaultValue()) {
|
| + std::string requisition =
|
| + GetMachineStatistic(chromeos::system::kOemDeviceRequisitionKey);
|
| +
|
| + if (!requisition.empty()) {
|
| + local_state_->SetString(prefs::kDeviceEnrollmentRequisition,
|
| + requisition);
|
| + if (requisition == kRemoraRequisition) {
|
| + local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
|
| + local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
|
| + } else {
|
| + local_state_->SetBoolean(
|
| + prefs::kDeviceEnrollmentAutoStart,
|
| + GetMachineFlag(chromeos::system::kOemIsEnterpriseManagedKey,
|
| + false));
|
| + local_state_->SetBoolean(
|
| + prefs::kDeviceEnrollmentCanExit,
|
| + GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey,
|
| + false));
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| } // namespace policy
|
|
|