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

Unified Diff: chrome/browser/usb/usb_device.h

Issue 12471013: Add chrome.usb.listInterfaces API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/usb/usb_device.h
diff --git a/chrome/browser/usb/usb_device.h b/chrome/browser/usb/usb_device.h
index fc8b0c225afc6b7ebfcc6ca5d46b38bba5a8164c..433fc3b345671e1452eb8cdf200f1565342aae1f 100644
--- a/chrome/browser/usb/usb_device.h
+++ b/chrome/browser/usb/usb_device.h
@@ -6,9 +6,11 @@
#define CHROME_BROWSER_USB_USB_DEVICE_H_
#include <map>
+#include <vector>
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
+#include "chrome/browser/usb/usb_interface.h"
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
@@ -39,13 +41,6 @@ enum UsbTransferStatus {
USB_TRANSFER_LENGTH_SHORT,
};
-enum UsbTransferType {
- USB_TRANSFER_CONTROL = 0,
- USB_TRANSFER_BULK,
- USB_TRANSFER_INTERRUPT,
- USB_TRANSFER_ISOCHRONOUS,
-};
-
typedef base::Callback<void(UsbTransferStatus, scoped_refptr<net::IOBuffer>,
size_t)> UsbTransferCallback;
typedef base::Callback<void(bool)> UsbInterfaceCallback;
@@ -55,7 +50,6 @@ typedef base::Callback<void(bool)> UsbInterfaceCallback;
// standard USB operations.
class UsbDevice : public base::RefCounted<UsbDevice> {
public:
- enum TransferDirection { INBOUND, OUTBOUND };
enum TransferRequestType { STANDARD, CLASS, VENDOR, RESERVED };
enum TransferRecipient { DEVICE, INTERFACE, ENDPOINT, OTHER };
@@ -70,6 +64,9 @@ class UsbDevice : public base::RefCounted<UsbDevice> {
// is invoked after the device has been closed.
virtual void Close(const base::Callback<void()>& callback);
+ virtual void ListInterfaces(PlatformUsbConfigDescriptor* config,
Bei Zhang 2013/04/26 22:38:01 This is actually GetConfigDescriptor.
Kenny Root (Google) 2013/05/08 01:15:08 You mean change the name?
+ const UsbInterfaceCallback& callback);
+
virtual void ClaimInterface(const int interface_number,
const UsbInterfaceCallback& callback);
@@ -81,7 +78,7 @@ class UsbDevice : public base::RefCounted<UsbDevice> {
const int alternate_setting,
const UsbInterfaceCallback& callback);
- virtual void ControlTransfer(const TransferDirection direction,
+ virtual void ControlTransfer(const UsbInterfaceDirection direction,
const TransferRequestType request_type,
const TransferRecipient recipient,
const uint8 request,
@@ -92,21 +89,21 @@ class UsbDevice : public base::RefCounted<UsbDevice> {
const unsigned int timeout,
const UsbTransferCallback& callback);
- virtual void BulkTransfer(const TransferDirection direction,
+ virtual void BulkTransfer(const UsbInterfaceDirection direction,
const uint8 endpoint,
net::IOBuffer* buffer,
const size_t length,
const unsigned int timeout,
const UsbTransferCallback& callback);
- virtual void InterruptTransfer(const TransferDirection direction,
+ virtual void InterruptTransfer(const UsbInterfaceDirection direction,
const uint8 endpoint,
net::IOBuffer* buffer,
const size_t length,
const unsigned int timeout,
const UsbTransferCallback& callback);
- virtual void IsochronousTransfer(const TransferDirection direction,
+ virtual void IsochronousTransfer(const UsbInterfaceDirection direction,
const uint8 endpoint,
net::IOBuffer* buffer,
const size_t length,
@@ -133,7 +130,7 @@ class UsbDevice : public base::RefCounted<UsbDevice> {
Transfer();
~Transfer();
- UsbTransferType transfer_type;
+ UsbEndpointType transfer_type;
scoped_refptr<net::IOBuffer> buffer;
size_t length;
UsbTransferCallback callback;
@@ -146,7 +143,7 @@ class UsbDevice : public base::RefCounted<UsbDevice> {
// the completion callback until the transfer finishes, whereupon it invokes
// the callback then releases the buffer.
void SubmitTransfer(PlatformUsbTransferHandle handle,
- UsbTransferType transfer_type,
+ UsbEndpointType interface_type,
Bei Zhang 2013/04/26 22:38:01 Isn't this endpoint_type?
Kenny Root (Google) 2013/05/08 01:15:08 Done.
net::IOBuffer* buffer,
const size_t length,
const UsbTransferCallback& callback);

Powered by Google App Engine
This is Rietveld 408576698