| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/files/scoped_file.h" | 13 #include "base/files/scoped_file.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "device/usb/usb_device.h" | 17 #include "device/usb/usb_device.h" |
| 18 #include "device/usb/webusb_descriptors.h" | 18 #include "device/usb/webusb_descriptors.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace dbus { | |
| 25 class FileDescriptor; | |
| 26 } | |
| 27 | |
| 28 namespace device { | 24 namespace device { |
| 29 | 25 |
| 30 struct UsbConfigDescriptor; | 26 struct UsbConfigDescriptor; |
| 31 struct UsbDeviceDescriptor; | 27 struct UsbDeviceDescriptor; |
| 32 | 28 |
| 33 class UsbDeviceLinux : public UsbDevice { | 29 class UsbDeviceLinux : public UsbDevice { |
| 34 public: | 30 public: |
| 35 // UsbDevice implementation: | 31 // UsbDevice implementation: |
| 36 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 37 void CheckUsbAccess(const ResultCallback& callback) override; | 33 void CheckUsbAccess(const ResultCallback& callback) override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 const std::string& manufacturer_string, | 53 const std::string& manufacturer_string, |
| 58 const std::string& product_string, | 54 const std::string& product_string, |
| 59 const std::string& serial_number, | 55 const std::string& serial_number, |
| 60 uint8_t active_configuration, | 56 uint8_t active_configuration, |
| 61 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | 57 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
| 62 | 58 |
| 63 ~UsbDeviceLinux() override; | 59 ~UsbDeviceLinux() override; |
| 64 | 60 |
| 65 private: | 61 private: |
| 66 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
| 67 void OnOpenRequestComplete(const OpenCallback& callback, | 63 void OnOpenRequestComplete(const OpenCallback& callback, base::ScopedFD fd); |
| 68 dbus::FileDescriptor fd); | |
| 69 void OnOpenRequestError(const OpenCallback& callback, | 64 void OnOpenRequestError(const OpenCallback& callback, |
| 70 const std::string& error_name, | 65 const std::string& error_name, |
| 71 const std::string& error_message); | 66 const std::string& error_message); |
| 72 void OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd, | |
| 73 const OpenCallback& callback); | |
| 74 #else | 67 #else |
| 75 void OpenOnBlockingThread(const OpenCallback& callback); | 68 void OpenOnBlockingThread(const OpenCallback& callback); |
| 76 #endif // defined(OS_CHROMEOS) | 69 #endif // defined(OS_CHROMEOS) |
| 77 void Opened(base::ScopedFD fd, const OpenCallback& callback); | 70 void Opened(base::ScopedFD fd, const OpenCallback& callback); |
| 78 | 71 |
| 79 base::ThreadChecker thread_checker_; | 72 base::ThreadChecker thread_checker_; |
| 80 | 73 |
| 81 const std::string device_path_; | 74 const std::string device_path_; |
| 82 | 75 |
| 83 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 76 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 84 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 77 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 85 | 78 |
| 86 DISALLOW_COPY_AND_ASSIGN(UsbDeviceLinux); | 79 DISALLOW_COPY_AND_ASSIGN(UsbDeviceLinux); |
| 87 }; | 80 }; |
| 88 | 81 |
| 89 } // namespace device | 82 } // namespace device |
| 90 | 83 |
| 91 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ | 84 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ |
| OLD | NEW |