| 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_IMPL_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_IMPL_H_ |
| 6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ | 6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 12 #include "device/usb/usb_descriptors.h" | 13 #include "device/usb/usb_descriptors.h" |
| 13 #include "device/usb/usb_device.h" | 14 #include "device/usb/usb_device.h" |
| 14 #include "device/usb/webusb_descriptors.h" | 15 #include "device/usb/webusb_descriptors.h" |
| 15 | 16 |
| 16 struct libusb_device; | 17 struct libusb_device; |
| 17 struct libusb_config_descriptor; | 18 struct libusb_config_descriptor; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 typedef struct libusb_config_descriptor* PlatformUsbConfigDescriptor; | 35 typedef struct libusb_config_descriptor* PlatformUsbConfigDescriptor; |
| 35 typedef struct libusb_device_handle* PlatformUsbDeviceHandle; | 36 typedef struct libusb_device_handle* PlatformUsbDeviceHandle; |
| 36 | 37 |
| 37 class UsbDeviceImpl : public UsbDevice { | 38 class UsbDeviceImpl : public UsbDevice { |
| 38 public: | 39 public: |
| 39 // UsbDevice implementation: | 40 // UsbDevice implementation: |
| 40 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 41 void CheckUsbAccess(const ResultCallback& callback) override; | 42 void CheckUsbAccess(const ResultCallback& callback) override; |
| 42 #endif // OS_CHROMEOS | 43 #endif // OS_CHROMEOS |
| 43 void Open(const OpenCallback& callback) override; | 44 void Open(const OpenCallback& callback) override; |
| 44 bool Close(scoped_refptr<UsbDeviceHandle> handle) override; | |
| 45 const UsbConfigDescriptor* GetActiveConfiguration() override; | 45 const UsbConfigDescriptor* GetActiveConfiguration() override; |
| 46 | 46 |
| 47 // These functions are used during enumeration only. The values must not | 47 // These functions are used during enumeration only. The values must not |
| 48 // change during the object's lifetime. | 48 // change during the object's lifetime. |
| 49 void set_manufacturer_string(const base::string16& value) { | 49 void set_manufacturer_string(const base::string16& value) { |
| 50 manufacturer_string_ = value; | 50 manufacturer_string_ = value; |
| 51 } | 51 } |
| 52 void set_product_string(const base::string16& value) { | 52 void set_product_string(const base::string16& value) { |
| 53 product_string_ = value; | 53 product_string_ = value; |
| 54 } | 54 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 76 | 76 |
| 77 ~UsbDeviceImpl() override; | 77 ~UsbDeviceImpl() override; |
| 78 | 78 |
| 79 // Called only by UsbServiceImpl. | 79 // Called only by UsbServiceImpl. |
| 80 void set_visited(bool visited) { visited_ = visited; } | 80 void set_visited(bool visited) { visited_ = visited; } |
| 81 bool was_visited() const { return visited_; } | 81 bool was_visited() const { return visited_; } |
| 82 void OnDisconnect(); | 82 void OnDisconnect(); |
| 83 void ReadAllConfigurations(); | 83 void ReadAllConfigurations(); |
| 84 | 84 |
| 85 // Called by UsbDeviceHandleImpl. | 85 // Called by UsbDeviceHandleImpl. |
| 86 void Close(scoped_refptr<UsbDeviceHandle> handle); |
| 86 void RefreshActiveConfiguration(); | 87 void RefreshActiveConfiguration(); |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 void GetAllConfigurations(); | 90 void GetAllConfigurations(); |
| 90 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
| 91 void OnOpenRequestComplete(const OpenCallback& callback, | 92 void OnOpenRequestComplete(const OpenCallback& callback, |
| 92 dbus::FileDescriptor fd); | 93 dbus::FileDescriptor fd); |
| 93 void OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd, | 94 void OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd, |
| 94 const OpenCallback& callback); | 95 const OpenCallback& callback); |
| 95 #endif | 96 #endif |
| (...skipping 23 matching lines...) Expand all Loading... |
| 119 | 120 |
| 120 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 121 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 121 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 122 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 122 | 123 |
| 123 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl); | 124 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl); |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 } // namespace device | 127 } // namespace device |
| 127 | 128 |
| 128 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ | 129 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ |
| OLD | NEW |