| 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/array.h" | |
| 14 #include "mojo/public/cpp/bindings/binding_set.h" | 13 #include "mojo/public/cpp/bindings/binding_set.h" |
| 15 #include "mojo/public/cpp/bindings/interface_request.h" | 14 #include "mojo/public/cpp/bindings/interface_request.h" |
| 16 | 15 |
| 17 class UsbChooserDialogAndroid; | 16 class UsbChooserDialogAndroid; |
| 18 | 17 |
| 19 namespace content { | 18 namespace content { |
| 20 class RenderFrameHost; | 19 class RenderFrameHost; |
| 21 } | 20 } |
| 22 | 21 |
| 23 // Implementation of the public device::usb::ChooserService interface. | 22 // Implementation of the public device::usb::ChooserService interface. |
| 24 // 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 |
| 25 // to access a certain device. | 24 // to access a certain device. |
| 26 class WebUsbChooserServiceAndroid : public device::usb::ChooserService { | 25 class WebUsbChooserServiceAndroid : public device::usb::ChooserService { |
| 27 public: | 26 public: |
| 28 explicit WebUsbChooserServiceAndroid( | 27 explicit WebUsbChooserServiceAndroid( |
| 29 content::RenderFrameHost* render_frame_host); | 28 content::RenderFrameHost* render_frame_host); |
| 30 | 29 |
| 31 ~WebUsbChooserServiceAndroid() override; | 30 ~WebUsbChooserServiceAndroid() override; |
| 32 | 31 |
| 33 // device::usb::ChooserService: | 32 // device::usb::ChooserService: |
| 34 void GetPermission(mojo::Array<device::usb::DeviceFilterPtr> device_filters, | 33 void GetPermission(std::vector<device::usb::DeviceFilterPtr> device_filters, |
| 35 const GetPermissionCallback& callback) override; | 34 const GetPermissionCallback& callback) override; |
| 36 | 35 |
| 37 void Bind(mojo::InterfaceRequest<device::usb::ChooserService> request); | 36 void Bind(mojo::InterfaceRequest<device::usb::ChooserService> request); |
| 38 | 37 |
| 39 private: | 38 private: |
| 40 content::RenderFrameHost* const render_frame_host_; | 39 content::RenderFrameHost* const render_frame_host_; |
| 41 mojo::BindingSet<device::usb::ChooserService> bindings_; | 40 mojo::BindingSet<device::usb::ChooserService> bindings_; |
| 42 std::vector<std::unique_ptr<UsbChooserDialogAndroid>> | 41 std::vector<std::unique_ptr<UsbChooserDialogAndroid>> |
| 43 usb_chooser_dialog_android_; | 42 usb_chooser_dialog_android_; |
| 44 | 43 |
| 45 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserServiceAndroid); | 44 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserServiceAndroid); |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 #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 |