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

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: rebased / incremented IDs to account for intermediate commits Created 4 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/proto/chrome_device_policy.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3e0d695b086765c64fa49055e11bfb5f6e221f58..d6cf2388f622cf33fcb7234a3986ce20c941eacc 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"
@@ -850,6 +851,27 @@ 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::DictionaryValue* ids = new base::DictionaryValue();
+ if (entry->has_vendor_id()) {
+ ids->SetString("vid", base::StringPrintf("%04X", entry->vendor_id()));
+ }
+ if (entry->has_product_id()) {
+ ids->SetString("pid", base::StringPrintf("%04X", entry->product_id()));
+ }
+ whitelist->Append(ids);
+ }
+ policies->Set(key::kUsbDetachableWhitelist, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, whitelist,
+ nullptr);
+ }
}
} // namespace
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/proto/chrome_device_policy.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698