| Index: device/usb/usb_interface_impl.h
|
| diff --git a/device/usb/usb_interface_impl.h b/device/usb/usb_interface_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0f6b91358b6e023204c3c688fda52bfeda4da197
|
| --- /dev/null
|
| +++ b/device/usb/usb_interface_impl.h
|
| @@ -0,0 +1,117 @@
|
| +// Copyright 2014 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_USB_INTERFACE_IMPL_H_
|
| +#define DEVICE_USB_USB_INTERFACE_IMPL_H_
|
| +
|
| +#include "base/memory/ref_counted.h"
|
| +#include "device/usb/usb_interface.h"
|
| +
|
| +struct libusb_config_descriptor;
|
| +struct libusb_endpoint_descriptor;
|
| +struct libusb_interface;
|
| +struct libusb_interface_descriptor;
|
| +
|
| +namespace device {
|
| +
|
| +typedef libusb_config_descriptor* PlatformUsbConfigDescriptor;
|
| +typedef const libusb_endpoint_descriptor* PlatformUsbEndpointDescriptor;
|
| +typedef const libusb_interface* PlatformUsbInterface;
|
| +typedef const libusb_interface_descriptor* PlatformUsbInterfaceDescriptor;
|
| +
|
| +class UsbConfigDescriptorImpl;
|
| +class UsbInterfaceAltSettingDescriptor;
|
| +
|
| +class UsbEndpointDescriptorImpl : public UsbEndpointDescriptor {
|
| + public:
|
| + virtual int GetAddress() const OVERRIDE;
|
| + virtual UsbEndpointDirection GetDirection() const OVERRIDE;
|
| + virtual int GetMaximumPacketSize() const OVERRIDE;
|
| + virtual UsbSynchronizationType GetSynchronizationType() const OVERRIDE;
|
| + virtual UsbTransferType GetTransferType() const OVERRIDE;
|
| + virtual UsbUsageType GetUsageType() const OVERRIDE;
|
| + virtual int GetPollingInterval() const OVERRIDE;
|
| +
|
| + private:
|
| + friend class base::RefCounted<const UsbEndpointDescriptorImpl>;
|
| + friend class UsbInterfaceAltSettingDescriptorImpl;
|
| +
|
| + UsbEndpointDescriptorImpl(scoped_refptr<const UsbConfigDescriptor> config,
|
| + PlatformUsbEndpointDescriptor descriptor);
|
| + virtual ~UsbEndpointDescriptorImpl();
|
| +
|
| + scoped_refptr<const UsbConfigDescriptor> config_;
|
| + PlatformUsbEndpointDescriptor descriptor_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UsbEndpointDescriptorImpl);
|
| +};
|
| +
|
| +class UsbInterfaceAltSettingDescriptorImpl
|
| + : public UsbInterfaceAltSettingDescriptor {
|
| + public:
|
| + virtual size_t GetNumEndpoints() const OVERRIDE;
|
| + virtual scoped_refptr<const UsbEndpointDescriptor> GetEndpoint(
|
| + size_t index) const OVERRIDE;
|
| +
|
| + virtual int GetInterfaceNumber() const OVERRIDE;
|
| + virtual int GetAlternateSetting() const OVERRIDE;
|
| + virtual int GetInterfaceClass() const OVERRIDE;
|
| + virtual int GetInterfaceSubclass() const OVERRIDE;
|
| + virtual int GetInterfaceProtocol() const OVERRIDE;
|
| +
|
| + private:
|
| + friend class UsbInterfaceDescriptorImpl;
|
| +
|
| + UsbInterfaceAltSettingDescriptorImpl(
|
| + scoped_refptr<const UsbConfigDescriptor> config,
|
| + PlatformUsbInterfaceDescriptor descriptor);
|
| + virtual ~UsbInterfaceAltSettingDescriptorImpl();
|
| +
|
| + scoped_refptr<const UsbConfigDescriptor> config_;
|
| + PlatformUsbInterfaceDescriptor descriptor_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UsbInterfaceAltSettingDescriptorImpl);
|
| +};
|
| +
|
| +class UsbInterfaceDescriptorImpl : public UsbInterfaceDescriptor {
|
| + public:
|
| + virtual size_t GetNumAltSettings() const OVERRIDE;
|
| + virtual scoped_refptr<const UsbInterfaceAltSettingDescriptor> GetAltSetting(
|
| + size_t index) const OVERRIDE;
|
| +
|
| + private:
|
| + friend class base::RefCounted<const UsbInterfaceDescriptorImpl>;
|
| + friend class UsbConfigDescriptorImpl;
|
| +
|
| + UsbInterfaceDescriptorImpl(scoped_refptr<const UsbConfigDescriptor> config,
|
| + PlatformUsbInterface usbInterface);
|
| + virtual ~UsbInterfaceDescriptorImpl();
|
| +
|
| + scoped_refptr<const UsbConfigDescriptor> config_;
|
| + PlatformUsbInterface interface_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UsbInterfaceDescriptorImpl);
|
| +};
|
| +
|
| +class UsbConfigDescriptorImpl : public UsbConfigDescriptor {
|
| + public:
|
| + virtual size_t GetNumInterfaces() const OVERRIDE;
|
| + virtual scoped_refptr<const UsbInterfaceDescriptor> GetInterface(
|
| + size_t index) const OVERRIDE;
|
| +
|
| + private:
|
| + friend class base::RefCounted<UsbConfigDescriptor>;
|
| + friend class UsbDeviceImpl;
|
| +
|
| + explicit UsbConfigDescriptorImpl(PlatformUsbConfigDescriptor config);
|
| + virtual ~UsbConfigDescriptorImpl();
|
| +
|
| + PlatformUsbConfigDescriptor config_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UsbConfigDescriptorImpl);
|
| +};
|
| +
|
| +} // namespace device
|
| +
|
| +#endif // DEVICE_USB_USB_INTERFACE_IMPL_H_
|
|
|