| Index: components/usb_service/usb_device_handle.h
|
| diff --git a/chrome/browser/usb/usb_device_handle.h b/components/usb_service/usb_device_handle.h
|
| similarity index 88%
|
| rename from chrome/browser/usb/usb_device_handle.h
|
| rename to components/usb_service/usb_device_handle.h
|
| index 09cd101d2b71d3c4241a7fca9dc9c3b318118118..2934721bf65ffa459c665ba5428c4482a4fab456 100644
|
| --- a/chrome/browser/usb/usb_device_handle.h
|
| +++ b/components/usb_service/usb_device_handle.h
|
| @@ -2,40 +2,37 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_USB_USB_DEVICE_HANDLE_H_
|
| -#define CHROME_BROWSER_USB_USB_DEVICE_HANDLE_H_
|
| +#ifndef COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_H_
|
| +#define COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_H_
|
|
|
| #include <map>
|
| #include <vector>
|
|
|
| +#include "base/callback.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/strings/string16.h"
|
| -#include "base/synchronization/lock.h"
|
| #include "base/threading/thread_checker.h"
|
| -#include "chrome/browser/usb/usb_interface.h"
|
| -#include "net/base/completion_callback.h"
|
| +#include "components/usb_service/usb_interface.h"
|
| +#include "components/usb_service/usb_service_export.h"
|
| #include "net/base/io_buffer.h"
|
|
|
| struct libusb_device_handle;
|
| struct libusb_iso_packet_descriptor;
|
| struct libusb_transfer;
|
|
|
| -typedef libusb_device_handle* PlatformUsbDeviceHandle;
|
| -typedef libusb_iso_packet_descriptor* PlatformUsbIsoPacketDescriptor;
|
| -typedef libusb_transfer* PlatformUsbTransferHandle;
|
| +namespace base {
|
| +class MessageLoopProxy;
|
| +}
|
| +
|
| +namespace usb_service {
|
|
|
| class UsbContext;
|
| class UsbConfigDescriptor;
|
| class UsbDevice;
|
| -class UsbInterfaceDescriptor;
|
|
|
| -namespace base {
|
| - class MessageLoopProxy;
|
| -} // namespace base
|
| -
|
| -namespace net {
|
| -class IOBuffer;
|
| -} // namespace net
|
| +typedef libusb_device_handle* PlatformUsbDeviceHandle;
|
| +typedef libusb_iso_packet_descriptor* PlatformUsbIsoPacketDescriptor;
|
| +typedef libusb_transfer* PlatformUsbTransferHandle;
|
|
|
| enum UsbTransferStatus {
|
| USB_TRANSFER_COMPLETED = 0,
|
| @@ -48,11 +45,13 @@ enum UsbTransferStatus {
|
| USB_TRANSFER_LENGTH_SHORT,
|
| };
|
|
|
| -typedef base::Callback<void(UsbTransferStatus, scoped_refptr<net::IOBuffer>,
|
| - size_t)> UsbTransferCallback;
|
| +typedef base::Callback<
|
| + void(UsbTransferStatus, scoped_refptr<net::IOBuffer>, size_t)>
|
| + UsbTransferCallback;
|
|
|
| // UsbDeviceHandle class provides basic I/O related functionalities.
|
| -class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
|
| +class USB_SERVICE_EXPORT UsbDeviceHandle
|
| + : public base::RefCountedThreadSafe<UsbDeviceHandle> {
|
| public:
|
| enum TransferRequestType { STANDARD, CLASS, VENDOR, RESERVED };
|
| enum TransferRecipient { DEVICE, INTERFACE, ENDPOINT, OTHER };
|
| @@ -71,9 +70,8 @@ class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
|
| // called on FILE thread.
|
| virtual bool ClaimInterface(const int interface_number);
|
| virtual bool ReleaseInterface(const int interface_number);
|
| - virtual bool SetInterfaceAlternateSetting(
|
| - const int interface_number,
|
| - const int alternate_setting);
|
| + virtual bool SetInterfaceAlternateSetting(const int interface_number,
|
| + const int alternate_setting);
|
| virtual bool ResetDevice();
|
| virtual bool GetSerial(base::string16* serial);
|
|
|
| @@ -118,7 +116,8 @@ class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
|
|
|
| // This constructor is called by UsbDevice.
|
| UsbDeviceHandle(scoped_refptr<UsbContext> context,
|
| - UsbDevice* device, PlatformUsbDeviceHandle handle,
|
| + UsbDevice* device,
|
| + PlatformUsbDeviceHandle handle,
|
| scoped_refptr<UsbConfigDescriptor> interfaces);
|
|
|
| // This constructor variant is for use in testing only.
|
| @@ -182,4 +181,6 @@ class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
|
| DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandle);
|
| };
|
|
|
| -#endif // CHROME_BROWSER_USB_USB_DEVICE_HANDLE_H_
|
| +} // namespace usb_service
|
| +
|
| +#endif // COMPONENTS_USB_SERVICE_USB_DEVICE_HANDLE_H_
|
|
|