| 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_USB_WEB_USB_CHOOSER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_USB_WEB_USB_CHOOSER_SERVICE_H_ |
| 6 #define CHROME_BROWSER_USB_WEB_USB_CHOOSER_SERVICE_H_ | 6 #define CHROME_BROWSER_USB_WEB_USB_CHOOSER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/bubble/bubble_reference.h" | 11 #include "components/bubble/bubble_reference.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 namespace content { | 16 namespace content { |
| 18 class RenderFrameHost; | 17 class RenderFrameHost; |
| 19 } | 18 } |
| 20 | 19 |
| 21 namespace device { | 20 namespace device { |
| 22 class UsbDevice; | 21 class UsbDevice; |
| 23 } | 22 } |
| 24 | 23 |
| 25 // Implementation of the public device::usb::ChooserService interface. | 24 // Implementation of the public device::usb::ChooserService interface. |
| 26 // This interface can be used by a webpage to request permission from user | 25 // This interface can be used by a webpage to request permission from user |
| 27 // to access a certain device. | 26 // to access a certain device. |
| 28 class WebUsbChooserService : public device::usb::ChooserService { | 27 class WebUsbChooserService : public device::usb::ChooserService { |
| 29 public: | 28 public: |
| 30 explicit WebUsbChooserService(content::RenderFrameHost* render_frame_host); | 29 explicit WebUsbChooserService(content::RenderFrameHost* render_frame_host); |
| 31 | 30 |
| 32 ~WebUsbChooserService() override; | 31 ~WebUsbChooserService() override; |
| 33 | 32 |
| 34 // device::usb::ChooserService: | 33 // device::usb::ChooserService: |
| 35 void GetPermission(mojo::Array<device::usb::DeviceFilterPtr> device_filters, | 34 void GetPermission(std::vector<device::usb::DeviceFilterPtr> device_filters, |
| 36 const GetPermissionCallback& callback) override; | 35 const GetPermissionCallback& callback) override; |
| 37 | 36 |
| 38 void Bind(mojo::InterfaceRequest<device::usb::ChooserService> request); | 37 void Bind(mojo::InterfaceRequest<device::usb::ChooserService> request); |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 content::RenderFrameHost* const render_frame_host_; | 40 content::RenderFrameHost* const render_frame_host_; |
| 42 mojo::BindingSet<device::usb::ChooserService> bindings_; | 41 mojo::BindingSet<device::usb::ChooserService> bindings_; |
| 43 std::vector<BubbleReference> bubbles_; | 42 std::vector<BubbleReference> bubbles_; |
| 44 | 43 |
| 45 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserService); | 44 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserService); |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 #endif // CHROME_BROWSER_USB_WEB_USB_CHOOSER_SERVICE_H_ | 47 #endif // CHROME_BROWSER_USB_WEB_USB_CHOOSER_SERVICE_H_ |
| OLD | NEW |