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 CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ |
6 #define CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "device/usb/public/interfaces/chooser_service.mojom.h" | 12 #include "device/usb/public/interfaces/chooser_service.mojom.h" |
13 #include "mojo/public/cpp/bindings/binding_set.h" | 13 #include "mojo/public/cpp/bindings/binding_set.h" |
14 #include "mojo/public/cpp/bindings/interface_request.h" | 14 #include "mojo/public/cpp/bindings/interface_request.h" |
15 | 15 |
16 class UsbChooserDialogAndroid; | 16 class UsbChooserDialogAndroid; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class RenderFrameHost; | 19 class RenderFrameHost; |
20 } | 20 } |
21 | 21 |
22 // Implementation of the public device::usb::ChooserService interface. | 22 // Implementation of the public device::usb::ChooserService interface. |
23 // This interface can be used by a webpage to request permission from user | 23 // This interface can be used by a webpage to request permission from user |
24 // to access a certain device. | 24 // to access a certain device. |
25 class WebUsbChooserServiceAndroid : public device::usb::ChooserService { | 25 class WebUsbChooserServiceAndroid : public device::mojom::UsbChooserService { |
26 public: | 26 public: |
27 explicit WebUsbChooserServiceAndroid( | 27 explicit WebUsbChooserServiceAndroid( |
28 content::RenderFrameHost* render_frame_host); | 28 content::RenderFrameHost* render_frame_host); |
29 | 29 |
30 ~WebUsbChooserServiceAndroid() override; | 30 ~WebUsbChooserServiceAndroid() override; |
31 | 31 |
32 // device::usb::ChooserService: | 32 // device::usb::ChooserService: |
33 void GetPermission(const std::vector<device::UsbDeviceFilter>& device_filters, | 33 void GetPermission(const std::vector<device::UsbDeviceFilter>& device_filters, |
34 const GetPermissionCallback& callback) override; | 34 const GetPermissionCallback& callback) override; |
35 | 35 |
36 void Bind(mojo::InterfaceRequest<device::usb::ChooserService> request); | 36 void Bind(mojo::InterfaceRequest<device::mojom::UsbChooserService> request); |
37 | 37 |
38 private: | 38 private: |
39 content::RenderFrameHost* const render_frame_host_; | 39 content::RenderFrameHost* const render_frame_host_; |
40 mojo::BindingSet<device::usb::ChooserService> bindings_; | 40 mojo::BindingSet<device::mojom::UsbChooserService> bindings_; |
41 std::vector<std::unique_ptr<UsbChooserDialogAndroid>> | 41 std::vector<std::unique_ptr<UsbChooserDialogAndroid>> |
42 usb_chooser_dialog_android_; | 42 usb_chooser_dialog_android_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserServiceAndroid); | 44 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserServiceAndroid); |
45 }; | 45 }; |
46 | 46 |
47 #endif // CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ | 47 #endif // CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ |
OLD | NEW |