| 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 f2230168bab27d3d71f3bacab42d8ea78c34cc19..82bbde9eae97f53cb3d96c509af9579f83200020 100644
|
| --- a/chrome/browser/extensions/api/usb/usb_api.h
|
| +++ b/chrome/browser/extensions/api/usb/usb_api.h
|
| @@ -10,12 +10,10 @@
|
| #include "base/memory/ref_counted.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"
|
| +#include "chrome/browser/usb/usb_device_handle.h"
|
| #include "chrome/common/extensions/api/usb.h"
|
| #include "net/base/io_buffer.h"
|
|
|
| -class UsbDevice;
|
| -
|
| namespace extensions {
|
|
|
| class UsbDeviceResource;
|
| @@ -46,9 +44,9 @@ class UsbAsyncApiTransferFunction : public UsbAsyncApiFunction {
|
| bool ConvertDirectionSafely(const extensions::api::usb::Direction& input,
|
| UsbEndpointDirection* output);
|
| bool ConvertRequestTypeSafely(const extensions::api::usb::RequestType& input,
|
| - UsbDevice::TransferRequestType* output);
|
| + UsbDeviceHandle::TransferRequestType* output);
|
| bool ConvertRecipientSafely(const extensions::api::usb::Recipient& input,
|
| - UsbDevice::TransferRecipient* output);
|
| + UsbDeviceHandle::TransferRecipient* output);
|
|
|
| void OnCompleted(UsbTransferStatus status,
|
| scoped_refptr<net::IOBuffer> data,
|
| @@ -61,11 +59,12 @@ class UsbFindDevicesFunction : public UsbAsyncApiFunction {
|
|
|
| UsbFindDevicesFunction();
|
|
|
| - static void SetDeviceForTest(UsbDevice* device);
|
| + static void SetDeviceForTest(UsbDeviceHandle* device);
|
|
|
| protected:
|
| virtual ~UsbFindDevicesFunction();
|
|
|
| + virtual bool PrePrepare() OVERRIDE;
|
| virtual bool Prepare() OVERRIDE;
|
| virtual void AsyncWorkStart() OVERRIDE;
|
|
|
| @@ -73,8 +72,30 @@ class UsbFindDevicesFunction : public UsbAsyncApiFunction {
|
| void OnCompleted();
|
|
|
| scoped_ptr<base::ListValue> result_;
|
| - std::vector<scoped_refptr<UsbDevice> > devices_;
|
| + std::vector<int> devices_;
|
| scoped_ptr<extensions::api::usb::FindDevices::Params> parameters_;
|
| + UsbService* service_;
|
| +};
|
| +
|
| +class UsbOpenDeviceFunction : public UsbAsyncApiFunction {
|
| + public:
|
| + DECLARE_EXTENSION_FUNCTION("usb.openDevice", USB_OPENDEVICE)
|
| +
|
| + UsbOpenDeviceFunction();
|
| +
|
| + protected:
|
| + virtual ~UsbOpenDeviceFunction();
|
| +
|
| + virtual bool PrePrepare() OVERRIDE;
|
| + virtual bool Prepare() OVERRIDE;
|
| + virtual void AsyncWorkStart() OVERRIDE;
|
| +
|
| + private:
|
| + void OnOpened(scoped_refptr<UsbDeviceHandle> handle);
|
| + void OnCompleted(scoped_refptr<UsbDeviceHandle> handle);
|
| +
|
| + scoped_ptr<extensions::api::usb::OpenDevice::Params> parameters_;
|
| + UsbService* service_;
|
| };
|
|
|
| class UsbListInterfacesFunction : public UsbAsyncApiFunction {
|
| @@ -119,9 +140,9 @@ class UsbCloseDeviceFunction : public UsbAsyncApiFunction {
|
| virtual bool Prepare() OVERRIDE;
|
| virtual void AsyncWorkStart() OVERRIDE;
|
|
|
| + private:
|
| void OnCompleted();
|
|
|
| - private:
|
| scoped_ptr<extensions::api::usb::CloseDevice::Params> parameters_;
|
| };
|
|
|
|
|