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

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

Issue 1561283003: Revert of Implement basic USB device enumeration on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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_endpoint_android.h ('k') | device/usb/usb_interface_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/usb/usb_endpoint_android.h"
6
7 #include "jni/ChromeUsbEndpoint_jni.h"
8
9 namespace device {
10
11 // static
12 bool UsbEndpointAndroid::RegisterJNI(JNIEnv* env) {
13 return RegisterNativesImpl(env); // Generated in ChromeUsbEndpoint_jni.h
14 }
15
16 // static
17 UsbEndpointDescriptor UsbEndpointAndroid::Convert(
18 JNIEnv* env,
19 const base::android::JavaRef<jobject>& usb_endpoint) {
20 base::android::ScopedJavaLocalRef<jobject> wrapper =
21 Java_ChromeUsbEndpoint_create(env, usb_endpoint.obj());
22
23 UsbEndpointDescriptor endpoint;
24 endpoint.address = Java_ChromeUsbEndpoint_getAddress(env, wrapper.obj());
25 endpoint.direction = static_cast<UsbEndpointDirection>(
26 Java_ChromeUsbEndpoint_getDirection(env, wrapper.obj()));
27 endpoint.maximum_packet_size =
28 Java_ChromeUsbEndpoint_getMaxPacketSize(env, wrapper.obj());
29 jint attributes = Java_ChromeUsbEndpoint_getAttributes(env, wrapper.obj());
30 endpoint.synchronization_type =
31 static_cast<UsbSynchronizationType>((attributes >> 2) & 3);
32 endpoint.usage_type = static_cast<UsbUsageType>((attributes >> 4) & 3);
33 endpoint.transfer_type = static_cast<UsbTransferType>(
34 Java_ChromeUsbEndpoint_getType(env, wrapper.obj()));
35 endpoint.polling_interval =
36 Java_ChromeUsbEndpoint_getInterval(env, wrapper.obj());
37
38 return endpoint;
39 }
40
41 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_endpoint_android.h ('k') | device/usb/usb_interface_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698