| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 platform_config->extra + platform_config->extra_length); | 137 platform_config->extra + platform_config->extra_length); |
| 138 | 138 |
| 139 configuration->AssignFirstInterfaceNumbers(); | 139 configuration->AssignFirstInterfaceNumbers(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace | 142 } // namespace |
| 143 | 143 |
| 144 UsbDeviceImpl::UsbDeviceImpl( | 144 UsbDeviceImpl::UsbDeviceImpl( |
| 145 scoped_refptr<UsbContext> context, | 145 scoped_refptr<UsbContext> context, |
| 146 PlatformUsbDevice platform_device, | 146 PlatformUsbDevice platform_device, |
| 147 uint16_t vendor_id, | 147 const libusb_device_descriptor& descriptor, |
| 148 uint16_t product_id, | |
| 149 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner) | 148 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner) |
| 150 : UsbDevice(vendor_id, | 149 : UsbDevice(descriptor.bcdUSB, |
| 151 product_id, | 150 descriptor.bDeviceClass, |
| 151 descriptor.bDeviceSubClass, |
| 152 descriptor.bDeviceProtocol, |
| 153 descriptor.idVendor, |
| 154 descriptor.idProduct, |
| 155 descriptor.bcdDevice, |
| 152 base::string16(), | 156 base::string16(), |
| 153 base::string16(), | 157 base::string16(), |
| 154 base::string16()), | 158 base::string16()), |
| 155 platform_device_(platform_device), | 159 platform_device_(platform_device), |
| 156 context_(context), | 160 context_(context), |
| 157 task_runner_(base::ThreadTaskRunnerHandle::Get()), | 161 task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 158 blocking_task_runner_(blocking_task_runner) { | 162 blocking_task_runner_(blocking_task_runner) { |
| 159 CHECK(platform_device) << "platform_device cannot be NULL"; | 163 CHECK(platform_device) << "platform_device cannot be NULL"; |
| 160 libusb_ref_device(platform_device); | 164 libusb_ref_device(platform_device); |
| 161 ReadAllConfigurations(); | 165 ReadAllConfigurations(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle, | 335 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle, |
| 332 const OpenCallback& callback) { | 336 const OpenCallback& callback) { |
| 333 DCHECK(thread_checker_.CalledOnValidThread()); | 337 DCHECK(thread_checker_.CalledOnValidThread()); |
| 334 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl( | 338 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl( |
| 335 context_, this, platform_handle, blocking_task_runner_); | 339 context_, this, platform_handle, blocking_task_runner_); |
| 336 handles_.push_back(device_handle); | 340 handles_.push_back(device_handle); |
| 337 callback.Run(device_handle); | 341 callback.Run(device_handle); |
| 338 } | 342 } |
| 339 | 343 |
| 340 } // namespace device | 344 } // namespace device |
| OLD | NEW |