| OLD | NEW |
| 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/ScriptPromise.h" |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "bindings/modules/v8/UnionTypesModules.h" |
| 9 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 10 #include "public/platform/modules/webusb/WebUSBDevice.h" | 12 #include "public/platform/modules/webusb/WebUSBDevice.h" |
| 11 #include "public/platform/modules/webusb/WebUSBDeviceInfo.h" | 13 #include "public/platform/modules/webusb/WebUSBDeviceInfo.h" |
| 12 | 14 |
| 13 namespace blink { | 15 namespace blink { |
| 14 | 16 |
| 15 class ScriptPromiseResolver; | 17 class ScriptPromiseResolver; |
| 18 class ScriptState; |
| 16 class USBConfiguration; | 19 class USBConfiguration; |
| 20 class USBControlTransferParameters; |
| 17 | 21 |
| 18 class USBDevice | 22 class USBDevice |
| 19 : public GarbageCollectedFinalized<USBDevice> | 23 : public GarbageCollectedFinalized<USBDevice> |
| 20 , public ScriptWrappable { | 24 , public ScriptWrappable { |
| 21 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
| 22 public: | 26 public: |
| 23 using WebType = OwnPtr<WebUSBDevice>; | 27 using WebType = OwnPtr<WebUSBDevice>; |
| 24 | 28 |
| 25 static USBDevice* create(PassOwnPtr<WebUSBDevice> device) | 29 static USBDevice* create(PassOwnPtr<WebUSBDevice> device) |
| 26 { | 30 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 51 uint16_t vendorId() const { return info().vendorID; } | 55 uint16_t vendorId() const { return info().vendorID; } |
| 52 uint16_t productId() const { return info().productID; } | 56 uint16_t productId() const { return info().productID; } |
| 53 uint8_t deviceVersionMajor() const { return info().deviceVersionMajor; } | 57 uint8_t deviceVersionMajor() const { return info().deviceVersionMajor; } |
| 54 uint8_t deviceVersionMinor() const { return info().deviceVersionMinor; } | 58 uint8_t deviceVersionMinor() const { return info().deviceVersionMinor; } |
| 55 uint8_t deviceVersionSubminor() const { return info().deviceVersionSubminor;
} | 59 uint8_t deviceVersionSubminor() const { return info().deviceVersionSubminor;
} |
| 56 String manufacturerName() const { return info().manufacturerName; } | 60 String manufacturerName() const { return info().manufacturerName; } |
| 57 String productName() const { return info().productName; } | 61 String productName() const { return info().productName; } |
| 58 String serialNumber() const { return info().serialNumber; } | 62 String serialNumber() const { return info().serialNumber; } |
| 59 HeapVector<Member<USBConfiguration>> configurations() const; | 63 HeapVector<Member<USBConfiguration>> configurations() const; |
| 60 | 64 |
| 65 ScriptPromise open(ScriptState*); |
| 66 ScriptPromise close(ScriptState*); |
| 67 ScriptPromise setConfiguration(ScriptState*, uint8_t configurationValue); |
| 68 ScriptPromise claimInterface(ScriptState*, uint8_t interfaceNumber); |
| 69 ScriptPromise releaseInterface(ScriptState*, uint8_t interfaceNumber); |
| 70 ScriptPromise setInterface(ScriptState*, uint8_t interfaceNumber, uint8_t al
ternateSetting); |
| 71 ScriptPromise controlTransferIn(ScriptState*, const USBControlTransferParame
ters& setup, unsigned length); |
| 72 ScriptPromise controlTransferOut(ScriptState*, const USBControlTransferParam
eters& setup); |
| 73 ScriptPromise controlTransferOut(ScriptState*, const USBControlTransferParam
eters& setup, const ArrayBufferOrArrayBufferView& data); |
| 74 ScriptPromise clearHalt(ScriptState*, uint8_t endpointNumber); |
| 75 ScriptPromise transferIn(ScriptState*, uint8_t endpointNumber, unsigned leng
th); |
| 76 ScriptPromise transferOut(ScriptState*, uint8_t endpointNumber, const ArrayB
ufferOrArrayBufferView& data); |
| 77 ScriptPromise reset(ScriptState*); |
| 78 |
| 61 DEFINE_INLINE_TRACE() { } | 79 DEFINE_INLINE_TRACE() { } |
| 62 | 80 |
| 63 private: | 81 private: |
| 64 OwnPtr<WebUSBDevice> m_device; | 82 OwnPtr<WebUSBDevice> m_device; |
| 65 }; | 83 }; |
| 66 | 84 |
| 67 } // namespace blink | 85 } // namespace blink |
| 68 | 86 |
| 69 #endif // USBDevice_h | 87 #endif // USBDevice_h |
| OLD | NEW |