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

Side by Side Diff: components/usb_service/usb_interface.h

Issue 236203019: Move UsbService to its own component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move usb_service component symbols into usb_service namespace Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « components/usb_service/usb_device_handle.cc ('k') | components/usb_service/usb_interface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_USB_USB_INTERFACE_H_ 5 #ifndef COMPONENTS_USB_SERVICE_USB_INTERFACE_H_
6 #define CHROME_BROWSER_USB_USB_INTERFACE_H_ 6 #define COMPONENTS_USB_SERVICE_USB_INTERFACE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "components/usb_service/usb_service_export.h"
9 10
10 struct libusb_config_descriptor; 11 struct libusb_config_descriptor;
11 struct libusb_endpoint_descriptor; 12 struct libusb_endpoint_descriptor;
12 struct libusb_interface; 13 struct libusb_interface;
13 struct libusb_interface_descriptor; 14 struct libusb_interface_descriptor;
14 15
16 namespace usb_service {
17
15 typedef libusb_config_descriptor* PlatformUsbConfigDescriptor; 18 typedef libusb_config_descriptor* PlatformUsbConfigDescriptor;
16 typedef const libusb_endpoint_descriptor* PlatformUsbEndpointDescriptor; 19 typedef const libusb_endpoint_descriptor* PlatformUsbEndpointDescriptor;
17 typedef const libusb_interface* PlatformUsbInterface; 20 typedef const libusb_interface* PlatformUsbInterface;
18 typedef const libusb_interface_descriptor* PlatformUsbInterfaceDescriptor; 21 typedef const libusb_interface_descriptor* PlatformUsbInterfaceDescriptor;
19 22
20 enum UsbTransferType { 23 enum UsbTransferType {
21 USB_TRANSFER_CONTROL = 0, 24 USB_TRANSFER_CONTROL = 0,
22 USB_TRANSFER_ISOCHRONOUS, 25 USB_TRANSFER_ISOCHRONOUS,
23 USB_TRANSFER_BULK, 26 USB_TRANSFER_BULK,
24 USB_TRANSFER_INTERRUPT, 27 USB_TRANSFER_INTERRUPT,
(...skipping 15 matching lines...) Expand all
40 USB_USAGE_DATA = 0, 43 USB_USAGE_DATA = 0,
41 USB_USAGE_FEEDBACK, 44 USB_USAGE_FEEDBACK,
42 USB_USAGE_EXPLICIT_FEEDBACK 45 USB_USAGE_EXPLICIT_FEEDBACK
43 }; 46 };
44 47
45 class UsbDevice; 48 class UsbDevice;
46 class UsbConfigDescriptor; 49 class UsbConfigDescriptor;
47 class UsbInterfaceDescriptor; 50 class UsbInterfaceDescriptor;
48 class UsbInterfaceAltSettingDescriptor; 51 class UsbInterfaceAltSettingDescriptor;
49 52
50 class UsbEndpointDescriptor 53 class USB_SERVICE_EXPORT UsbEndpointDescriptor
51 : public base::RefCounted<const UsbEndpointDescriptor> { 54 : public base::RefCounted<const UsbEndpointDescriptor> {
52 public: 55 public:
53 int GetAddress() const; 56 int GetAddress() const;
54 UsbEndpointDirection GetDirection() const; 57 UsbEndpointDirection GetDirection() const;
55 int GetMaximumPacketSize() const; 58 int GetMaximumPacketSize() const;
56 UsbSynchronizationType GetSynchronizationType() const; 59 UsbSynchronizationType GetSynchronizationType() const;
57 UsbTransferType GetTransferType() const; 60 UsbTransferType GetTransferType() const;
58 UsbUsageType GetUsageType() const; 61 UsbUsageType GetUsageType() const;
59 int GetPollingInterval() const; 62 int GetPollingInterval() const;
60 63
61 private: 64 private:
62 friend class base::RefCounted<const UsbEndpointDescriptor>; 65 friend class base::RefCounted<const UsbEndpointDescriptor>;
63 friend class UsbInterfaceAltSettingDescriptor; 66 friend class UsbInterfaceAltSettingDescriptor;
64 67
65 UsbEndpointDescriptor( 68 UsbEndpointDescriptor(scoped_refptr<const UsbConfigDescriptor> config,
66 scoped_refptr<const UsbConfigDescriptor> config, 69 PlatformUsbEndpointDescriptor descriptor);
67 PlatformUsbEndpointDescriptor descriptor);
68 ~UsbEndpointDescriptor(); 70 ~UsbEndpointDescriptor();
69 71
70 scoped_refptr<const UsbConfigDescriptor> config_; 72 scoped_refptr<const UsbConfigDescriptor> config_;
71 PlatformUsbEndpointDescriptor descriptor_; 73 PlatformUsbEndpointDescriptor descriptor_;
72 74
73 DISALLOW_COPY_AND_ASSIGN(UsbEndpointDescriptor); 75 DISALLOW_COPY_AND_ASSIGN(UsbEndpointDescriptor);
74 }; 76 };
75 77
76 class UsbInterfaceAltSettingDescriptor 78 class USB_SERVICE_EXPORT UsbInterfaceAltSettingDescriptor
77 : public base::RefCounted<const UsbInterfaceAltSettingDescriptor> { 79 : public base::RefCounted<const UsbInterfaceAltSettingDescriptor> {
78 public: 80 public:
79 size_t GetNumEndpoints() const; 81 size_t GetNumEndpoints() const;
80 scoped_refptr<const UsbEndpointDescriptor> GetEndpoint(size_t index) const; 82 scoped_refptr<const UsbEndpointDescriptor> GetEndpoint(size_t index) const;
81 83
82 int GetInterfaceNumber() const; 84 int GetInterfaceNumber() const;
83 int GetAlternateSetting() const; 85 int GetAlternateSetting() const;
84 int GetInterfaceClass() const; 86 int GetInterfaceClass() const;
85 int GetInterfaceSubclass() const; 87 int GetInterfaceSubclass() const;
86 int GetInterfaceProtocol() const; 88 int GetInterfaceProtocol() const;
87 89
88 private: 90 private:
89 friend class base::RefCounted<const UsbInterfaceAltSettingDescriptor>; 91 friend class base::RefCounted<const UsbInterfaceAltSettingDescriptor>;
90 friend class UsbInterfaceDescriptor; 92 friend class UsbInterfaceDescriptor;
91 93
92 UsbInterfaceAltSettingDescriptor( 94 UsbInterfaceAltSettingDescriptor(
93 scoped_refptr<const UsbConfigDescriptor> config, 95 scoped_refptr<const UsbConfigDescriptor> config,
94 PlatformUsbInterfaceDescriptor descriptor); 96 PlatformUsbInterfaceDescriptor descriptor);
95 ~UsbInterfaceAltSettingDescriptor(); 97 ~UsbInterfaceAltSettingDescriptor();
96 98
97 scoped_refptr<const UsbConfigDescriptor> config_; 99 scoped_refptr<const UsbConfigDescriptor> config_;
98 PlatformUsbInterfaceDescriptor descriptor_; 100 PlatformUsbInterfaceDescriptor descriptor_;
99 101
100 DISALLOW_COPY_AND_ASSIGN(UsbInterfaceAltSettingDescriptor); 102 DISALLOW_COPY_AND_ASSIGN(UsbInterfaceAltSettingDescriptor);
101 }; 103 };
102 104
103 class UsbInterfaceDescriptor 105 class USB_SERVICE_EXPORT UsbInterfaceDescriptor
104 : public base::RefCounted<const UsbInterfaceDescriptor> { 106 : public base::RefCounted<const UsbInterfaceDescriptor> {
105 public: 107 public:
106 size_t GetNumAltSettings() const; 108 size_t GetNumAltSettings() const;
107 scoped_refptr<const UsbInterfaceAltSettingDescriptor> GetAltSetting( 109 scoped_refptr<const UsbInterfaceAltSettingDescriptor> GetAltSetting(
108 size_t index) const; 110 size_t index) const;
109 111
110 private: 112 private:
111 friend class base::RefCounted<const UsbInterfaceDescriptor>; 113 friend class base::RefCounted<const UsbInterfaceDescriptor>;
112 friend class UsbConfigDescriptor; 114 friend class UsbConfigDescriptor;
113 115
114 UsbInterfaceDescriptor(scoped_refptr<const UsbConfigDescriptor> config, 116 UsbInterfaceDescriptor(scoped_refptr<const UsbConfigDescriptor> config,
115 PlatformUsbInterface usbInterface); 117 PlatformUsbInterface usbInterface);
116 ~UsbInterfaceDescriptor(); 118 ~UsbInterfaceDescriptor();
117 119
118 scoped_refptr<const UsbConfigDescriptor> config_; 120 scoped_refptr<const UsbConfigDescriptor> config_;
119 PlatformUsbInterface interface_; 121 PlatformUsbInterface interface_;
120 122
121 DISALLOW_COPY_AND_ASSIGN(UsbInterfaceDescriptor); 123 DISALLOW_COPY_AND_ASSIGN(UsbInterfaceDescriptor);
122 }; 124 };
123 125
124 class UsbConfigDescriptor : public base::RefCounted<UsbConfigDescriptor> { 126 class USB_SERVICE_EXPORT UsbConfigDescriptor
127 : public base::RefCounted<UsbConfigDescriptor> {
125 public: 128 public:
126 size_t GetNumInterfaces() const; 129 size_t GetNumInterfaces() const;
127 scoped_refptr<const UsbInterfaceDescriptor> GetInterface(size_t index) const; 130 scoped_refptr<const UsbInterfaceDescriptor> GetInterface(size_t index) const;
128 131
129 private: 132 private:
130 friend class base::RefCounted<UsbConfigDescriptor>; 133 friend class base::RefCounted<UsbConfigDescriptor>;
131 friend class UsbDevice; 134 friend class UsbDevice;
132 135
133 explicit UsbConfigDescriptor(PlatformUsbConfigDescriptor config); 136 explicit UsbConfigDescriptor(PlatformUsbConfigDescriptor config);
134 ~UsbConfigDescriptor(); 137 ~UsbConfigDescriptor();
135 138
136 PlatformUsbConfigDescriptor config_; 139 PlatformUsbConfigDescriptor config_;
137 140
138 DISALLOW_COPY_AND_ASSIGN(UsbConfigDescriptor); 141 DISALLOW_COPY_AND_ASSIGN(UsbConfigDescriptor);
139 }; 142 };
140 143
141 #endif // CHROME_BROWSER_USB_USB_INTERFACE_H_ 144 } // namespace usb_service;
145
146 #endif // COMPONENTS_USB_SERVICE_USB_INTERFACE_H_
OLDNEW
« no previous file with comments | « components/usb_service/usb_device_handle.cc ('k') | components/usb_service/usb_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698