Index: chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
index 2579fe748b014c7560fe8d9a68fa4891cbedb68f..e9bd3e6f60595c9024d69a3d58b87b25357dc3b1 100644 |
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
@@ -11,6 +11,7 @@ |
#include "base/json/json_reader.h" |
#include "base/logging.h" |
#include "base/macros.h" |
+#include "base/strings/stringprintf.h" |
#include "base/values.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chromeos/policy/device_local_account.h" |
@@ -822,6 +823,31 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy, |
DecodeIntegerValue(container.display_rotation_default()).release(), |
nullptr); |
} |
+ |
+ if (policy.has_usb_detachable_whitelist()) { |
+ const em::UsbDetachableWhitelistProto& container( |
+ policy.usb_detachable_whitelist()); |
+ base::ListValue* whitelist = new base::ListValue(); |
+ RepeatedPtrField<em::UsbDeviceIdProto>::const_iterator entry; |
+ for (entry = container.id().begin(); entry != container.id().end(); |
+ ++entry) { |
+ base::ListValue* ids = new base::ListValue(); |
+ const std::string vid = |
bartfab (slow)
2016/03/07 11:16:47
Sorry for the many nits: Rather than a magic value
vpalatin
2016/03/07 16:38:28
Done.
|
+ entry->has_vendor_id() |
+ ? base::StringPrintf("%04X", entry->vendor_id()) |
+ : "<no VID>"; |
+ const std::string pid = |
+ entry->has_product_id() |
+ ? base::StringPrintf("%04X", entry->product_id()) |
+ : "<no PID>"; |
+ ids->Append(new base::StringValue(vid)); |
+ ids->Append(new base::StringValue(pid)); |
+ whitelist->Append(ids); |
+ } |
+ policies->Set(key::kUsbDetachableWhitelist, POLICY_LEVEL_MANDATORY, |
+ POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, whitelist, |
+ nullptr); |
+ } |
} |
} // namespace |