| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_USB_WEB_USB_DEVICE_IMPL_H_ | |
| 6 #define CONTENT_RENDERER_USB_WEB_USB_DEVICE_IMPL_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "device/usb/public/interfaces/device.mojom.h" | |
| 15 #include "device/usb/public/interfaces/device_manager.mojom.h" | |
| 16 #include "mojo/shell/public/interfaces/interface_provider.mojom.h" | |
| 17 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDevice.h" | |
| 18 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceInfo.h" | |
| 19 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBError.h" | |
| 20 | |
| 21 namespace mojo { | |
| 22 class Shell; | |
| 23 } | |
| 24 | |
| 25 namespace content { | |
| 26 | |
| 27 class WebUSBDeviceImpl : public blink::WebUSBDevice { | |
| 28 public: | |
| 29 WebUSBDeviceImpl(device::usb::DevicePtr device, | |
| 30 const blink::WebUSBDeviceInfo& device_info); | |
| 31 ~WebUSBDeviceImpl() override; | |
| 32 | |
| 33 private: | |
| 34 // blink::WebUSBDevice implementation: | |
| 35 const blink::WebUSBDeviceInfo& info() const override; | |
| 36 void open(blink::WebUSBDeviceOpenCallbacks* callbacks) override; | |
| 37 void close(blink::WebUSBDeviceCloseCallbacks* callbacks) override; | |
| 38 void setConfiguration( | |
| 39 uint8_t configuration_value, | |
| 40 blink::WebUSBDeviceSetConfigurationCallbacks* callbacks) override; | |
| 41 void claimInterface( | |
| 42 uint8_t interface_number, | |
| 43 blink::WebUSBDeviceClaimInterfaceCallbacks* callbacks) override; | |
| 44 void releaseInterface( | |
| 45 uint8_t interface_number, | |
| 46 blink::WebUSBDeviceReleaseInterfaceCallbacks* callbacks) override; | |
| 47 void setInterface(uint8_t interface_number, | |
| 48 uint8_t alternate_setting, | |
| 49 blink::WebUSBDeviceSetInterfaceAlternateSettingCallbacks* | |
| 50 callbacks) override; | |
| 51 void clearHalt(uint8_t endpoint_number, | |
| 52 blink::WebUSBDeviceClearHaltCallbacks* callbacks) override; | |
| 53 void controlTransfer( | |
| 54 const blink::WebUSBDevice::ControlTransferParameters& parameters, | |
| 55 uint8_t* data, | |
| 56 size_t data_size, | |
| 57 unsigned int timeout, | |
| 58 blink::WebUSBDeviceTransferCallbacks* callbacks) override; | |
| 59 void transfer(blink::WebUSBDevice::TransferDirection direction, | |
| 60 uint8_t endpoint_number, | |
| 61 uint8_t* data, | |
| 62 size_t data_size, | |
| 63 unsigned int timeout, | |
| 64 blink::WebUSBDeviceTransferCallbacks* callbacks) override; | |
| 65 void isochronousTransfer( | |
| 66 blink::WebUSBDevice::TransferDirection direction, | |
| 67 uint8_t endpoint_number, | |
| 68 uint8_t* data, | |
| 69 size_t data_size, | |
| 70 blink::WebVector<uint32_t> packet_lengths, | |
| 71 unsigned int timeout, | |
| 72 blink::WebUSBDeviceTransferCallbacks* callbacks) override; | |
| 73 void reset(blink::WebUSBDeviceResetCallbacks* callbacks) override; | |
| 74 | |
| 75 device::usb::DevicePtr device_; | |
| 76 blink::WebUSBDeviceInfo device_info_; | |
| 77 | |
| 78 base::WeakPtrFactory<WebUSBDeviceImpl> weak_factory_; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(WebUSBDeviceImpl); | |
| 81 }; | |
| 82 | |
| 83 } // namespace content | |
| 84 | |
| 85 #endif // CONTENT_RENDERER_USB_WEB_USB_DEVICE_IMPL_H_ | |
| OLD | NEW |