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

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

Issue 16316004: Separate usb device handle from usb device. (deprecate) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build 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
Index: chrome/browser/extensions/api/usb/usb_device_resource.h
diff --git a/chrome/browser/extensions/api/usb/usb_device_resource.h b/chrome/browser/extensions/api/usb/usb_device_resource.h
index eed0a932433e94c5911a4e9f9299c40f4948d6c7..1f4823c5e6226a51fae977fdbbb1a7c4913252f6 100644
--- a/chrome/browser/extensions/api/usb/usb_device_resource.h
+++ b/chrome/browser/extensions/api/usb/usb_device_resource.h
@@ -12,10 +12,10 @@
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/extensions/api/api_resource.h"
-#include "chrome/browser/usb/usb_device.h"
+#include "chrome/browser/usb/usb_device_handle.h"
#include "chrome/common/extensions/api/usb.h"
-class UsbDevice;
+class UsbDeviceHandle;
namespace net {
class IOBuffer;
@@ -24,18 +24,59 @@ class IOBuffer;
namespace extensions {
// A UsbDeviceResource is an ApiResource wrapper for a UsbDevice.
+// It will redirect all the requests on the FILE thread.
class UsbDeviceResource : public ApiResource {
public:
UsbDeviceResource(const std::string& owner_extension_id,
- scoped_refptr<UsbDevice> device);
+ scoped_refptr<UsbDeviceHandle> device);
virtual ~UsbDeviceResource();
- scoped_refptr<UsbDevice> device() {
- return device_;
- }
+ virtual void Close(const base::Callback<void()>& callback);
+
+ virtual void ListInterfaces(UsbConfigDescriptor* config,
+ const UsbInterfaceCallback& callback);
+
+ virtual void ClaimInterface(const int interface_number,
+ const UsbInterfaceCallback& callback);
+
+ virtual void ReleaseInterface(const int interface_number,
+ const UsbInterfaceCallback& callback);
+
+ virtual void SetInterfaceAlternateSetting(
+ const int interface_number, const int alternate_setting,
+ const UsbInterfaceCallback& callback);
+
+ virtual void ControlTransfer(
+ const UsbEndpointDirection direction,
+ const UsbDeviceHandle::TransferRequestType request_type,
+ const UsbDeviceHandle::TransferRecipient recipient, const uint8 request,
+ const uint16 value, const uint16 index, net::IOBuffer* buffer,
+ const size_t length, const unsigned int timeout,
+ const UsbTransferCallback& callback);
+
+ virtual void BulkTransfer(const UsbEndpointDirection direction,
+ const uint8 endpoint, net::IOBuffer* buffer,
+ const size_t length, const unsigned int timeout,
+ const UsbTransferCallback& callback);
+
+ virtual void InterruptTransfer(const UsbEndpointDirection direction,
+ const uint8 endpoint, net::IOBuffer* buffer,
+ const size_t length,
+ const unsigned int timeout,
+ const UsbTransferCallback& callback);
+
+ virtual void IsochronousTransfer(const UsbEndpointDirection direction,
+ const uint8 endpoint, net::IOBuffer* buffer,
+ const size_t length,
+ const unsigned int packets,
+ const unsigned int packet_length,
+ const unsigned int timeout,
+ const UsbTransferCallback& callback);
+
+ virtual void ResetDevice(const base::Callback<void(bool)>& callback);
private:
- scoped_refptr<UsbDevice> device_;
+ scoped_refptr<UsbDeviceHandle> device_;
DISALLOW_COPY_AND_ASSIGN(UsbDeviceResource);
};

Powered by Google App Engine
This is Rietveld 408576698