| 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 WebUSBDevice_h | 5 #ifndef WebUSBDevice_h |
| 6 #define WebUSBDevice_h | 6 #define WebUSBDevice_h |
| 7 | 7 |
| 8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
| 9 #include "public/platform/WebPassOwnPtr.h" | 9 #include "public/platform/WebPassOwnPtr.h" |
| 10 #include "public/platform/WebVector.h" | 10 #include "public/platform/WebVector.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 struct WebUSBDeviceInfo; | 14 struct WebUSBDeviceInfo; |
| 15 struct WebUSBError; | 15 struct WebUSBError; |
| 16 struct WebUSBTransferInfo; | 16 struct WebUSBTransferInfo; |
| 17 | 17 |
| 18 using WebUSBDeviceOpenCallbacks = WebCallbacks<void, const WebUSBError&>; | 18 using WebUSBDeviceOpenCallbacks = WebCallbacks<void, const WebUSBError&>; |
| 19 using WebUSBDeviceCloseCallbacks = WebCallbacks<void, const WebUSBError&>; | 19 using WebUSBDeviceCloseCallbacks = WebCallbacks<void, const WebUSBError&>; |
| 20 using WebUSBDeviceGetConfigurationCallbacks = WebCallbacks<uint8_t, const WebUSB
Error&>; | |
| 21 using WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr
or&>; | 20 using WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr
or&>; |
| 22 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError
&>; | 21 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError
&>; |
| 23 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr
or&>; | 22 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr
or&>; |
| 24 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>; | 23 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>; |
| 25 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con
st WebUSBError&>; | 24 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con
st WebUSBError&>; |
| 26 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>; | 25 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>; |
| 27 using WebUSBDeviceTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTransferI
nfo>, const WebUSBError&>; | 26 using WebUSBDeviceTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTransferI
nfo>, const WebUSBError&>; |
| 28 | 27 |
| 29 class WebUSBDevice { | 28 class WebUSBDevice { |
| 30 public: | 29 public: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 60 virtual const WebUSBDeviceInfo& info() const = 0; | 59 virtual const WebUSBDeviceInfo& info() const = 0; |
| 61 | 60 |
| 62 // Opens the device. | 61 // Opens the device. |
| 63 // Ownership of the WebUSBDeviceOpenCallbacks is transferred to the client. | 62 // Ownership of the WebUSBDeviceOpenCallbacks is transferred to the client. |
| 64 virtual void open(WebUSBDeviceOpenCallbacks*) = 0; | 63 virtual void open(WebUSBDeviceOpenCallbacks*) = 0; |
| 65 | 64 |
| 66 // Closes the device. | 65 // Closes the device. |
| 67 // Ownership of the WebUSBDeviceCloseCallbacks is transferred to the client. | 66 // Ownership of the WebUSBDeviceCloseCallbacks is transferred to the client. |
| 68 virtual void close(WebUSBDeviceCloseCallbacks*) = 0; | 67 virtual void close(WebUSBDeviceCloseCallbacks*) = 0; |
| 69 | 68 |
| 70 // Gets the active configuration of the device. | |
| 71 // Ownership of the WebUSBDeviceGetConfigurationCallbacks is transferred to
the client. | |
| 72 virtual void getConfiguration(WebUSBDeviceGetConfigurationCallbacks*) = 0; | |
| 73 | |
| 74 // Sets the active configuration for the device. | 69 // Sets the active configuration for the device. |
| 75 // Ownership of the WebUSBDeviceSetConfigurationCallbacks is transferred to
the client. | 70 // Ownership of the WebUSBDeviceSetConfigurationCallbacks is transferred to
the client. |
| 76 virtual void setConfiguration(uint8_t configurationValue, WebUSBDeviceSetCon
figurationCallbacks*) = 0; | 71 virtual void setConfiguration(uint8_t configurationValue, WebUSBDeviceSetCon
figurationCallbacks*) = 0; |
| 77 | 72 |
| 78 // Claims an interface in the active configuration. | 73 // Claims an interface in the active configuration. |
| 79 // Ownership of the WebUSBDeviceClaimInterfaceCallbacks is transferred to th
e client. | 74 // Ownership of the WebUSBDeviceClaimInterfaceCallbacks is transferred to th
e client. |
| 80 virtual void claimInterface(uint8_t interfaceNumber, WebUSBDeviceClaimInterf
aceCallbacks*) = 0; | 75 virtual void claimInterface(uint8_t interfaceNumber, WebUSBDeviceClaimInterf
aceCallbacks*) = 0; |
| 81 | 76 |
| 82 // Releases a claimed interface. | 77 // Releases a claimed interface. |
| 83 // Ownership of the WebUSBDeviceReleaseInterfaceCallbacks is transferred to
the client. | 78 // Ownership of the WebUSBDeviceReleaseInterfaceCallbacks is transferred to
the client. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 104 virtual void isochronousTransfer(TransferDirection, uint8_t endpointNumber,
uint8_t* data, size_t dataSize, WebVector<unsigned> packetLengths, unsigned time
out, WebUSBDeviceTransferCallbacks*) = 0; | 99 virtual void isochronousTransfer(TransferDirection, uint8_t endpointNumber,
uint8_t* data, size_t dataSize, WebVector<unsigned> packetLengths, unsigned time
out, WebUSBDeviceTransferCallbacks*) = 0; |
| 105 | 100 |
| 106 // Resets the device. | 101 // Resets the device. |
| 107 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client. | 102 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client. |
| 108 virtual void reset(WebUSBDeviceResetCallbacks*) = 0; | 103 virtual void reset(WebUSBDeviceResetCallbacks*) = 0; |
| 109 }; | 104 }; |
| 110 | 105 |
| 111 } // namespace blink | 106 } // namespace blink |
| 112 | 107 |
| 113 #endif // WebUSBDevice_h | 108 #endif // WebUSBDevice_h |
| OLD | NEW |