Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5631)

Unified Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc

Issue 183923008: Fixed handling of 'oem_device_requisition' VPD value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
index e0154f7ec70c171137db02e116c28fbef88ecc6b..3f27c83c65642d502749833bc1f9392a0f171746 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
@@ -34,6 +34,9 @@ namespace policy {
namespace {
+// Overridden no requisition value.
+const char kNoRequisition[] = "none";
+
// MachineInfo key names.
const char kMachineInfoSystemHwqual[] = "hardware_class";
@@ -118,6 +121,7 @@ void DeviceCloudPolicyManagerChromeOS::Connect(
device_management_service_ = device_management_service;
device_status_provider_ = device_status_provider.Pass();
+ InitalizeRequisition();
StartIfManaged();
}
@@ -151,13 +155,11 @@ std::string DeviceCloudPolicyManagerChromeOS::GetDeviceRequisition() const {
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 +173,13 @@ void DeviceCloudPolicyManagerChromeOS::SetDeviceRequisition(
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);
Mattias Nissler (ping if slow) 2014/03/02 08:35:08 This will become problematic once we're starting t
zel 2014/03/03 19:43:39 This should stay the way it is since it's only cal
+ }
}
}
}
@@ -287,4 +294,19 @@ void DeviceCloudPolicyManagerChromeOS::StartIfManaged() {
}
}
+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())
+ SetDeviceRequisition(requisition);
+ }
+}
+
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698