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 "base/macros.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "device/devices_app/usb/public/interfaces/device.mojom.h" | |
12 #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h" | |
13 #include "mojo/application/public/interfaces/service_provider.mojom.h" | |
14 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDevice.h" | |
15 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceInfo.h" | |
16 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBError.h" | |
17 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" | |
18 | |
19 namespace mojo { | |
20 class Shell; | |
21 } | |
22 | |
23 namespace content { | |
24 | |
25 class WebUSBDeviceImpl : public blink::WebUSBDevice, public mojo::ErrorHandler { | |
26 public: | |
27 WebUSBDeviceImpl(device::usb::DeviceManagerPtr device_manager, | |
28 const blink::WebUSBDeviceInfo& device_info); | |
29 ~WebUSBDeviceImpl() override; | |
30 | |
31 private: | |
32 // blink::WebUSBDevice implementation: | |
33 const blink::WebUSBDeviceInfo& info() const override; | |
34 void open(blink::WebUSBDeviceOpenCallbacks* callbacks) override; | |
35 void close(blink::WebUSBDeviceCloseCallbacks* callbacks) override; | |
36 void setConfiguration( | |
37 uint8_t configuration_value, | |
38 blink::WebUSBDeviceSetConfigurationCallbacks* callbacks) override; | |
39 void claimInterface( | |
40 uint8_t interface_number, | |
41 blink::WebUSBDeviceClaimInterfaceCallbacks* callbacks) override; | |
42 void releaseInterface( | |
43 uint8_t interface_number, | |
44 blink::WebUSBDeviceReleaseInterfaceCallbacks* callbacks) override; | |
45 void setInterface(uint8_t interface_number, | |
46 uint8_t alternate_setting, | |
47 blink::WebUSBDeviceSetInterfaceAlternateSettingCallbacks* | |
48 callbacks) override; | |
49 void clearHalt(uint8_t endpoint_number, | |
50 blink::WebUSBDeviceClearHaltCallbacks* callbacks) override; | |
51 void controlTransfer( | |
52 const blink::WebUSBDevice::ControlTransferParameters& parameters, | |
53 uint8_t* data, | |
54 size_t data_size, | |
55 unsigned int timeout, | |
56 blink::WebUSBDeviceControlTransferCallbacks* callbacks) override; | |
57 void transfer(blink::WebUSBDevice::TransferDirection direction, | |
58 uint8_t endpoint_number, | |
59 uint8_t* data, | |
60 size_t data_size, | |
61 unsigned int timeout, | |
62 blink::WebUSBDeviceBulkTransferCallbacks* callbacks) override; | |
63 void reset(blink::WebUSBDeviceResetCallbacks* callbacks) override; | |
64 | |
65 // mojo::ErrorHandler implementation: | |
66 void OnConnectionError() override; | |
67 | |
68 device::usb::DeviceManagerPtr device_manager_; | |
69 | |
70 blink::WebUSBDeviceInfo device_info_; | |
71 device::usb::DevicePtr device_; | |
72 | |
73 base::WeakPtrFactory<WebUSBDeviceImpl> weak_factory_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(WebUSBDeviceImpl); | |
76 }; | |
77 }; | |
Reilly Grant (use Gerrit)
2015/08/17 22:41:36
nits: no semicolon when closing namespace, add a b
Ken Rockot(use gerrit already)
2015/08/17 22:50:07
Done.
| |
78 | |
79 #endif // CONTENT_RENDERER_USB_WEB_USB_DEVICE_IMPL_H_ | |
OLD | NEW |