| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |