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/devices_app/usb/type_converters.h" | 5 #include "device/devices_app/usb/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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 info->configuration_value = config.configuration_value; | 229 info->configuration_value = config.configuration_value; |
230 info->origins = mojo::Array<mojo::String>::From(config.origins); | 230 info->origins = mojo::Array<mojo::String>::From(config.origins); |
231 info->functions = | 231 info->functions = |
232 mojo::Array<device::usb::WebUsbFunctionSubsetPtr>::From(config.functions); | 232 mojo::Array<device::usb::WebUsbFunctionSubsetPtr>::From(config.functions); |
233 return info; | 233 return info; |
234 } | 234 } |
235 | 235 |
236 // static | 236 // static |
237 device::usb::WebUsbDescriptorSetPtr TypeConverter< | 237 device::usb::WebUsbDescriptorSetPtr TypeConverter< |
238 device::usb::WebUsbDescriptorSetPtr, | 238 device::usb::WebUsbDescriptorSetPtr, |
239 device::WebUsbDescriptorSet>::Convert(const device::WebUsbDescriptorSet& | 239 device::WebUsbAllowedOrigins>::Convert(const device::WebUsbAllowedOrigins& |
240 set) { | 240 allowed_origins) { |
241 device::usb::WebUsbDescriptorSetPtr info = | 241 device::usb::WebUsbDescriptorSetPtr info = |
242 device::usb::WebUsbDescriptorSet::New(); | 242 device::usb::WebUsbDescriptorSet::New(); |
243 info->origins = mojo::Array<mojo::String>::From(set.origins); | 243 info->origins = mojo::Array<mojo::String>::From(allowed_origins.origins); |
244 info->configurations = | 244 info->configurations = |
245 mojo::Array<device::usb::WebUsbConfigurationSubsetPtr>::From( | 245 mojo::Array<device::usb::WebUsbConfigurationSubsetPtr>::From( |
246 set.configurations); | 246 allowed_origins.configurations); |
247 return info; | 247 return info; |
248 } | 248 } |
249 | 249 |
250 // static | 250 // static |
251 device::usb::DeviceInfoPtr | 251 device::usb::DeviceInfoPtr |
252 TypeConverter<device::usb::DeviceInfoPtr, device::UsbDevice>::Convert( | 252 TypeConverter<device::usb::DeviceInfoPtr, device::UsbDevice>::Convert( |
253 const device::UsbDevice& device) { | 253 const device::UsbDevice& device) { |
254 device::usb::DeviceInfoPtr info = device::usb::DeviceInfo::New(); | 254 device::usb::DeviceInfoPtr info = device::usb::DeviceInfo::New(); |
255 info->guid = device.guid(); | 255 info->guid = device.guid(); |
256 info->vendor_id = device.vendor_id(); | 256 info->vendor_id = device.vendor_id(); |
257 info->product_id = device.product_id(); | 257 info->product_id = device.product_id(); |
258 info->manufacturer_name = base::UTF16ToUTF8(device.manufacturer_string()); | 258 info->manufacturer_name = base::UTF16ToUTF8(device.manufacturer_string()); |
259 info->product_name = base::UTF16ToUTF8(device.product_string()); | 259 info->product_name = base::UTF16ToUTF8(device.product_string()); |
260 info->serial_number = base::UTF16ToUTF8(device.serial_number()); | 260 info->serial_number = base::UTF16ToUTF8(device.serial_number()); |
261 info->configurations = mojo::Array<device::usb::ConfigurationInfoPtr>::From( | 261 info->configurations = mojo::Array<device::usb::ConfigurationInfoPtr>::From( |
262 device.configurations()); | 262 device.configurations()); |
263 if (device.webusb_allowed_origins()) { | 263 if (device.webusb_allowed_origins()) { |
264 info->webusb_allowed_origins = device::usb::WebUsbDescriptorSet::From( | 264 info->webusb_allowed_origins = device::usb::WebUsbDescriptorSet::From( |
265 *device.webusb_allowed_origins()); | 265 *device.webusb_allowed_origins()); |
266 } | 266 } |
267 return info; | 267 return info; |
268 } | 268 } |
269 | 269 |
270 } // namespace mojo | 270 } // namespace mojo |
OLD | NEW |