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 a778503b58123f9adb3558a95db7d16d0ed282e6..3ab0cf2082db60eb17fc972a2a25e03e5d85036d 100644 |
--- a/chrome/browser/extensions/api/usb/usb_api.h |
+++ b/chrome/browser/extensions/api/usb/usb_api.h |
@@ -9,6 +9,7 @@ |
#include <vector> |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
#include "chrome/browser/extensions/api/api_function.h" |
#include "chrome/browser/extensions/api/api_resource_manager.h" |
#include "chrome/browser/usb/usb_device.h" |
@@ -64,8 +65,6 @@ class UsbFindDevicesFunction : public UsbAsyncApiFunction { |
UsbFindDevicesFunction(); |
- static void SetDeviceForTest(UsbDevice* device); |
- |
protected: |
virtual ~UsbFindDevicesFunction(); |
@@ -81,6 +80,45 @@ 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: |
+ scoped_refptr<UsbDeviceHandle> handle_; |
+ scoped_ptr<extensions::api::usb::OpenDevice::Params> parameters_; |
+}; |
+ |
class UsbListInterfacesFunction : public UsbAsyncApiFunction { |
public: |
DECLARE_EXTENSION_FUNCTION("usb.listInterfaces", USB_LISTINTERFACES) |