OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ |
6 #define CHROME_BROWSER_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "device/usb/public/interfaces/chooser_service.mojom.h" | 17 #include "device/usb/public/interfaces/chooser_service.mojom.h" |
18 #include "device/usb/usb_service.h" | 18 #include "device/usb/usb_service.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class RenderFrameHost; | 21 class RenderFrameHost; |
22 } | 22 } |
23 | 23 |
24 namespace device { | 24 namespace device { |
25 class UsbDevice; | 25 class UsbDevice; |
26 class UsbDeviceFilter; | 26 struct UsbDeviceFilter; |
27 } | 27 } |
28 | 28 |
29 // Represents a way to ask the user to select a USB device from a list of | 29 // Represents a way to ask the user to select a USB device from a list of |
30 // options. | 30 // options. |
31 class UsbChooserDialogAndroid : public device::UsbService::Observer { | 31 class UsbChooserDialogAndroid : public device::UsbService::Observer { |
32 public: | 32 public: |
33 UsbChooserDialogAndroid( | 33 UsbChooserDialogAndroid( |
34 std::vector<device::usb::DeviceFilterPtr> filters, | 34 const std::vector<device::UsbDeviceFilter>& filters, |
35 content::RenderFrameHost* render_frame_host, | 35 content::RenderFrameHost* render_frame_host, |
36 const device::usb::ChooserService::GetPermissionCallback& callback); | 36 const device::usb::ChooserService::GetPermissionCallback& callback); |
37 ~UsbChooserDialogAndroid() override; | 37 ~UsbChooserDialogAndroid() override; |
38 | 38 |
39 // device::UsbService::Observer: | 39 // device::UsbService::Observer: |
40 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; | 40 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; |
41 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; | 41 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; |
42 | 42 |
43 // Report the dialog's result. | 43 // Report the dialog's result. |
44 void OnItemSelected(JNIEnv* env, | 44 void OnItemSelected(JNIEnv* env, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 std::vector<scoped_refptr<device::UsbDevice>> devices_; | 79 std::vector<scoped_refptr<device::UsbDevice>> devices_; |
80 | 80 |
81 base::android::ScopedJavaGlobalRef<jobject> java_dialog_; | 81 base::android::ScopedJavaGlobalRef<jobject> java_dialog_; |
82 base::WeakPtrFactory<UsbChooserDialogAndroid> weak_factory_; | 82 base::WeakPtrFactory<UsbChooserDialogAndroid> weak_factory_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(UsbChooserDialogAndroid); | 84 DISALLOW_COPY_AND_ASSIGN(UsbChooserDialogAndroid); |
85 }; | 85 }; |
86 | 86 |
87 #endif // CHROME_BROWSER_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ | 87 #endif // CHROME_BROWSER_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ |
OLD | NEW |