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_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ |
6 #define CHROME_BROWSER_USB_WEB_USB_CHOOSER_SERVICE_H_ | 6 #define CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ |
7 | |
8 #include <vector> | |
9 | 7 |
10 #include "base/macros.h" | 8 #include "base/macros.h" |
11 #include "components/bubble/bubble_reference.h" | 9 #include "base/memory/scoped_ptr.h" |
12 #include "device/usb/public/interfaces/chooser_service.mojom.h" | 10 #include "device/usb/public/interfaces/chooser_service.mojom.h" |
13 #include "mojo/public/cpp/bindings/array.h" | 11 #include "mojo/public/cpp/bindings/array.h" |
14 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
15 #include "mojo/public/cpp/bindings/interface_request.h" | 13 #include "mojo/public/cpp/bindings/interface_request.h" |
16 | 14 |
15 class UsbChooserAndroid; | |
16 | |
17 namespace content { | 17 namespace content { |
18 class RenderFrameHost; | 18 class RenderFrameHost; |
19 } | 19 } |
20 | 20 |
21 namespace device { | 21 namespace device { |
22 class UsbDevice; | 22 class UsbDevice; |
Reilly Grant (use Gerrit)
2016/03/04 20:53:39
This forward declaration is unused.
juncai
2016/03/05 00:18:25
Done.
| |
23 } | 23 } |
24 | 24 |
25 // Implementation of the public device::usb::ChooserService interface. | 25 // Implementation of the public device::usb::ChooserService interface. |
26 // This interface can be used by a webpage to request permission from user | 26 // This interface can be used by a webpage to request permission from user |
27 // to access a certain device. | 27 // to access a certain device. |
28 class WebUsbChooserService : public device::usb::ChooserService { | 28 class WebUsbChooserServiceAndroid : public device::usb::ChooserService { |
29 public: | 29 public: |
30 explicit WebUsbChooserService(content::RenderFrameHost* render_frame_host); | 30 explicit WebUsbChooserServiceAndroid( |
31 content::RenderFrameHost* render_frame_host); | |
31 | 32 |
32 ~WebUsbChooserService() override; | 33 ~WebUsbChooserServiceAndroid() override; |
33 | 34 |
34 // device::usb::ChooserService: | 35 // device::usb::ChooserService: |
35 void GetPermission(mojo::Array<device::usb::DeviceFilterPtr> device_filters, | 36 void GetPermission(mojo::Array<device::usb::DeviceFilterPtr> device_filters, |
36 const GetPermissionCallback& callback) override; | 37 const GetPermissionCallback& callback) override; |
37 | 38 |
38 void Bind(mojo::InterfaceRequest<device::usb::ChooserService> request); | 39 void Bind(mojo::InterfaceRequest<device::usb::ChooserService> request); |
39 | 40 |
40 private: | 41 private: |
41 content::RenderFrameHost* const render_frame_host_; | 42 content::RenderFrameHost* const render_frame_host_; |
42 mojo::BindingSet<device::usb::ChooserService> bindings_; | 43 mojo::BindingSet<device::usb::ChooserService> bindings_; |
43 std::vector<BubbleReference> bubbles_; | 44 scoped_ptr<UsbChooserAndroid> usb_chooser_android_; |
44 | 45 |
45 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserService); | 46 DISALLOW_COPY_AND_ASSIGN(WebUsbChooserServiceAndroid); |
46 }; | 47 }; |
47 | 48 |
48 #endif // CHROME_BROWSER_USB_WEB_USB_CHOOSER_SERVICE_H_ | 49 #endif // CHROME_BROWSER_ANDROID_USB_WEB_USB_CHOOSER_SERVICE_ANDROID_H_ |
OLD | NEW |