| 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 #include "mojo/public/cpp/bindings/array.h" | |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 class RenderFrameHost; | 21 class RenderFrameHost; |
| 23 class WebContents; | 22 class WebContents; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace device { | 25 namespace device { |
| 27 class UsbDevice; | 26 class UsbDevice; |
| 28 class UsbDeviceFilter; | 27 class UsbDeviceFilter; |
| 29 } | 28 } |
| 30 | 29 |
| 31 // Represents a way to ask the user to select a USB device from a list of | 30 // Represents a way to ask the user to select a USB device from a list of |
| 32 // options. | 31 // options. |
| 33 class UsbChooserDialogAndroid : public device::UsbService::Observer { | 32 class UsbChooserDialogAndroid : public device::UsbService::Observer { |
| 34 public: | 33 public: |
| 35 UsbChooserDialogAndroid( | 34 UsbChooserDialogAndroid( |
| 36 mojo::Array<device::usb::DeviceFilterPtr> device_filters, | 35 std::vector<device::usb::DeviceFilterPtr> filters, |
| 37 content::RenderFrameHost* render_frame_host, | 36 content::RenderFrameHost* render_frame_host, |
| 38 const device::usb::ChooserService::GetPermissionCallback& callback); | 37 const device::usb::ChooserService::GetPermissionCallback& callback); |
| 39 ~UsbChooserDialogAndroid() override; | 38 ~UsbChooserDialogAndroid() override; |
| 40 | 39 |
| 41 // device::UsbService::Observer: | 40 // device::UsbService::Observer: |
| 42 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; | 41 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; |
| 43 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; | 42 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; |
| 44 | 43 |
| 45 // Report the dialog's result. | 44 // Report the dialog's result. |
| 46 void OnItemSelected(JNIEnv* env, | 45 void OnItemSelected(JNIEnv* env, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 79 |
| 81 std::vector<scoped_refptr<device::UsbDevice>> devices_; | 80 std::vector<scoped_refptr<device::UsbDevice>> devices_; |
| 82 | 81 |
| 83 base::android::ScopedJavaGlobalRef<jobject> java_dialog_; | 82 base::android::ScopedJavaGlobalRef<jobject> java_dialog_; |
| 84 base::WeakPtrFactory<UsbChooserDialogAndroid> weak_factory_; | 83 base::WeakPtrFactory<UsbChooserDialogAndroid> weak_factory_; |
| 85 | 84 |
| 86 DISALLOW_COPY_AND_ASSIGN(UsbChooserDialogAndroid); | 85 DISALLOW_COPY_AND_ASSIGN(UsbChooserDialogAndroid); |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 #endif // CHROME_BROWSER_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ | 88 #endif // CHROME_BROWSER_UI_ANDROID_USB_CHOOSER_DIALOG_ANDROID_H_ |
| OLD | NEW |