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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 struct 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 const std::vector<device::UsbDeviceFilter>& 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::mojom::UsbChooserService::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, |
45 const base::android::JavaParamRef<jobject>& obj, | 45 const base::android::JavaParamRef<jobject>& obj, |
46 const base::android::JavaParamRef<jstring>& device_id); | 46 const base::android::JavaParamRef<jstring>& device_id); |
(...skipping 17 matching lines...) Expand all Loading... |
64 | 64 |
65 void AddDeviceToChooserDialog(scoped_refptr<device::UsbDevice> device) const; | 65 void AddDeviceToChooserDialog(scoped_refptr<device::UsbDevice> device) const; |
66 void RemoveDeviceFromChooserDialog( | 66 void RemoveDeviceFromChooserDialog( |
67 scoped_refptr<device::UsbDevice> device) const; | 67 scoped_refptr<device::UsbDevice> device) const; |
68 | 68 |
69 void OpenUrl(const std::string& url); | 69 void OpenUrl(const std::string& url); |
70 | 70 |
71 bool DisplayDevice(scoped_refptr<device::UsbDevice> device) const; | 71 bool DisplayDevice(scoped_refptr<device::UsbDevice> device) const; |
72 | 72 |
73 content::RenderFrameHost* const render_frame_host_; | 73 content::RenderFrameHost* const render_frame_host_; |
74 device::usb::ChooserService::GetPermissionCallback callback_; | 74 device::mojom::UsbChooserService::GetPermissionCallback callback_; |
75 ScopedObserver<device::UsbService, device::UsbService::Observer> | 75 ScopedObserver<device::UsbService, device::UsbService::Observer> |
76 usb_service_observer_; | 76 usb_service_observer_; |
77 std::vector<device::UsbDeviceFilter> filters_; | 77 std::vector<device::UsbDeviceFilter> filters_; |
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 |