| 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 #ifndef DEVICE_USB_MOJO_TYPE_CONVERTERS_H_ | 5 #ifndef DEVICE_USB_MOJO_TYPE_CONVERTERS_H_ |
| 6 #define DEVICE_USB_MOJO_TYPE_CONVERTERS_H_ | 6 #define DEVICE_USB_MOJO_TYPE_CONVERTERS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "device/usb/public/interfaces/device.mojom.h" | 10 #include "device/usb/public/interfaces/device.mojom.h" |
| 11 #include "device/usb/public/interfaces/device_manager.mojom.h" | 11 #include "device/usb/public/interfaces/device_manager.mojom.h" |
| 12 #include "device/usb/usb_descriptors.h" | 12 #include "device/usb/usb_descriptors.h" |
| 13 #include "device/usb/usb_device_filter.h" | 13 #include "device/usb/usb_device_filter.h" |
| 14 #include "device/usb/usb_device_handle.h" | 14 #include "device/usb/usb_device_handle.h" |
| 15 #include "mojo/public/cpp/bindings/type_converter.h" | 15 #include "mojo/public/cpp/bindings/type_converter.h" |
| 16 | 16 |
| 17 // Type converters to translate between internal device/usb data types and | 17 // Type converters to translate between internal device/usb data types and |
| 18 // public Mojo interface data types. This must be included by any source file | 18 // public Mojo interface data types. This must be included by any source file |
| 19 // that uses these conversions explicitly or implicitly. | 19 // that uses these conversions explicitly or implicitly. |
| 20 | 20 |
| 21 namespace device { | 21 namespace device { |
| 22 class UsbDevice; | 22 class UsbDevice; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace mojo { | 25 namespace mojo { |
| 26 | 26 |
| 27 template <> | 27 template <> |
| 28 struct TypeConverter<device::UsbDeviceFilter, device::usb::DeviceFilterPtr> { | |
| 29 static device::UsbDeviceFilter Convert( | |
| 30 const device::usb::DeviceFilterPtr& mojo_filter); | |
| 31 }; | |
| 32 | |
| 33 template <> | |
| 34 struct TypeConverter<device::usb::TransferDirection, | 28 struct TypeConverter<device::usb::TransferDirection, |
| 35 device::UsbEndpointDirection> { | 29 device::UsbEndpointDirection> { |
| 36 static device::usb::TransferDirection Convert( | 30 static device::usb::TransferDirection Convert( |
| 37 const device::UsbEndpointDirection& direction); | 31 const device::UsbEndpointDirection& direction); |
| 38 }; | 32 }; |
| 39 | 33 |
| 40 template <> | 34 template <> |
| 41 struct TypeConverter<device::usb::TransferStatus, device::UsbTransferStatus> { | 35 struct TypeConverter<device::usb::TransferStatus, device::UsbTransferStatus> { |
| 42 static device::usb::TransferStatus Convert( | 36 static device::usb::TransferStatus Convert( |
| 43 const device::UsbTransferStatus& status); | 37 const device::UsbTransferStatus& status); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 result.reserve(input.size()); | 107 result.reserve(input.size()); |
| 114 for (const B& item : input) | 108 for (const B& item : input) |
| 115 result.push_back(mojo::ConvertTo<A>(item)); | 109 result.push_back(mojo::ConvertTo<A>(item)); |
| 116 return result; | 110 return result; |
| 117 }; | 111 }; |
| 118 }; | 112 }; |
| 119 | 113 |
| 120 } // namespace mojo | 114 } // namespace mojo |
| 121 | 115 |
| 122 #endif // DEVICE_DEVICES_APP_USB_TYPE_CONVERTERS_H_ | 116 #endif // DEVICE_DEVICES_APP_USB_TYPE_CONVERTERS_H_ |
| OLD | NEW |