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

Unified Diff: Source/modules/webusb/USBDevice.h

Issue 1264483005: Add WebUSB bindings and client interface [part 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: enum class 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 | « Source/modules/webusb/USB.cpp ('k') | Source/modules/webusb/USBDevice.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webusb/USBDevice.h
diff --git a/Source/modules/webusb/USBDevice.h b/Source/modules/webusb/USBDevice.h
index ad94231ad9316e9f20bf98a129a31b5cb88f3331..95f9c283a0e9a2dfef6bea022d7d635d6de734da 100644
--- a/Source/modules/webusb/USBDevice.h
+++ b/Source/modules/webusb/USBDevice.h
@@ -7,32 +7,52 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "platform/heap/Handle.h"
+#include "public/platform/modules/webusb/WebUSBDevice.h"
+#include "public/platform/modules/webusb/WebUSBDeviceInfo.h"
namespace blink {
-class USBControlTransferParameters;
-
class USBDevice
: public GarbageCollectedFinalized<USBDevice>
, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
- static USBDevice* create()
+ using WebType = WebUSBDeviceInfo;
+
+ static USBDevice* create(PassOwnPtr<WebUSBDevice> device)
{
- return new USBDevice;
+ return new USBDevice(device);
}
- USBDevice() { }
+ explicit USBDevice(PassOwnPtr<WebUSBDevice> device)
+ : m_device(device)
+ {
+ }
virtual ~USBDevice() { }
- String guid() const
- {
- ASSERT_NOT_REACHED();
- return "";
- }
+ const WebUSBDeviceInfo& info() const { return m_device->info(); }
+
+ String guid() const { return info().guid; }
+ uint8_t usbVersionMajor() { return info().usbVersionMajor; }
+ uint8_t usbVersionMinor() { return info().usbVersionMinor; }
+ uint8_t usbVersionSubminor() { return info().usbVersionSubminor; }
+ uint8_t deviceClass() { return info().deviceClass; }
+ uint8_t deviceSubclass() const { return info().deviceSubclass; }
+ uint8_t deviceProtocol() const { return info().deviceProtocol; }
+ uint16_t vendorId() const { return info().vendorID; }
+ uint16_t productId() const { return info().productID; }
+ uint8_t deviceVersionMajor() const { return info().deviceVersionMajor; }
+ uint8_t deviceVersionMinor() const { return info().deviceVersionMinor; }
+ uint8_t deviceVersionSubminor() const { return info().deviceVersionSubminor; }
+ String manufacturerName() const { return info().manufacturerName; }
+ String productName() const { return info().productName; }
+ String serialNumber() const { return info().serialNumber; }
DEFINE_INLINE_TRACE() { }
+
+private:
+ OwnPtr<WebUSBDevice> m_device;
};
} // namespace blink
« no previous file with comments | « Source/modules/webusb/USB.cpp ('k') | Source/modules/webusb/USBDevice.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698