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 DEVICE_USB_USB_DEVICE_ANDROID_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_ANDROID_H_ |
6 #define DEVICE_USB_USB_DEVICE_ANDROID_H_ | 6 #define DEVICE_USB_USB_DEVICE_ANDROID_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "device/usb/usb_device.h" | 10 #include "device/usb/usb_device.h" |
11 | 11 |
12 namespace device { | 12 namespace device { |
13 | 13 |
14 class UsbServiceAndroid; | 14 class UsbServiceAndroid; |
15 | 15 |
16 class UsbDeviceAndroid : public UsbDevice { | 16 class UsbDeviceAndroid : public UsbDevice { |
17 public: | 17 public: |
18 // Register C++ methods exposed to Java using JNI. | |
19 static bool RegisterJNI(JNIEnv* env); | |
20 | |
21 static scoped_refptr<UsbDeviceAndroid> Create( | 18 static scoped_refptr<UsbDeviceAndroid> Create( |
22 JNIEnv* env, | 19 JNIEnv* env, |
23 base::WeakPtr<UsbServiceAndroid> service, | 20 base::WeakPtr<UsbServiceAndroid> service, |
24 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, | 21 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, |
25 const base::android::JavaRef<jobject>& usb_device); | 22 const base::android::JavaRef<jobject>& usb_device); |
26 | 23 |
27 // UsbDevice: | 24 // UsbDevice: |
28 void RequestPermission(const ResultCallback& callback) override; | 25 void RequestPermission(const ResultCallback& callback) override; |
29 bool permission_granted() const override; | 26 bool permission_granted() const override; |
30 void Open(const OpenCallback& callback) override; | 27 void Open(const OpenCallback& callback) override; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 std::list<ResultCallback> request_permission_callbacks_; | 64 std::list<ResultCallback> request_permission_callbacks_; |
68 base::WeakPtr<UsbServiceAndroid> service_; | 65 base::WeakPtr<UsbServiceAndroid> service_; |
69 | 66 |
70 // Java object org.chromium.device.usb.ChromeUsbDevice. | 67 // Java object org.chromium.device.usb.ChromeUsbDevice. |
71 base::android::ScopedJavaGlobalRef<jobject> j_object_; | 68 base::android::ScopedJavaGlobalRef<jobject> j_object_; |
72 }; | 69 }; |
73 | 70 |
74 } // namespace device | 71 } // namespace device |
75 | 72 |
76 #endif // DEVICE_USB_USB_DEVICE_ANDROID_H_ | 73 #endif // DEVICE_USB_USB_DEVICE_ANDROID_H_ |
OLD | NEW |