OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DEVICE_USB_TYPE_CONVERTERS_H_ |
| 6 #define DEVICE_USB_TYPE_CONVERTERS_H_ |
| 7 |
| 8 #include "device/usb/public/interfaces/device.mojom.h" |
| 9 #include "device/usb/public/interfaces/device_manager.mojom.h" |
| 10 #include "device/usb/usb_descriptors.h" |
| 11 #include "device/usb/usb_device_filter.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h" |
| 13 |
| 14 // Type converters to convert objects between internal device/usb data types and |
| 15 // public Mojo interface data types. |
| 16 |
| 17 namespace device { |
| 18 class UsbDevice; |
| 19 } |
| 20 |
| 21 namespace mojo { |
| 22 |
| 23 template <> |
| 24 struct TypeConverter<device::UsbDeviceFilter, device::usb::DeviceFilterPtr> { |
| 25 static device::UsbDeviceFilter Convert( |
| 26 const device::usb::DeviceFilterPtr& mojo_filter); |
| 27 }; |
| 28 |
| 29 template <> |
| 30 struct TypeConverter<device::usb::TransferDirection, |
| 31 device::UsbEndpointDirection> { |
| 32 static device::usb::TransferDirection Convert( |
| 33 const device::UsbEndpointDirection& direction); |
| 34 }; |
| 35 |
| 36 template <> |
| 37 struct TypeConverter<device::usb::EndpointType, device::UsbTransferType> { |
| 38 static device::usb::EndpointType Convert(const device::UsbTransferType& type); |
| 39 }; |
| 40 |
| 41 template <> |
| 42 struct TypeConverter<device::usb::EndpointInfoPtr, |
| 43 device::UsbEndpointDescriptor> { |
| 44 static device::usb::EndpointInfoPtr Convert( |
| 45 const device::UsbEndpointDescriptor& endpoint); |
| 46 }; |
| 47 |
| 48 template <> |
| 49 struct TypeConverter<device::usb::AlternateInterfaceInfoPtr, |
| 50 device::UsbInterfaceDescriptor> { |
| 51 static device::usb::AlternateInterfaceInfoPtr Convert( |
| 52 const device::UsbInterfaceDescriptor& interface); |
| 53 }; |
| 54 |
| 55 template <> |
| 56 struct TypeConverter<device::usb::InterfaceInfoPtr, |
| 57 device::UsbInterfaceDescriptor> { |
| 58 static device::usb::InterfaceInfoPtr Convert( |
| 59 const device::UsbInterfaceDescriptor& interface); |
| 60 }; |
| 61 |
| 62 template <> |
| 63 struct TypeConverter<device::usb::ConfigurationInfoPtr, |
| 64 device::UsbConfigDescriptor> { |
| 65 static device::usb::ConfigurationInfoPtr Convert( |
| 66 const device::UsbConfigDescriptor& config); |
| 67 }; |
| 68 |
| 69 template <> |
| 70 struct TypeConverter<device::usb::DeviceInfoPtr, device::UsbDevice> { |
| 71 static device::usb::DeviceInfoPtr Convert(const device::UsbDevice& device); |
| 72 }; |
| 73 |
| 74 } // namespace mojo |
| 75 |
| 76 #endif // DEVICE_USB_TYPE_CONVERTERS_H_ |
OLD | NEW |