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

Side by Side Diff: chrome/browser/usb/usb_interface.h

Issue 16316004: Separate usb device handle from usb device. (deprecate) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the threading mess Created 7 years, 5 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 | « chrome/browser/usb/usb_device_handle.cc ('k') | chrome/browser/usb/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) 2013 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 CHROME_BROWSER_USB_USB_INTERFACE_H_
6 #define CHROME_BROWSER_USB_USB_INTERFACE_H_ 6 #define CHROME_BROWSER_USB_USB_INTERFACE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 10
11 struct libusb_config_descriptor; 11 struct libusb_config_descriptor;
12 struct libusb_endpoint_descriptor; 12 struct libusb_endpoint_descriptor;
13 struct libusb_interface; 13 struct libusb_interface;
14 struct libusb_interface_descriptor; 14 struct libusb_interface_descriptor;
15 15
16 typedef libusb_config_descriptor* PlatformUsbConfigDescriptor; 16 typedef libusb_config_descriptor* PlatformUsbConfigDescriptor;
17 typedef const libusb_endpoint_descriptor* PlatformUsbEndpointDescriptor; 17 typedef const libusb_endpoint_descriptor* PlatformUsbEndpointDescriptor;
18 typedef const libusb_interface* PlatformUsbInterface; 18 typedef const libusb_interface* PlatformUsbInterface;
19 typedef const libusb_interface_descriptor* PlatformUsbInterfaceDescriptor; 19 typedef const libusb_interface_descriptor* PlatformUsbInterfaceDescriptor;
20 20
21 class UsbDevice;
22
23 enum UsbTransferType { 21 enum UsbTransferType {
24 USB_TRANSFER_CONTROL = 0, 22 USB_TRANSFER_CONTROL = 0,
25 USB_TRANSFER_ISOCHRONOUS, 23 USB_TRANSFER_ISOCHRONOUS,
26 USB_TRANSFER_BULK, 24 USB_TRANSFER_BULK,
27 USB_TRANSFER_INTERRUPT, 25 USB_TRANSFER_INTERRUPT,
28 }; 26 };
29 27
30 enum UsbEndpointDirection { 28 enum UsbEndpointDirection {
31 USB_DIRECTION_INBOUND = 0, 29 USB_DIRECTION_INBOUND = 0,
32 USB_DIRECTION_OUTBOUND, 30 USB_DIRECTION_OUTBOUND,
(...skipping 10 matching lines...) Expand all
43 USB_USAGE_DATA = 0, 41 USB_USAGE_DATA = 0,
44 USB_USAGE_FEEDBACK, 42 USB_USAGE_FEEDBACK,
45 USB_USAGE_EXPLICIT_FEEDBACK 43 USB_USAGE_EXPLICIT_FEEDBACK
46 }; 44 };
47 45
48 class UsbConfigDescriptor; 46 class UsbConfigDescriptor;
49 47
50 class UsbEndpointDescriptor : public base::RefCounted<UsbEndpointDescriptor> { 48 class UsbEndpointDescriptor : public base::RefCounted<UsbEndpointDescriptor> {
51 public: 49 public:
52 UsbEndpointDescriptor(scoped_refptr<const UsbConfigDescriptor> config, 50 UsbEndpointDescriptor(scoped_refptr<const UsbConfigDescriptor> config,
53 PlatformUsbEndpointDescriptor descriptor); 51 PlatformUsbEndpointDescriptor descriptor);
54 52
55 int GetAddress() const; 53 int GetAddress() const;
56 UsbEndpointDirection GetDirection() const; 54 UsbEndpointDirection GetDirection() const;
57 int GetMaximumPacketSize() const; 55 int GetMaximumPacketSize() const;
58 UsbSynchronizationType GetSynchronizationType() const; 56 UsbSynchronizationType GetSynchronizationType() const;
59 UsbTransferType GetTransferType() const; 57 UsbTransferType GetTransferType() const;
60 UsbUsageType GetUsageType() const; 58 UsbUsageType GetUsageType() const;
61 int GetPollingInterval() const; 59 int GetPollingInterval() const;
62 60
63 private: 61 private:
64 friend class base::RefCounted<UsbEndpointDescriptor>; 62 friend class base::RefCounted<UsbEndpointDescriptor>;
65 ~UsbEndpointDescriptor(); 63 ~UsbEndpointDescriptor();
66 64
67 scoped_refptr<const UsbConfigDescriptor> config_; 65 scoped_refptr<const UsbConfigDescriptor> config_;
68 PlatformUsbEndpointDescriptor descriptor_; 66 PlatformUsbEndpointDescriptor descriptor_;
69 }; 67 };
70 68
71 class UsbInterfaceDescriptor 69 class UsbInterfaceDescriptor : public base::RefCounted<UsbInterfaceDescriptor> {
72 : public base::RefCounted<UsbInterfaceDescriptor> {
73 public: 70 public:
74 UsbInterfaceDescriptor(scoped_refptr<const UsbConfigDescriptor> config, 71 UsbInterfaceDescriptor(scoped_refptr<const UsbConfigDescriptor> config,
75 PlatformUsbInterfaceDescriptor descriptor); 72 PlatformUsbInterfaceDescriptor descriptor);
76 73
77 size_t GetNumEndpoints() const; 74 size_t GetNumEndpoints() const;
78 scoped_refptr<const UsbEndpointDescriptor> 75 scoped_refptr<const UsbEndpointDescriptor> GetEndpoint(size_t index) const;
79 GetEndpoint(size_t index) const;
80 76
81 int GetInterfaceNumber() const; 77 int GetInterfaceNumber() const;
82 int GetAlternateSetting() const; 78 int GetAlternateSetting() const;
83 int GetInterfaceClass() const; 79 int GetInterfaceClass() const;
84 int GetInterfaceSubclass() const; 80 int GetInterfaceSubclass() const;
85 int GetInterfaceProtocol() const; 81 int GetInterfaceProtocol() const;
86 82
87 private: 83 private:
88 friend class base::RefCounted<UsbInterfaceDescriptor>; 84 friend class base::RefCounted<UsbInterfaceDescriptor>;
89 ~UsbInterfaceDescriptor(); 85 ~UsbInterfaceDescriptor();
90 86
91 scoped_refptr<const UsbConfigDescriptor> config_; 87 scoped_refptr<const UsbConfigDescriptor> config_;
92 PlatformUsbInterfaceDescriptor descriptor_; 88 PlatformUsbInterfaceDescriptor descriptor_;
93 }; 89 };
94 90
95 class UsbInterface : public base::RefCounted<UsbInterface> { 91 class UsbInterface : public base::RefCounted<UsbInterface> {
96 public: 92 public:
97 UsbInterface(scoped_refptr<const UsbConfigDescriptor> config, 93 UsbInterface(scoped_refptr<const UsbConfigDescriptor> config,
98 PlatformUsbInterface usbInterface); 94 PlatformUsbInterface usbInterface);
99 95
100 size_t GetNumAltSettings() const; 96 size_t GetNumAltSettings() const;
101 scoped_refptr<const UsbInterfaceDescriptor> 97 scoped_refptr<const UsbInterfaceDescriptor> GetAltSetting(size_t index) const;
102 GetAltSetting(size_t index) const;
103 98
104 private: 99 private:
105 friend class base::RefCounted<UsbInterface>; 100 friend class base::RefCounted<UsbInterface>;
106 ~UsbInterface(); 101 ~UsbInterface();
107 102
108 scoped_refptr<const UsbConfigDescriptor> config_; 103 scoped_refptr<const UsbConfigDescriptor> config_;
109 PlatformUsbInterface interface_; 104 PlatformUsbInterface interface_;
110 }; 105 };
111 106
112 class UsbConfigDescriptor : public base::RefCounted<UsbConfigDescriptor> { 107 class UsbConfigDescriptor : public base::RefCounted<UsbConfigDescriptor> {
113 public: 108 public:
114 UsbConfigDescriptor(); 109 UsbConfigDescriptor();
115 110
116 void Reset(PlatformUsbConfigDescriptor config); 111 void Reset(PlatformUsbConfigDescriptor config);
117 112
118 size_t GetNumInterfaces() const; 113 size_t GetNumInterfaces() const;
119 114
120 scoped_refptr<const UsbInterface> 115 scoped_refptr<const UsbInterface> GetInterface(size_t index) const;
121 GetInterface(size_t index) const;
122 116
123 private: 117 private:
124 friend class base::RefCounted<UsbConfigDescriptor>; 118 friend class base::RefCounted<UsbConfigDescriptor>;
125 ~UsbConfigDescriptor(); 119 ~UsbConfigDescriptor();
126 120
127 PlatformUsbConfigDescriptor config_; 121 PlatformUsbConfigDescriptor config_;
128 }; 122 };
129 123
130 #endif // CHROME_BROWSER_USB_USB_INTERFACE_H_ 124 #endif // CHROME_BROWSER_USB_USB_INTERFACE_H_
OLDNEW
« no previous file with comments | « chrome/browser/usb/usb_device_handle.cc ('k') | chrome/browser/usb/usb_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698