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

Side by Side Diff: device/usb/mojo/type_converters.cc

Issue 1784733002: Track USB device configuration state in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink_open_state
Patch Set: Rebased. Created 4 years, 9 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/mojo/device_impl.cc ('k') | device/usb/public/interfaces/device.mojom » ('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/mojo/type_converters.h" 5 #include "device/usb/mojo/type_converters.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 device::usb::DeviceInfoPtr 253 device::usb::DeviceInfoPtr
254 TypeConverter<device::usb::DeviceInfoPtr, device::UsbDevice>::Convert( 254 TypeConverter<device::usb::DeviceInfoPtr, device::UsbDevice>::Convert(
255 const device::UsbDevice& device) { 255 const device::UsbDevice& device) {
256 device::usb::DeviceInfoPtr info = device::usb::DeviceInfo::New(); 256 device::usb::DeviceInfoPtr info = device::usb::DeviceInfo::New();
257 info->guid = device.guid(); 257 info->guid = device.guid();
258 info->vendor_id = device.vendor_id(); 258 info->vendor_id = device.vendor_id();
259 info->product_id = device.product_id(); 259 info->product_id = device.product_id();
260 info->manufacturer_name = base::UTF16ToUTF8(device.manufacturer_string()); 260 info->manufacturer_name = base::UTF16ToUTF8(device.manufacturer_string());
261 info->product_name = base::UTF16ToUTF8(device.product_string()); 261 info->product_name = base::UTF16ToUTF8(device.product_string());
262 info->serial_number = base::UTF16ToUTF8(device.serial_number()); 262 info->serial_number = base::UTF16ToUTF8(device.serial_number());
263 const device::UsbConfigDescriptor* config = device.GetActiveConfiguration();
264 info->active_configuration = config ? config->configuration_value : 0;
263 info->configurations = mojo::Array<device::usb::ConfigurationInfoPtr>::From( 265 info->configurations = mojo::Array<device::usb::ConfigurationInfoPtr>::From(
264 device.configurations()); 266 device.configurations());
265 if (device.webusb_allowed_origins()) { 267 if (device.webusb_allowed_origins()) {
266 info->webusb_allowed_origins = device::usb::WebUsbDescriptorSet::From( 268 info->webusb_allowed_origins = device::usb::WebUsbDescriptorSet::From(
267 *device.webusb_allowed_origins()); 269 *device.webusb_allowed_origins());
268 } 270 }
269 return info; 271 return info;
270 } 272 }
271 273
272 // static 274 // static
273 device::usb::IsochronousPacketPtr 275 device::usb::IsochronousPacketPtr
274 TypeConverter<device::usb::IsochronousPacketPtr, 276 TypeConverter<device::usb::IsochronousPacketPtr,
275 device::UsbDeviceHandle::IsochronousPacket>:: 277 device::UsbDeviceHandle::IsochronousPacket>::
276 Convert(const device::UsbDeviceHandle::IsochronousPacket& packet) { 278 Convert(const device::UsbDeviceHandle::IsochronousPacket& packet) {
277 device::usb::IsochronousPacketPtr info = 279 device::usb::IsochronousPacketPtr info =
278 device::usb::IsochronousPacket::New(); 280 device::usb::IsochronousPacket::New();
279 info->length = packet.length; 281 info->length = packet.length;
280 info->transferred_length = packet.transferred_length; 282 info->transferred_length = packet.transferred_length;
281 info->status = mojo::ConvertTo<device::usb::TransferStatus>(packet.status); 283 info->status = mojo::ConvertTo<device::usb::TransferStatus>(packet.status);
282 return info; 284 return info;
283 } 285 }
284 286
285 } // namespace mojo 287 } // namespace mojo
OLDNEW
« no previous file with comments | « device/usb/mojo/device_impl.cc ('k') | device/usb/public/interfaces/device.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698