| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
| 6 #define DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 6 #define DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 struct UsbConfigDescriptor; | 26 struct UsbConfigDescriptor; |
| 27 class UsbDeviceImpl; | 27 class UsbDeviceImpl; |
| 28 | 28 |
| 29 typedef libusb_device_handle* PlatformUsbDeviceHandle; | 29 typedef libusb_device_handle* PlatformUsbDeviceHandle; |
| 30 typedef libusb_iso_packet_descriptor* PlatformUsbIsoPacketDescriptor; | 30 typedef libusb_iso_packet_descriptor* PlatformUsbIsoPacketDescriptor; |
| 31 typedef libusb_transfer* PlatformUsbTransferHandle; | 31 typedef libusb_transfer* PlatformUsbTransferHandle; |
| 32 | 32 |
| 33 // UsbDeviceHandle class provides basic I/O related functionalities. | 33 // UsbDeviceHandle class provides basic I/O related functionalities. |
| 34 class UsbDeviceHandleImpl : public UsbDeviceHandle { | 34 class UsbDeviceHandleImpl : public UsbDeviceHandle { |
| 35 public: | 35 public: |
| 36 virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE; | 36 virtual scoped_refptr<UsbDevice> GetDevice() const override; |
| 37 virtual void Close() OVERRIDE; | 37 virtual void Close() override; |
| 38 virtual bool ClaimInterface(int interface_number) OVERRIDE; | 38 virtual bool ClaimInterface(int interface_number) override; |
| 39 virtual bool ReleaseInterface(int interface_number) OVERRIDE; | 39 virtual bool ReleaseInterface(int interface_number) override; |
| 40 virtual bool SetInterfaceAlternateSetting(int interface_number, | 40 virtual bool SetInterfaceAlternateSetting(int interface_number, |
| 41 int alternate_setting) OVERRIDE; | 41 int alternate_setting) override; |
| 42 virtual bool ResetDevice() OVERRIDE; | 42 virtual bool ResetDevice() override; |
| 43 virtual bool GetStringDescriptor(uint8 string_id, | 43 virtual bool GetStringDescriptor(uint8 string_id, |
| 44 base::string16* string) OVERRIDE; | 44 base::string16* string) override; |
| 45 | 45 |
| 46 virtual void ControlTransfer(UsbEndpointDirection direction, | 46 virtual void ControlTransfer(UsbEndpointDirection direction, |
| 47 TransferRequestType request_type, | 47 TransferRequestType request_type, |
| 48 TransferRecipient recipient, | 48 TransferRecipient recipient, |
| 49 uint8 request, | 49 uint8 request, |
| 50 uint16 value, | 50 uint16 value, |
| 51 uint16 index, | 51 uint16 index, |
| 52 net::IOBuffer* buffer, | 52 net::IOBuffer* buffer, |
| 53 size_t length, | 53 size_t length, |
| 54 unsigned int timeout, | 54 unsigned int timeout, |
| 55 const UsbTransferCallback& callback) OVERRIDE; | 55 const UsbTransferCallback& callback) override; |
| 56 | 56 |
| 57 virtual void BulkTransfer(UsbEndpointDirection direction, | 57 virtual void BulkTransfer(UsbEndpointDirection direction, |
| 58 uint8 endpoint, | 58 uint8 endpoint, |
| 59 net::IOBuffer* buffer, | 59 net::IOBuffer* buffer, |
| 60 size_t length, | 60 size_t length, |
| 61 unsigned int timeout, | 61 unsigned int timeout, |
| 62 const UsbTransferCallback& callback) OVERRIDE; | 62 const UsbTransferCallback& callback) override; |
| 63 | 63 |
| 64 virtual void InterruptTransfer(UsbEndpointDirection direction, | 64 virtual void InterruptTransfer(UsbEndpointDirection direction, |
| 65 uint8 endpoint, | 65 uint8 endpoint, |
| 66 net::IOBuffer* buffer, | 66 net::IOBuffer* buffer, |
| 67 size_t length, | 67 size_t length, |
| 68 unsigned int timeout, | 68 unsigned int timeout, |
| 69 const UsbTransferCallback& callback) OVERRIDE; | 69 const UsbTransferCallback& callback) override; |
| 70 | 70 |
| 71 virtual void IsochronousTransfer( | 71 virtual void IsochronousTransfer( |
| 72 UsbEndpointDirection direction, | 72 UsbEndpointDirection direction, |
| 73 uint8 endpoint, | 73 uint8 endpoint, |
| 74 net::IOBuffer* buffer, | 74 net::IOBuffer* buffer, |
| 75 size_t length, | 75 size_t length, |
| 76 unsigned int packets, | 76 unsigned int packets, |
| 77 unsigned int packet_length, | 77 unsigned int packet_length, |
| 78 unsigned int timeout, | 78 unsigned int timeout, |
| 79 const UsbTransferCallback& callback) OVERRIDE; | 79 const UsbTransferCallback& callback) override; |
| 80 | 80 |
| 81 PlatformUsbDeviceHandle handle() const { return handle_; } | 81 PlatformUsbDeviceHandle handle() const { return handle_; } |
| 82 | 82 |
| 83 protected: | 83 protected: |
| 84 friend class UsbDeviceImpl; | 84 friend class UsbDeviceImpl; |
| 85 | 85 |
| 86 // This constructor is called by UsbDevice. | 86 // This constructor is called by UsbDevice. |
| 87 UsbDeviceHandleImpl(scoped_refptr<UsbContext> context, | 87 UsbDeviceHandleImpl(scoped_refptr<UsbContext> context, |
| 88 UsbDeviceImpl* device, | 88 UsbDeviceImpl* device, |
| 89 PlatformUsbDeviceHandle handle, | 89 PlatformUsbDeviceHandle handle, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 162 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 163 | 163 |
| 164 base::ThreadChecker thread_checker_; | 164 base::ThreadChecker thread_checker_; |
| 165 | 165 |
| 166 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl); | 166 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl); |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace device | 169 } // namespace device |
| 170 | 170 |
| 171 #endif // DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 171 #endif // DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
| OLD | NEW |