Index: device/usb/type_converters.h |
diff --git a/device/usb/type_converters.h b/device/usb/type_converters.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8af6c781a87a1d4a49f164e502fb85a7e0d1df58 |
--- /dev/null |
+++ b/device/usb/type_converters.h |
@@ -0,0 +1,76 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DEVICE_USB_TYPE_CONVERTERS_H_ |
+#define DEVICE_USB_TYPE_CONVERTERS_H_ |
+ |
+#include "device/usb/public/interfaces/device.mojom.h" |
+#include "device/usb/public/interfaces/device_manager.mojom.h" |
+#include "device/usb/usb_descriptors.h" |
+#include "device/usb/usb_device_filter.h" |
+#include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h" |
+ |
+// Type converters to convert objects between internal device/usb data types and |
+// public Mojo interface data types. |
+ |
+namespace device { |
+class UsbDevice; |
+} |
+ |
+namespace mojo { |
+ |
+template <> |
+struct TypeConverter<device::UsbDeviceFilter, device::usb::DeviceFilterPtr> { |
+ static device::UsbDeviceFilter Convert( |
+ const device::usb::DeviceFilterPtr& mojo_filter); |
+}; |
+ |
+template <> |
+struct TypeConverter<device::usb::TransferDirection, |
+ device::UsbEndpointDirection> { |
+ static device::usb::TransferDirection Convert( |
+ const device::UsbEndpointDirection& direction); |
+}; |
+ |
+template <> |
+struct TypeConverter<device::usb::EndpointType, device::UsbTransferType> { |
+ static device::usb::EndpointType Convert(const device::UsbTransferType& type); |
+}; |
+ |
+template <> |
+struct TypeConverter<device::usb::EndpointInfoPtr, |
+ device::UsbEndpointDescriptor> { |
+ static device::usb::EndpointInfoPtr Convert( |
+ const device::UsbEndpointDescriptor& endpoint); |
+}; |
+ |
+template <> |
+struct TypeConverter<device::usb::AlternateInterfaceInfoPtr, |
+ device::UsbInterfaceDescriptor> { |
+ static device::usb::AlternateInterfaceInfoPtr Convert( |
+ const device::UsbInterfaceDescriptor& interface); |
+}; |
+ |
+template <> |
+struct TypeConverter<device::usb::InterfaceInfoPtr, |
+ device::UsbInterfaceDescriptor> { |
+ static device::usb::InterfaceInfoPtr Convert( |
+ const device::UsbInterfaceDescriptor& interface); |
+}; |
+ |
+template <> |
+struct TypeConverter<device::usb::ConfigurationInfoPtr, |
+ device::UsbConfigDescriptor> { |
+ static device::usb::ConfigurationInfoPtr Convert( |
+ const device::UsbConfigDescriptor& config); |
+}; |
+ |
+template <> |
+struct TypeConverter<device::usb::DeviceInfoPtr, device::UsbDevice> { |
+ static device::usb::DeviceInfoPtr Convert(const device::UsbDevice& device); |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // DEVICE_USB_TYPE_CONVERTERS_H_ |