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

Unified Diff: chrome/browser/extensions/api/usb/usb_api.h

Issue 16316004: Separate usb device handle from usb device. (deprecate) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows compile and a bug. Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/usb/usb_api.cc » ('j') | chrome/common/extensions/api/usb.idl » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « no previous file | chrome/browser/extensions/api/usb/usb_api.cc » ('j') | chrome/common/extensions/api/usb.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698