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

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

Issue 2700713002: Assume the 1st USB device configuration has been selected on Android. (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Java_ChromeUsbDevice_getInterfaces(env, wrapper); 137 Java_ChromeUsbDevice_getInterfaces(env, wrapper);
138 jsize count = env->GetArrayLength(interfaces.obj()); 138 jsize count = env->GetArrayLength(interfaces.obj());
139 config.interfaces.reserve(count); 139 config.interfaces.reserve(count);
140 for (jsize i = 0; i < count; ++i) { 140 for (jsize i = 0; i < count; ++i) {
141 ScopedJavaLocalRef<jobject> interface( 141 ScopedJavaLocalRef<jobject> interface(
142 env, env->GetObjectArrayElement(interfaces.obj(), i)); 142 env, env->GetObjectArrayElement(interfaces.obj(), i));
143 config.interfaces.push_back(UsbInterfaceAndroid::Convert(env, interface)); 143 config.interfaces.push_back(UsbInterfaceAndroid::Convert(env, interface));
144 } 144 }
145 descriptor_.configurations.push_back(config); 145 descriptor_.configurations.push_back(config);
146 } 146 }
147
148 if (configurations().size() > 0)
149 ActiveConfigurationChanged(configurations()[0].configuration_value);
147 } 150 }
148 151
149 UsbDeviceAndroid::~UsbDeviceAndroid() {} 152 UsbDeviceAndroid::~UsbDeviceAndroid() {}
150 153
151 void UsbDeviceAndroid::PermissionGranted(bool granted) { 154 void UsbDeviceAndroid::PermissionGranted(bool granted) {
152 if (granted) 155 if (granted)
153 Open(base::Bind(&UsbDeviceAndroid::OnDeviceOpenedToReadDescriptors, this)); 156 Open(base::Bind(&UsbDeviceAndroid::OnDeviceOpenedToReadDescriptors, this));
154 else 157 else
155 CallRequestPermissionCallbacks(granted); 158 CallRequestPermissionCallbacks(granted);
156 } 159 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (allowed_origins) 205 if (allowed_origins)
203 webusb_allowed_origins_ = std::move(allowed_origins); 206 webusb_allowed_origins_ = std::move(allowed_origins);
204 if (landing_page.is_valid()) 207 if (landing_page.is_valid())
205 webusb_landing_page_ = landing_page; 208 webusb_landing_page_ = landing_page;
206 209
207 device_handle->Close(); 210 device_handle->Close();
208 CallRequestPermissionCallbacks(true); 211 CallRequestPermissionCallbacks(true);
209 } 212 }
210 213
211 } // namespace device 214 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698