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_SERVICE_ANDROID_H_ | 5 #ifndef DEVICE_USB_USB_SERVICE_ANDROID_H_ |
6 #define DEVICE_USB_USB_SERVICE_ANDROID_H_ | 6 #define DEVICE_USB_USB_SERVICE_ANDROID_H_ |
7 | 7 |
8 #include <string> | 8 #include <jni.h> |
| 9 |
9 #include <unordered_map> | 10 #include <unordered_map> |
10 | 11 |
11 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "device/usb/usb_device_android.h" | |
15 #include "device/usb/usb_service.h" | 15 #include "device/usb/usb_service.h" |
16 | 16 |
17 namespace base { | 17 namespace device { |
18 class SequencedTaskRunner; | |
19 } | |
20 | 18 |
21 namespace device { | 19 class UsbDeviceAndroid; |
22 | 20 |
23 // USB service implementation for Android. This is a stub implementation that | 21 // USB service implementation for Android. This is a stub implementation that |
24 // does not return any devices. | 22 // does not return any devices. |
25 class UsbServiceAndroid : public UsbService { | 23 class UsbServiceAndroid : public UsbService { |
26 public: | 24 public: |
27 // Register C++ methods exposed to Java using JNI. | 25 // Register C++ methods exposed to Java using JNI. |
28 static bool RegisterJNI(JNIEnv* env); | 26 static bool RegisterJNI(JNIEnv* env); |
29 | 27 |
30 UsbServiceAndroid( | 28 UsbServiceAndroid(); |
31 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | |
32 ~UsbServiceAndroid() override; | 29 ~UsbServiceAndroid() override; |
33 | 30 |
34 // Methods called by Java. | 31 // Methods called by Java. |
35 void DeviceAttached(JNIEnv* env, | 32 void DeviceAttached(JNIEnv* env, |
36 const base::android::JavaRef<jobject>& caller, | 33 const base::android::JavaRef<jobject>& caller, |
37 const base::android::JavaRef<jobject>& usb_device); | 34 const base::android::JavaRef<jobject>& usb_device); |
38 void DeviceDetached(JNIEnv* env, | 35 void DeviceDetached(JNIEnv* env, |
39 const base::android::JavaRef<jobject>& caller, | 36 const base::android::JavaRef<jobject>& caller, |
40 jint device_id); | 37 jint device_id); |
41 void DevicePermissionRequestComplete( | 38 void DevicePermissionRequestComplete( |
(...skipping 16 matching lines...) Expand all Loading... |
58 | 55 |
59 // Java object org.chromium.device.usb.ChromeUsbService. | 56 // Java object org.chromium.device.usb.ChromeUsbService. |
60 base::android::ScopedJavaGlobalRef<jobject> j_object_; | 57 base::android::ScopedJavaGlobalRef<jobject> j_object_; |
61 | 58 |
62 base::WeakPtrFactory<UsbServiceAndroid> weak_factory_; | 59 base::WeakPtrFactory<UsbServiceAndroid> weak_factory_; |
63 }; | 60 }; |
64 | 61 |
65 } // namespace device | 62 } // namespace device |
66 | 63 |
67 #endif // DEVICE_USB_USB_SERVICE_ANDROID_H_ | 64 #endif // DEVICE_USB_USB_SERVICE_ANDROID_H_ |
OLD | NEW |