Index: chrome/browser/extensions/api/usb/usb_api.h |
diff --git a/chrome/browser/extensions/api/usb/usb_api.h b/chrome/browser/extensions/api/usb/usb_api.h |
index 8f39b5e27eb31d23604c9d44c5ab69d201c4b6fd..14e2540de8f02aee832427ef3b9b82d757f81874 100644 |
--- a/chrome/browser/extensions/api/usb/usb_api.h |
+++ b/chrome/browser/extensions/api/usb/usb_api.h |
@@ -64,8 +64,6 @@ class UsbFindDevicesFunction : public UsbAsyncApiFunction { |
UsbFindDevicesFunction(); |
- static void SetDeviceForTest(UsbDevice* device); |
- |
protected: |
virtual ~UsbFindDevicesFunction(); |
@@ -85,6 +83,51 @@ class UsbFindDevicesFunction : public UsbAsyncApiFunction { |
scoped_ptr<extensions::api::usb::FindDevices::Params> parameters_; |
}; |
+class UsbGetDevicesFunction : public UsbAsyncApiFunction { |
+ public: |
+ DECLARE_EXTENSION_FUNCTION("usb.getDevices", USB_GETDEVICES) |
+ |
+ UsbGetDevicesFunction(); |
+ |
+ static void SetDeviceForTest(UsbDevice* device); |
+ |
+ virtual bool Prepare() OVERRIDE; |
+ virtual void AsyncWorkStart() OVERRIDE; |
+ |
+ protected: |
+ virtual ~UsbGetDevicesFunction(); |
+ |
+ private: |
+ void EnumerationCompletedFileThread( |
+ scoped_ptr<std::vector<scoped_refptr<UsbDevice> > > devices); |
+ |
+ scoped_ptr<base::ListValue> result_; |
+ scoped_ptr<extensions::api::usb::GetDevices::Params> parameters_; |
+}; |
+ |
+class UsbOpenDeviceFunction : public UsbAsyncApiFunction { |
+ public: |
+ DECLARE_EXTENSION_FUNCTION("usb.openDevice", USB_OPENDEVICE) |
+ |
+ UsbOpenDeviceFunction(); |
+ |
+ virtual bool Prepare() OVERRIDE; |
+ virtual void AsyncWorkStart() OVERRIDE; |
+ |
+ protected: |
+ virtual ~UsbOpenDeviceFunction(); |
+ |
+ private: |
+ void OpenDeviceOnFile(); |
+ |
+ // This should be run on the IO thread. |
+ // Create ApiResources and reply. |
asargent_no_longer_on_chrome
2013/08/22 21:06:13
Does it actually create a UsbDeviceResource or som
Bei Zhang
2013/08/23 22:52:00
This is not needed since we simplified the threadi
|
+ void OnCompleted(); |
+ |
+ scoped_refptr<UsbDeviceHandle> handle_; |
+ scoped_ptr<extensions::api::usb::OpenDevice::Params> parameters_; |
+}; |
+ |
class UsbListInterfacesFunction : public UsbAsyncApiFunction { |
public: |
DECLARE_EXTENSION_FUNCTION("usb.listInterfaces", USB_LISTINTERFACES) |