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

Side by Side Diff: extensions/browser/api/usb/usb_api.h

Issue 558373002: Add chrome.usb.getConfiguration and expose extra descriptors. (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 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 EXTENSIONS_BROWSER_API_USB_USB_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_USB_USB_API_H_
6 #define EXTENSIONS_BROWSER_API_USB_USB_API_H_ 6 #define EXTENSIONS_BROWSER_API_USB_USB_API_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 virtual void AsyncWorkStart() OVERRIDE; 137 virtual void AsyncWorkStart() OVERRIDE;
138 138
139 protected: 139 protected:
140 virtual ~UsbOpenDeviceFunction(); 140 virtual ~UsbOpenDeviceFunction();
141 141
142 private: 142 private:
143 scoped_refptr<device::UsbDeviceHandle> handle_; 143 scoped_refptr<device::UsbDeviceHandle> handle_;
144 scoped_ptr<extensions::core_api::usb::OpenDevice::Params> parameters_; 144 scoped_ptr<extensions::core_api::usb::OpenDevice::Params> parameters_;
145 }; 145 };
146 146
147 class UsbGetConfigurationFunction : public UsbAsyncApiFunction {
148 public:
149 DECLARE_EXTENSION_FUNCTION("usb.getConfiguration", USB_GETCONFIGURATION)
150
151 UsbGetConfigurationFunction();
152
153 protected:
154 virtual ~UsbGetConfigurationFunction();
155
156 virtual bool Prepare() OVERRIDE;
157 virtual void AsyncWorkStart() OVERRIDE;
158
159 private:
160 scoped_ptr<extensions::core_api::usb::GetConfiguration::Params> parameters_;
161 };
162
147 class UsbListInterfacesFunction : public UsbAsyncApiFunction { 163 class UsbListInterfacesFunction : public UsbAsyncApiFunction {
148 public: 164 public:
149 DECLARE_EXTENSION_FUNCTION("usb.listInterfaces", USB_LISTINTERFACES) 165 DECLARE_EXTENSION_FUNCTION("usb.listInterfaces", USB_LISTINTERFACES)
150 166
151 UsbListInterfacesFunction(); 167 UsbListInterfacesFunction();
152 168
153 protected: 169 protected:
154 virtual ~UsbListInterfacesFunction(); 170 virtual ~UsbListInterfacesFunction();
155 171
156 virtual bool Prepare() OVERRIDE; 172 virtual bool Prepare() OVERRIDE;
157 virtual void AsyncWorkStart() OVERRIDE; 173 virtual void AsyncWorkStart() OVERRIDE;
158 174
159 private: 175 private:
160 bool ConvertDirectionSafely(const device::UsbEndpointDirection& input,
161 extensions::core_api::usb::Direction* output);
162 bool ConvertSynchronizationTypeSafely(
163 const device::UsbSynchronizationType& input,
164 extensions::core_api::usb::SynchronizationType* output);
165 bool ConvertTransferTypeSafely(
166 const device::UsbTransferType& input,
167 extensions::core_api::usb::TransferType* output);
168 bool ConvertUsageTypeSafely(const device::UsbUsageType& input,
169 extensions::core_api::usb::UsageType* output);
170
171 scoped_ptr<extensions::core_api::usb::ListInterfaces::Params> parameters_; 176 scoped_ptr<extensions::core_api::usb::ListInterfaces::Params> parameters_;
172 }; 177 };
173 178
174 class UsbCloseDeviceFunction : public UsbAsyncApiFunction { 179 class UsbCloseDeviceFunction : public UsbAsyncApiFunction {
175 public: 180 public:
176 DECLARE_EXTENSION_FUNCTION("usb.closeDevice", USB_CLOSEDEVICE) 181 DECLARE_EXTENSION_FUNCTION("usb.closeDevice", USB_CLOSEDEVICE)
177 182
178 UsbCloseDeviceFunction(); 183 UsbCloseDeviceFunction();
179 184
180 protected: 185 protected:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 317
313 virtual bool Prepare() OVERRIDE; 318 virtual bool Prepare() OVERRIDE;
314 virtual void AsyncWorkStart() OVERRIDE; 319 virtual void AsyncWorkStart() OVERRIDE;
315 320
316 private: 321 private:
317 scoped_ptr<extensions::core_api::usb::ResetDevice::Params> parameters_; 322 scoped_ptr<extensions::core_api::usb::ResetDevice::Params> parameters_;
318 }; 323 };
319 } // namespace extensions 324 } // namespace extensions
320 325
321 #endif // EXTENSIONS_BROWSER_API_USB_USB_API_H_ 326 #endif // EXTENSIONS_BROWSER_API_USB_USB_API_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/usb/usb_api.cc » ('j') | extensions/browser/api/usb/usb_api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698