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

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

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
« no previous file with comments | « device/usb/usb_device_android.h ('k') | device/usb/usb_service_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "device/usb/usb_device_android.h" 5 #include "device/usb/usb_device_android.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const JavaRef<jobject>& wrapper) 78 const JavaRef<jobject>& wrapper)
79 : UsbDevice(usb_version, 79 : UsbDevice(usb_version,
80 device_class, 80 device_class,
81 device_subclass, 81 device_subclass,
82 device_protocol, 82 device_protocol,
83 vendor_id, 83 vendor_id,
84 product_id, 84 product_id,
85 device_version, 85 device_version,
86 manufacturer_string, 86 manufacturer_string,
87 product_string, 87 product_string,
88 serial_number) { 88 serial_number),
89 device_id_(Java_ChromeUsbDevice_getDeviceId(env, wrapper.obj())) {
89 j_object_.Reset(wrapper); 90 j_object_.Reset(wrapper);
90 91
91 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 21) { 92 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 21) {
92 ScopedJavaLocalRef<jobjectArray> configurations = 93 ScopedJavaLocalRef<jobjectArray> configurations =
93 Java_ChromeUsbDevice_getConfigurations(env, j_object_.obj()); 94 Java_ChromeUsbDevice_getConfigurations(env, j_object_.obj());
94 jsize count = env->GetArrayLength(configurations.obj()); 95 jsize count = env->GetArrayLength(configurations.obj());
95 configurations_.reserve(count); 96 configurations_.reserve(count);
96 for (jsize i = 0; i < count; ++i) { 97 for (jsize i = 0; i < count; ++i) {
97 ScopedJavaLocalRef<jobject> config( 98 ScopedJavaLocalRef<jobject> config(
98 env, env->GetObjectArrayElement(configurations.obj(), i)); 99 env, env->GetObjectArrayElement(configurations.obj(), i));
(...skipping 16 matching lines...) Expand all
115 env, env->GetObjectArrayElement(interfaces.obj(), i)); 116 env, env->GetObjectArrayElement(interfaces.obj(), i));
116 config.interfaces.push_back(UsbInterfaceAndroid::Convert(env, interface)); 117 config.interfaces.push_back(UsbInterfaceAndroid::Convert(env, interface));
117 } 118 }
118 configurations_.push_back(config); 119 configurations_.push_back(config);
119 } 120 }
120 } 121 }
121 122
122 UsbDeviceAndroid::~UsbDeviceAndroid() {} 123 UsbDeviceAndroid::~UsbDeviceAndroid() {}
123 124
124 } // namespace device 125 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_device_android.h ('k') | device/usb/usb_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698