Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: device/usb/usb_device_android.h

Issue 2017273002: Support USB device hotplug on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add dependency on //device/usb:java. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "device/usb/usb_device.h" 9 #include "device/usb/usb_device.h"
10 10
11 namespace device { 11 namespace device {
12 12
13 class UsbDeviceAndroid : public UsbDevice { 13 class UsbDeviceAndroid : public UsbDevice {
14 public: 14 public:
15 // Register C++ methods exposed to Java using JNI. 15 // Register C++ methods exposed to Java using JNI.
16 static bool RegisterJNI(JNIEnv* env); 16 static bool RegisterJNI(JNIEnv* env);
17 17
18 static scoped_refptr<UsbDeviceAndroid> Create( 18 static scoped_refptr<UsbDeviceAndroid> Create(
19 JNIEnv* env, 19 JNIEnv* env,
20 const base::android::JavaRef<jobject>& usb_device); 20 const base::android::JavaRef<jobject>& usb_device);
21 21
22 // UsbDevice: 22 // UsbDevice:
23 void Open(const OpenCallback& callback) override; 23 void Open(const OpenCallback& callback) override;
24 const UsbConfigDescriptor* GetActiveConfiguration() const override; 24 const UsbConfigDescriptor* GetActiveConfiguration() const override;
25 25
26 jint device_id() const { return device_id_; }
27
26 private: 28 private:
27 UsbDeviceAndroid(JNIEnv* env, 29 UsbDeviceAndroid(JNIEnv* env,
28 uint16_t usb_version, 30 uint16_t usb_version,
29 uint8_t device_class, 31 uint8_t device_class,
30 uint8_t device_subclass, 32 uint8_t device_subclass,
31 uint8_t device_protocol, 33 uint8_t device_protocol,
32 uint16_t vendor_id, 34 uint16_t vendor_id,
33 uint16_t product_id, 35 uint16_t product_id,
34 uint16_t device_version, 36 uint16_t device_version,
35 const base::string16& manufacturer_string, 37 const base::string16& manufacturer_string,
36 const base::string16& product_string, 38 const base::string16& product_string,
37 const base::string16& serial_number, 39 const base::string16& serial_number,
38 const base::android::JavaRef<jobject>& wrapper); 40 const base::android::JavaRef<jobject>& wrapper);
39 ~UsbDeviceAndroid() override; 41 ~UsbDeviceAndroid() override;
40 42
43 const jint device_id_;
44
41 // Java object org.chromium.device.usb.ChromeUsbDevice. 45 // Java object org.chromium.device.usb.ChromeUsbDevice.
42 base::android::ScopedJavaGlobalRef<jobject> j_object_; 46 base::android::ScopedJavaGlobalRef<jobject> j_object_;
43 }; 47 };
44 48
45 } // namespace device 49 } // namespace device
46 50
47 #endif // DEVICE_USB_USB_DEVICE_ANDROID_H_ 51 #endif // DEVICE_USB_USB_DEVICE_ANDROID_H_
OLDNEW
« no previous file with comments | « device/usb/android/java/src/org/chromium/device/usb/ChromeUsbService.java ('k') | device/usb/usb_device_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698