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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/modules/webusb/USB.cpp ('k') | Source/modules/webusb/USBDevice.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef USBDevice_h 5 #ifndef USBDevice_h
6 #define USBDevice_h 6 #define USBDevice_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "public/platform/modules/webusb/WebUSBDevice.h"
11 #include "public/platform/modules/webusb/WebUSBDeviceInfo.h"
10 12
11 namespace blink { 13 namespace blink {
12 14
13 class USBControlTransferParameters;
14
15 class USBDevice 15 class USBDevice
16 : public GarbageCollectedFinalized<USBDevice> 16 : public GarbageCollectedFinalized<USBDevice>
17 , public ScriptWrappable { 17 , public ScriptWrappable {
18 DEFINE_WRAPPERTYPEINFO(); 18 DEFINE_WRAPPERTYPEINFO();
19 public: 19 public:
20 static USBDevice* create() 20 using WebType = WebUSBDeviceInfo;
21
22 static USBDevice* create(PassOwnPtr<WebUSBDevice> device)
21 { 23 {
22 return new USBDevice; 24 return new USBDevice(device);
23 } 25 }
24 26
25 USBDevice() { } 27 explicit USBDevice(PassOwnPtr<WebUSBDevice> device)
28 : m_device(device)
29 {
30 }
26 31
27 virtual ~USBDevice() { } 32 virtual ~USBDevice() { }
28 33
29 String guid() const 34 const WebUSBDeviceInfo& info() const { return m_device->info(); }
30 { 35
31 ASSERT_NOT_REACHED(); 36 String guid() const { return info().guid; }
32 return ""; 37 uint8_t usbVersionMajor() { return info().usbVersionMajor; }
33 } 38 uint8_t usbVersionMinor() { return info().usbVersionMinor; }
39 uint8_t usbVersionSubminor() { return info().usbVersionSubminor; }
40 uint8_t deviceClass() { return info().deviceClass; }
41 uint8_t deviceSubclass() const { return info().deviceSubclass; }
42 uint8_t deviceProtocol() const { return info().deviceProtocol; }
43 uint16_t vendorId() const { return info().vendorID; }
44 uint16_t productId() const { return info().productID; }
45 uint8_t deviceVersionMajor() const { return info().deviceVersionMajor; }
46 uint8_t deviceVersionMinor() const { return info().deviceVersionMinor; }
47 uint8_t deviceVersionSubminor() const { return info().deviceVersionSubminor; }
48 String manufacturerName() const { return info().manufacturerName; }
49 String productName() const { return info().productName; }
50 String serialNumber() const { return info().serialNumber; }
34 51
35 DEFINE_INLINE_TRACE() { } 52 DEFINE_INLINE_TRACE() { }
53
54 private:
55 OwnPtr<WebUSBDevice> m_device;
36 }; 56 };
37 57
38 } // namespace blink 58 } // namespace blink
39 59
40 #endif // USBDevice_h 60 #endif // USBDevice_h
OLDNEW
« 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