| 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 #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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |