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

Unified Diff: device/usb/webusb_descriptors.h

Issue 1256113006: Add utilities to parse WebUSB device descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment tweaks. Created 5 years, 4 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 | « device/usb/usb.gyp ('k') | device/usb/webusb_descriptors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/webusb_descriptors.h
diff --git a/device/usb/webusb_descriptors.h b/device/usb/webusb_descriptors.h
new file mode 100644
index 0000000000000000000000000000000000000000..696d02489611da3ddb6424e7a6405b6ca166e136
--- /dev/null
+++ b/device/usb/webusb_descriptors.h
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_USB_WEBUSB_DESCRIPTORS_H_
+#define DEVICE_USB_WEBUSB_DESCRIPTORS_H_
+
+#include <stdint.h>
+#include <vector>
+
+#include "url/gurl.h"
+
+namespace device {
+
+struct WebUsbFunctionSubset {
+ WebUsbFunctionSubset();
+ ~WebUsbFunctionSubset();
+
+ uint8_t first_interface;
+ std::vector<GURL> origins;
+};
+
+struct WebUsbConfigurationSubset {
+ WebUsbConfigurationSubset();
+ ~WebUsbConfigurationSubset();
+
+ uint8_t configuration_value;
+ std::vector<GURL> origins;
+ std::vector<WebUsbFunctionSubset> functions;
+};
+
+struct WebUsbDescriptorSet {
+ WebUsbDescriptorSet();
+ ~WebUsbDescriptorSet();
+
+ bool Parse(const std::vector<uint8_t>& bytes);
+
+ std::vector<GURL> origins;
+ std::vector<WebUsbConfigurationSubset> configurations;
+};
+
+struct WebUsbPlatformCapabilityDescriptor {
+ WebUsbPlatformCapabilityDescriptor();
+ ~WebUsbPlatformCapabilityDescriptor();
+
+ bool ParseFromBosDescriptor(const std::vector<uint8_t>& bytes);
+
+ uint16_t version;
+ uint8_t vendor_code;
+};
+
+} // device
+
+#endif // DEVICE_USB_WEBUSB_DESCRIPTORS_H_
« no previous file with comments | « device/usb/usb.gyp ('k') | device/usb/webusb_descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698