Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: content/renderer/usb/web_usb_device_impl.h

Issue 1850023002: Consume Mojo services directly in Blink's WebUSB implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove promise adapters, use WTF::bind instead. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 <memory>
12
13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h"
15 #include "device/usb/public/interfaces/device.mojom.h"
16 #include "device/usb/public/interfaces/device_manager.mojom.h"
17 #include "services/shell/public/interfaces/interface_provider.mojom.h"
18 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDevice.h"
19 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceInfo.h"
20 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBError.h"
21
22 namespace mojo {
23 class Shell;
24 }
25
26 namespace content {
27
28 class WebUSBDeviceImpl : public blink::WebUSBDevice {
29 public:
30 WebUSBDeviceImpl(device::usb::DevicePtr device,
31 const blink::WebUSBDeviceInfo& device_info);
32 ~WebUSBDeviceImpl() override;
33
34 private:
35 // blink::WebUSBDevice implementation:
36 const blink::WebUSBDeviceInfo& info() const override;
37 void open(blink::WebUSBDeviceOpenCallbacks* callbacks) override;
38 void close(blink::WebUSBDeviceCloseCallbacks* callbacks) override;
39 void setConfiguration(
40 uint8_t configuration_value,
41 blink::WebUSBDeviceSetConfigurationCallbacks* callbacks) override;
42 void claimInterface(
43 uint8_t interface_number,
44 blink::WebUSBDeviceClaimInterfaceCallbacks* callbacks) override;
45 void releaseInterface(
46 uint8_t interface_number,
47 blink::WebUSBDeviceReleaseInterfaceCallbacks* callbacks) override;
48 void setInterface(uint8_t interface_number,
49 uint8_t alternate_setting,
50 blink::WebUSBDeviceSetInterfaceAlternateSettingCallbacks*
51 callbacks) override;
52 void clearHalt(uint8_t endpoint_number,
53 blink::WebUSBDeviceClearHaltCallbacks* callbacks) override;
54 void controlTransfer(
55 const blink::WebUSBDevice::ControlTransferParameters& parameters,
56 uint8_t* data,
57 size_t data_size,
58 unsigned int timeout,
59 blink::WebUSBDeviceTransferCallbacks* callbacks) override;
60 void transfer(blink::WebUSBDevice::TransferDirection direction,
61 uint8_t endpoint_number,
62 uint8_t* data,
63 size_t data_size,
64 unsigned int timeout,
65 blink::WebUSBDeviceTransferCallbacks* callbacks) override;
66 void isochronousTransfer(
67 blink::WebUSBDevice::TransferDirection direction,
68 uint8_t endpoint_number,
69 uint8_t* data,
70 size_t data_size,
71 blink::WebVector<uint32_t> packet_lengths,
72 unsigned int timeout,
73 blink::WebUSBDeviceTransferCallbacks* callbacks) override;
74 void reset(blink::WebUSBDeviceResetCallbacks* callbacks) override;
75
76 device::usb::DevicePtr device_;
77 blink::WebUSBDeviceInfo device_info_;
78
79 base::WeakPtrFactory<WebUSBDeviceImpl> weak_factory_;
80
81 DISALLOW_COPY_AND_ASSIGN(WebUSBDeviceImpl);
82 };
83
84 } // namespace content
85
86 #endif // CONTENT_RENDERER_USB_WEB_USB_DEVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698