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

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

Issue 463493006: Add chrome.usbPrivate API for use by USB device WEBUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change "Google Inc." to "Test Manufacturer". Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_IMPL_H_ 5 #ifndef COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_IMPL_H_
6 #define COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_IMPL_H_ 6 #define COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 class UsbDeviceHandleImpl : public UsbDeviceHandle { 38 class UsbDeviceHandleImpl : public UsbDeviceHandle {
39 public: 39 public:
40 virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE; 40 virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE;
41 virtual void Close() OVERRIDE; 41 virtual void Close() OVERRIDE;
42 virtual bool ClaimInterface(const int interface_number) OVERRIDE; 42 virtual bool ClaimInterface(const int interface_number) OVERRIDE;
43 virtual bool ReleaseInterface(const int interface_number) OVERRIDE; 43 virtual bool ReleaseInterface(const int interface_number) OVERRIDE;
44 virtual bool SetInterfaceAlternateSetting( 44 virtual bool SetInterfaceAlternateSetting(
45 const int interface_number, 45 const int interface_number,
46 const int alternate_setting) OVERRIDE; 46 const int alternate_setting) OVERRIDE;
47 virtual bool ResetDevice() OVERRIDE; 47 virtual bool ResetDevice() OVERRIDE;
48 virtual bool GetManufacturer(base::string16* manufacturer) OVERRIDE;
49 virtual bool GetProduct(base::string16* product) OVERRIDE;
48 virtual bool GetSerial(base::string16* serial) OVERRIDE; 50 virtual bool GetSerial(base::string16* serial) OVERRIDE;
49 virtual void ControlTransfer(const UsbEndpointDirection direction, 51 virtual void ControlTransfer(const UsbEndpointDirection direction,
50 const TransferRequestType request_type, 52 const TransferRequestType request_type,
51 const TransferRecipient recipient, 53 const TransferRecipient recipient,
52 const uint8 request, 54 const uint8 request,
53 const uint16 value, 55 const uint16 value,
54 const uint16 index, 56 const uint16 index,
55 net::IOBuffer* buffer, 57 net::IOBuffer* buffer,
56 const size_t length, 58 const size_t length,
57 const unsigned int timeout, 59 const unsigned int timeout,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 UsbTransferType transfer_type, 118 UsbTransferType transfer_type,
117 net::IOBuffer* buffer, 119 net::IOBuffer* buffer,
118 const size_t length, 120 const size_t length,
119 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, 121 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
120 const UsbTransferCallback& callback); 122 const UsbTransferCallback& callback);
121 123
122 // Invokes the callbacks associated with a given transfer, and removes it from 124 // Invokes the callbacks associated with a given transfer, and removes it from
123 // the in-flight transfer set. 125 // the in-flight transfer set.
124 void TransferComplete(PlatformUsbTransferHandle transfer); 126 void TransferComplete(PlatformUsbTransferHandle transfer);
125 127
128 bool GetSupportedLanguages();
129 bool GetStringDescriptor(uint8 string_id, base::string16* string);
130
126 // Informs the object to drop internal references. 131 // Informs the object to drop internal references.
127 void InternalClose(); 132 void InternalClose();
128 133
129 UsbDeviceImpl* device_; 134 UsbDeviceImpl* device_;
130 135
131 PlatformUsbDeviceHandle handle_; 136 PlatformUsbDeviceHandle handle_;
132 137
133 scoped_refptr<UsbConfigDescriptor> interfaces_; 138 scoped_refptr<UsbConfigDescriptor> interfaces_;
134 139
140 std::vector<uint16> languages_;
141 std::map<uint8, base::string16> strings_;
142
135 typedef std::map<int, scoped_refptr<InterfaceClaimer> > ClaimedInterfaceMap; 143 typedef std::map<int, scoped_refptr<InterfaceClaimer> > ClaimedInterfaceMap;
136 ClaimedInterfaceMap claimed_interfaces_; 144 ClaimedInterfaceMap claimed_interfaces_;
137 145
138 typedef std::map<PlatformUsbTransferHandle, Transfer> TransferMap; 146 typedef std::map<PlatformUsbTransferHandle, Transfer> TransferMap;
139 TransferMap transfers_; 147 TransferMap transfers_;
140 148
141 // A map from endpoints to interfaces 149 // A map from endpoints to interfaces
142 typedef std::map<int, int> EndpointMap; 150 typedef std::map<int, int> EndpointMap;
143 EndpointMap endpoint_map_; 151 EndpointMap endpoint_map_;
144 152
145 // Retain the UsbContext so that the platform context will not be destroyed 153 // Retain the UsbContext so that the platform context will not be destroyed
146 // before this handle. 154 // before this handle.
147 scoped_refptr<UsbContext> context_; 155 scoped_refptr<UsbContext> context_;
148 156
149 base::ThreadChecker thread_checker_; 157 base::ThreadChecker thread_checker_;
150 158
151 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl); 159 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl);
152 }; 160 };
153 161
154 } // namespace usb_service 162 } // namespace usb_service
155 163
156 #endif // COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_IMPL_H_ 164 #endif // COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « components/usb_service/usb_device_handle.h ('k') | components/usb_service/usb_device_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698