| 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 #include "device/usb/usb_device_impl.h" | 5 #include "device/usb/usb_device_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "components/device_event_log/device_event_log.h" | 15 #include "components/device_event_log/device_event_log.h" |
| 16 #include "device/usb/usb_context.h" | 16 #include "device/usb/usb_context.h" |
| 17 #include "device/usb/usb_descriptors.h" | 17 #include "device/usb/usb_descriptors.h" |
| 18 #include "device/usb/usb_device_handle_impl.h" | 18 #include "device/usb/usb_device_handle_impl.h" |
| 19 #include "device/usb/usb_error.h" | 19 #include "device/usb/usb_error.h" |
| 20 #include "third_party/libusb/src/libusb/libusb.h" | 20 #include "third_party/libusb/src/libusb/libusb.h" |
| 21 | 21 |
| 22 #if defined(OS_CHROMEOS) | 22 #if defined(OS_CHROMEOS) |
| 23 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
| 24 #include "chromeos/dbus/permission_broker_client.h" | 24 #include "chromeos/dbus/permission_broker_client.h" |
| 25 #include "dbus/file_descriptor.h" | 25 #include "dbus/file_descriptor.h" // nogncheck |
| 26 #endif // defined(OS_CHROMEOS) | 26 #endif // defined(OS_CHROMEOS) |
| 27 | 27 |
| 28 namespace device { | 28 namespace device { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 UsbEndpointDirection GetDirection( | 32 UsbEndpointDirection GetDirection( |
| 33 const libusb_endpoint_descriptor* descriptor) { | 33 const libusb_endpoint_descriptor* descriptor) { |
| 34 switch (descriptor->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) { | 34 switch (descriptor->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) { |
| 35 case LIBUSB_ENDPOINT_IN: | 35 case LIBUSB_ENDPOINT_IN: |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle, | 328 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle, |
| 329 const OpenCallback& callback) { | 329 const OpenCallback& callback) { |
| 330 DCHECK(thread_checker_.CalledOnValidThread()); | 330 DCHECK(thread_checker_.CalledOnValidThread()); |
| 331 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl( | 331 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl( |
| 332 context_, this, platform_handle, blocking_task_runner_); | 332 context_, this, platform_handle, blocking_task_runner_); |
| 333 handles_.push_back(device_handle); | 333 handles_.push_back(device_handle); |
| 334 callback.Run(device_handle); | 334 callback.Run(device_handle); |
| 335 } | 335 } |
| 336 | 336 |
| 337 } // namespace device | 337 } // namespace device |
| OLD | NEW |