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

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 the threading mess 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 15fcca01eb9321e44c353f715919e405a1053c0e..c1294fddf6e14c07f5fffab4a0942a6cc6cae461 100644
--- a/chrome/browser/extensions/api/usb/usb_device_resource.h
+++ b/chrome/browser/extensions/api/usb/usb_device_resource.h
@@ -13,10 +13,10 @@
#include "base/synchronization/lock.h"
#include "chrome/browser/extensions/api/api_resource.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"
-class UsbDevice;
+class UsbDeviceHandle;
namespace net {
class IOBuffer;
@@ -25,15 +25,56 @@ 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:
friend class ApiResourceManager<UsbDeviceResource>;
@@ -41,7 +82,7 @@ class UsbDeviceResource : public ApiResource {
return "UsbDeviceResourceManager";
}
- scoped_refptr<UsbDevice> device_;
+ scoped_refptr<UsbDeviceHandle> device_;
DISALLOW_COPY_AND_ASSIGN(UsbDeviceResource);
};
« no previous file with comments | « chrome/browser/extensions/api/usb/usb_apitest.cc ('k') | chrome/browser/extensions/api/usb/usb_device_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698