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

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

Issue 2371213002: Refactor: Inject StatisticsProvider as a dependency of DeviceCloudPolicyInitializer. (Closed)
Patch Set: Address Maksim's comments. Created 4 years, 3 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 36e345988b7f6ba762b3f025afdeb93ca2d37e10..d7bf0f58fe0e6fe6315f4acc54972fffc5dfbd06 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
@@ -61,26 +61,6 @@ const char kRialtoRequisition[] = "rialto";
// Zero-touch enrollment flag values.
const char kZeroTouchEnrollmentForced[] = "forced";
-// These are the machine serial number keys that we check in order until we
-// find a non-empty serial number. The VPD spec says the serial number should be
-// in the "serial_number" key for v2+ VPDs. However, legacy devices used a
-// different key to report their serial number, which we fall back to if
-// "serial_number" is not present.
-//
-// Product_S/N is still special-cased due to inconsistencies with serial
-// numbers on Lumpy devices: On these devices, serial_number is identical to
-// Product_S/N with an appended checksum. Unfortunately, the sticker on the
-// packaging doesn't include that checksum either (the sticker on the device
-// does though!). The former sticker is the source of the serial number used by
-// device management service, so we prefer Product_S/N over serial number to
-// match the server.
-const char* const kMachineInfoSerialNumberKeys[] = {
- "Product_S/N", // Lumpy/Alex devices
- "serial_number", // VPD v2+ devices
- "Product_SN", // Mario
- "sn", // old ZGB devices (more recent ones use serial_number)
-};
-
// Fetches a machine statistic value from StatisticsProvider, returns an empty
// string on failure.
std::string GetMachineStatistic(const std::string& key) {
@@ -220,34 +200,6 @@ void DeviceCloudPolicyManagerChromeOS::RegisterPrefs(
}
// static
-std::string DeviceCloudPolicyManagerChromeOS::GetMachineID() {
- std::string machine_id;
- chromeos::system::StatisticsProvider* provider =
- chromeos::system::StatisticsProvider::GetInstance();
- for (size_t i = 0; i < arraysize(kMachineInfoSerialNumberKeys); i++) {
- if (provider->HasMachineStatistic(kMachineInfoSerialNumberKeys[i]) &&
- provider->GetMachineStatistic(kMachineInfoSerialNumberKeys[i],
- &machine_id) &&
- !machine_id.empty()) {
- break;
- }
- }
-
- if (machine_id.empty()) {
- LOG(WARNING) << "Failed to get machine id. This is only an error if the "
- "device has not yet been enrolled or claimed by a local "
- "user.";
- }
-
- return machine_id;
-}
-
-// static
-std::string DeviceCloudPolicyManagerChromeOS::GetMachineModel() {
- return GetMachineStatistic(chromeos::system::kHardwareClassKey);
-}
-
-// static
ZeroTouchEnrollmentMode
DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();

Powered by Google App Engine
This is Rietveld 408576698