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

Side by Side Diff: extensions/common/api/usb.idl

Issue 599303004: Add getUserSelectedDevices to the USB extensions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // Use the <code>chrome.usb</code> API to interact with connected USB 5 // Use the <code>chrome.usb</code> API to interact with connected USB
6 // devices. This API provides access to USB operations from within the context 6 // devices. This API provides access to USB operations from within the context
7 // of an app. Using this API, apps can function as drivers for hardware devices. 7 // of an app. Using this API, apps can function as drivers for hardware devices.
8 // 8 //
9 // Errors generated by this API are reported by setting 9 // Errors generated by this API are reported by setting
10 // $(ref:runtime.lastError) and executing the function's regular callback. The 10 // $(ref:runtime.lastError) and executing the function's regular callback. The
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 dictionary EnumerateDevicesOptions { 180 dictionary EnumerateDevicesOptions {
181 [deprecated="Equivalent to setting $(ref:DeviceFilter.vendorId)."] 181 [deprecated="Equivalent to setting $(ref:DeviceFilter.vendorId)."]
182 long? vendorId; 182 long? vendorId;
183 [deprecated="Equivalent to setting $(ref:DeviceFilter.productId)."] 183 [deprecated="Equivalent to setting $(ref:DeviceFilter.productId)."]
184 long? productId; 184 long? productId;
185 // A device matching any given filter will be returned. An empty filter list 185 // A device matching any given filter will be returned. An empty filter list
186 // will return all devices the app has permission for. 186 // will return all devices the app has permission for.
187 DeviceFilter[]? filters; 187 DeviceFilter[]? filters;
188 }; 188 };
189 189
190 dictionary EnumerateDevicesAndRequestAccessOptions { 190 dictionary EnumerateDevicesAndRequestAccessOptions {
191 // The device vendor ID. 191 // The device vendor ID.
192 long vendorId; 192 long vendorId;
193 // The product ID. 193 // The product ID.
194 long productId; 194 long productId;
195 // The interface ID to request access to. 195 // The interface ID to request access to.
196 // Only available on ChromeOS. It has no effect on other platforms. 196 // Only available on ChromeOS. It has no effect on other platforms.
197 long? interfaceId; 197 long? interfaceId;
198 }; 198 };
199 199
200 callback VoidCallback = void (); 200 callback VoidCallback = void ();
201 callback GetDevicesCallback = void (Device[] devices); 201 callback GetDevicesCallback = void (Device[] devices);
202 callback RequestAccessCallback = void (boolean success); 202 callback RequestAccessCallback = void (boolean success);
203 callback OpenDeviceCallback = void (ConnectionHandle handle); 203 callback OpenDeviceCallback = void (ConnectionHandle handle);
204 callback FindDevicesCallback = void (ConnectionHandle[] handles); 204 callback FindDevicesCallback = void (ConnectionHandle[] handles);
205 callback GetConfigurationCallback = void (ConfigDescriptor config); 205 callback GetConfigurationCallback = void (ConfigDescriptor config);
206 callback ListInterfacesCallback = void (InterfaceDescriptor[] descriptors); 206 callback ListInterfacesCallback = void (InterfaceDescriptor[] descriptors);
207 callback CloseDeviceCallback = void (); 207 callback CloseDeviceCallback = void ();
208 callback TransferCallback = void (TransferResultInfo info); 208 callback TransferCallback = void (TransferResultInfo info);
209 callback ResetDeviceCallback = void(boolean success); 209 callback ResetDeviceCallback = void(boolean success);
210 210
211 interface Functions { 211 interface Functions {
212 // Enumerates connected USB devices. 212 // Enumerates connected USB devices.
213 // |options|: The properties to search for on target devices. 213 // |options|: The properties to search for on target devices.
214 static void getDevices(EnumerateDevicesOptions options, 214 static void getDevices(EnumerateDevicesOptions options,
215 GetDevicesCallback callback); 215 GetDevicesCallback callback);
216 216
217 // Presents a device picker to the user and returns the $(ref:Device)s
218 // selected.
219 // If the user cancels the picker devices will be empty. A user gesture
220 // is required for the dialog to display. Without a user gesture, the
221 // callback will run as though the user cancelled. If multiple filters are
222 // provided devices matching any filter will be displayed.
223 // |multiple|: Sets whether a user is allowed to select multiple devices.
224 // |filters|: Devices to present to the user.
225 // |callback|: Invoked with a list of chosen $(ref:Device)s.
226 static void getUserSelectedDevices(boolean multiple,
227 DeviceFilter[] filters,
228 GetDevicesCallback callback);
229
217 // Requests access from the permission broker to a device claimed by 230 // Requests access from the permission broker to a device claimed by
218 // ChromeOS if the given interface on the device is not claimed. 231 // ChromeOS if the given interface on the device is not claimed.
219 // 232 //
220 // <b>Note:</b> This method is ChromeOS specific. Calling this method on 233 // <b>Note:</b> This method is ChromeOS specific. Calling this method on
221 // other platforms will fail. 234 // other platforms will fail.
222 // 235 //
223 // |device|: The $(ref:Device) to request access to. 236 // |device|: The $(ref:Device) to request access to.
224 // |interfaceId|: The particular interface requested. 237 // |interfaceId|: The particular interface requested.
225 static void requestAccess(Device device, 238 static void requestAccess(Device device,
226 long interfaceId, 239 long interfaceId,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // If the reset fails, the given connection handle will be closed and the 343 // If the reset fails, the given connection handle will be closed and the
331 // USB device will appear to be disconnected then reconnected. 344 // USB device will appear to be disconnected then reconnected.
332 // In this case $(ref:getDevices) or $(ref:findDevices) must be called again 345 // In this case $(ref:getDevices) or $(ref:findDevices) must be called again
333 // to acquire the device. 346 // to acquire the device.
334 // 347 //
335 // |handle|: A connection handle to reset. 348 // |handle|: A connection handle to reset.
336 static void resetDevice(ConnectionHandle handle, 349 static void resetDevice(ConnectionHandle handle,
337 ResetDeviceCallback callback); 350 ResetDeviceCallback callback);
338 }; 351 };
339 }; 352 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698