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

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

Issue 2688303002: Add a feature flag for the new Windows USB backend. (Closed)
Patch Set: Update histograms. Created 3 years, 10 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_service.cc ('k') | device/usb/usb_service_impl.cc » ('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_service_android.h" 5 #include "device/usb/usb_service_android.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/android/context_utils.h" 10 #include "base/android/context_utils.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
14 #include "base/threading/thread_task_runner_handle.h"
15 #include "components/device_event_log/device_event_log.h" 14 #include "components/device_event_log/device_event_log.h"
16 #include "device/usb/usb_device_android.h" 15 #include "device/usb/usb_device_android.h"
17 #include "jni/ChromeUsbService_jni.h" 16 #include "jni/ChromeUsbService_jni.h"
18 17
19 using base::android::AttachCurrentThread; 18 using base::android::AttachCurrentThread;
20 using base::android::JavaRef; 19 using base::android::JavaRef;
21 using base::android::ScopedJavaLocalRef; 20 using base::android::ScopedJavaLocalRef;
22 21
23 namespace device { 22 namespace device {
24 23
25 // static 24 // static
26 bool UsbServiceAndroid::RegisterJNI(JNIEnv* env) { 25 bool UsbServiceAndroid::RegisterJNI(JNIEnv* env) {
27 return RegisterNativesImpl(env); // Generated in ChromeUsbService_jni.h 26 return RegisterNativesImpl(env); // Generated in ChromeUsbService_jni.h
28 } 27 }
29 28
30 UsbServiceAndroid::UsbServiceAndroid( 29 UsbServiceAndroid::UsbServiceAndroid(
31 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner) 30 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner)
32 : UsbService(base::ThreadTaskRunnerHandle::Get(), blocking_task_runner), 31 : UsbService(blocking_task_runner), weak_factory_(this) {
33 weak_factory_(this) {
34 JNIEnv* env = AttachCurrentThread(); 32 JNIEnv* env = AttachCurrentThread();
35 j_object_.Reset( 33 j_object_.Reset(
36 Java_ChromeUsbService_create(env, base::android::GetApplicationContext(), 34 Java_ChromeUsbService_create(env, base::android::GetApplicationContext(),
37 reinterpret_cast<jlong>(this))); 35 reinterpret_cast<jlong>(this)));
38 ScopedJavaLocalRef<jobjectArray> devices = 36 ScopedJavaLocalRef<jobjectArray> devices =
39 Java_ChromeUsbService_getDevices(env, j_object_); 37 Java_ChromeUsbService_getDevices(env, j_object_);
40 jsize length = env->GetArrayLength(devices.obj()); 38 jsize length = env->GetArrayLength(devices.obj());
41 for (jsize i = 0; i < length; ++i) { 39 for (jsize i = 0; i < length; ++i) {
42 ScopedJavaLocalRef<jobject> usb_device( 40 ScopedJavaLocalRef<jobject> usb_device(
43 env, env->GetObjectArrayElement(devices.obj(), i)); 41 env, env->GetObjectArrayElement(devices.obj(), i));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 107
110 USB_LOG(USER) << "USB device added: id=" << device->device_id() 108 USB_LOG(USER) << "USB device added: id=" << device->device_id()
111 << " vendor=" << device->vendor_id() << " \"" 109 << " vendor=" << device->vendor_id() << " \""
112 << device->manufacturer_string() 110 << device->manufacturer_string()
113 << "\", product=" << device->product_id() << " \"" 111 << "\", product=" << device->product_id() << " \""
114 << device->product_string() << "\", serial=\"" 112 << device->product_string() << "\", serial=\""
115 << device->serial_number() << "\", guid=" << device->guid(); 113 << device->serial_number() << "\", guid=" << device->guid();
116 } 114 }
117 115
118 } // namespace device 116 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_service.cc ('k') | device/usb/usb_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698