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

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

Issue 1714473002: Add usb_detachable_whitelist to device policy proto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update the policy_templates.json file and the policy decoder code Created 4 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_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..31efd2679e973c7a80149e81cc2a14a8751b34f6 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,22 @@ 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) {
+ uint16_t vid = entry->has_vendor_id() ? entry->vendor_id() : 0x0000;
bartfab (slow) 2016/03/01 14:49:57 Nit: const.
vpalatin 2016/03/01 17:49:01 Done.
+ uint16_t pid = entry->has_product_id() ? entry->product_id() : 0x0000;
bartfab (slow) 2016/03/01 14:49:57 Nit: const.
vpalatin 2016/03/01 17:49:01 Done.
+ whitelist->Append(
+ new base::StringValue(base::StringPrintf("%04x:%04x", vid, pid)));
bartfab (slow) 2016/03/01 14:49:57 Why not use a base::ListValue of two base::Fundame
vpalatin 2016/03/01 17:49:01 That would look nicer but I really want to print t
bartfab (slow) 2016/03/02 10:40:33 I think there is a compromise that can make both o
+ }
+ policies->Set(key::kUsbDetachableWhitelist, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, whitelist, NULL);
bartfab (slow) 2016/03/01 14:49:57 Nit: s/NULL/nullptr/
vpalatin 2016/03/01 17:49:01 Done.
+ }
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698