Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1903)

Unified Diff: device/usb/usb_interface_impl.h

Issue 567003002: Revert of Convert device::UsbConfigDescriptor and friends to structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/usb/usb_interface.h ('k') | device/usb/usb_interface_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « device/usb/usb_interface.h ('k') | device/usb/usb_interface_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698