| 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&>; |
| 20 using WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr
or&>; | 21 using WebUSBDeviceSetConfigurationCallbacks = WebCallbacks<void, const WebUSBErr
or&>; |
| 21 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError
&>; | 22 using WebUSBDeviceClaimInterfaceCallbacks = WebCallbacks<void, const WebUSBError
&>; |
| 22 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr
or&>; | 23 using WebUSBDeviceReleaseInterfaceCallbacks = WebCallbacks<void, const WebUSBErr
or&>; |
| 23 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>; | 24 using WebUSBDeviceResetCallbacks = WebCallbacks<void, const WebUSBError&>; |
| 24 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con
st WebUSBError&>; | 25 using WebUSBDeviceSetInterfaceAlternateSettingCallbacks = WebCallbacks<void, con
st WebUSBError&>; |
| 25 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>; | 26 using WebUSBDeviceClearHaltCallbacks = WebCallbacks<void, const WebUSBError&>; |
| 26 using WebUSBDeviceTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTransferI
nfo>, const WebUSBError&>; | 27 using WebUSBDeviceTransferCallbacks = WebCallbacks<WebPassOwnPtr<WebUSBTransferI
nfo>, const WebUSBError&>; |
| 27 | 28 |
| 28 // TODO(rockot): Eliminate these aliases once they're no longer used outside of | 29 // TODO(rockot): Eliminate these aliases once they're no longer used outside of |
| 29 // Blink code. | 30 // Blink code. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 virtual const WebUSBDeviceInfo& info() const = 0; | 66 virtual const WebUSBDeviceInfo& info() const = 0; |
| 66 | 67 |
| 67 // Opens the device. | 68 // Opens the device. |
| 68 // Ownership of the WebUSBDeviceOpenCallbacks is transferred to the client. | 69 // Ownership of the WebUSBDeviceOpenCallbacks is transferred to the client. |
| 69 virtual void open(WebUSBDeviceOpenCallbacks*) = 0; | 70 virtual void open(WebUSBDeviceOpenCallbacks*) = 0; |
| 70 | 71 |
| 71 // Closes the device. | 72 // Closes the device. |
| 72 // Ownership of the WebUSBDeviceCloseCallbacks is transferred to the client. | 73 // Ownership of the WebUSBDeviceCloseCallbacks is transferred to the client. |
| 73 virtual void close(WebUSBDeviceCloseCallbacks*) = 0; | 74 virtual void close(WebUSBDeviceCloseCallbacks*) = 0; |
| 74 | 75 |
| 76 // Gets the active configuration of the device. |
| 77 // Ownership of the WebUSBDeviceGetConfigurationCallbacks is transferred to
the client. |
| 78 virtual void getConfiguration(WebUSBDeviceGetConfigurationCallbacks*) { } |
| 79 |
| 75 // Sets the active configuration for the device. | 80 // Sets the active configuration for the device. |
| 76 // Ownership of the WebUSBDeviceSetConfigurationCallbacks is transferred to
the client. | 81 // Ownership of the WebUSBDeviceSetConfigurationCallbacks is transferred to
the client. |
| 77 virtual void setConfiguration(uint8_t configurationValue, WebUSBDeviceSetCon
figurationCallbacks*) = 0; | 82 virtual void setConfiguration(uint8_t configurationValue, WebUSBDeviceSetCon
figurationCallbacks*) = 0; |
| 78 | 83 |
| 79 // Claims an interface in the active configuration. | 84 // Claims an interface in the active configuration. |
| 80 // Ownership of the WebUSBDeviceClaimInterfaceCallbacks is transferred to th
e client. | 85 // Ownership of the WebUSBDeviceClaimInterfaceCallbacks is transferred to th
e client. |
| 81 virtual void claimInterface(uint8_t interfaceNumber, WebUSBDeviceClaimInterf
aceCallbacks*) = 0; | 86 virtual void claimInterface(uint8_t interfaceNumber, WebUSBDeviceClaimInterf
aceCallbacks*) = 0; |
| 82 | 87 |
| 83 // Releases a claimed interface. | 88 // Releases a claimed interface. |
| 84 // Ownership of the WebUSBDeviceReleaseInterfaceCallbacks is transferred to
the client. | 89 // Ownership of the WebUSBDeviceReleaseInterfaceCallbacks is transferred to
the client. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 101 virtual void transfer(TransferDirection, uint8_t endpointNumber, uint8_t* da
ta, size_t dataSize, unsigned timeout, WebUSBDeviceBulkTransferCallbacks*) = 0; | 106 virtual void transfer(TransferDirection, uint8_t endpointNumber, uint8_t* da
ta, size_t dataSize, unsigned timeout, WebUSBDeviceBulkTransferCallbacks*) = 0; |
| 102 | 107 |
| 103 // Resets the device. | 108 // Resets the device. |
| 104 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client. | 109 // Ownership of the WebUSBDeviceResetCallbacks is transferred to the client. |
| 105 virtual void reset(WebUSBDeviceResetCallbacks*) = 0; | 110 virtual void reset(WebUSBDeviceResetCallbacks*) = 0; |
| 106 }; | 111 }; |
| 107 | 112 |
| 108 } // namespace blink | 113 } // namespace blink |
| 109 | 114 |
| 110 #endif // WebUSBDevice_h | 115 #endif // WebUSBDevice_h |
| OLD | NEW |