| 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_service_impl.h" | 5 #include "device/usb/usb_service_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 DeviceMonitorWin* device_monitor = DeviceMonitorWin::GetForAllInterfaces(); | 229 DeviceMonitorWin* device_monitor = DeviceMonitorWin::GetForAllInterfaces(); |
| 230 if (device_monitor) { | 230 if (device_monitor) { |
| 231 device_observer_.Add(device_monitor); | 231 device_observer_.Add(device_monitor); |
| 232 } | 232 } |
| 233 #endif // OS_WIN | 233 #endif // OS_WIN |
| 234 } | 234 } |
| 235 | 235 |
| 236 UsbServiceImpl::~UsbServiceImpl() { | 236 UsbServiceImpl::~UsbServiceImpl() { |
| 237 if (hotplug_enabled_) | 237 if (hotplug_enabled_) |
| 238 libusb_hotplug_deregister_callback(context_->context(), hotplug_handle_); | 238 libusb_hotplug_deregister_callback(context_->context(), hotplug_handle_); |
| 239 for (const auto& platform_device : ignored_devices_) | 239 for (auto* platform_device : ignored_devices_) |
| 240 libusb_unref_device(platform_device); | 240 libusb_unref_device(platform_device); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void UsbServiceImpl::GetDevices(const GetDevicesCallback& callback) { | 243 void UsbServiceImpl::GetDevices(const GetDevicesCallback& callback) { |
| 244 DCHECK(CalledOnValidThread()); | 244 DCHECK(CalledOnValidThread()); |
| 245 | 245 |
| 246 if (!context_) { | 246 if (!context_) { |
| 247 task_runner()->PostTask( | 247 task_runner()->PostTask( |
| 248 FROM_HERE, | 248 FROM_HERE, |
| 249 base::Bind(callback, std::vector<scoped_refptr<UsbDevice>>())); | 249 base::Bind(callback, std::vector<scoped_refptr<UsbDevice>>())); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 } | 535 } |
| 536 | 536 |
| 537 void UsbServiceImpl::EnumerationFailed(PlatformUsbDevice platform_device, | 537 void UsbServiceImpl::EnumerationFailed(PlatformUsbDevice platform_device, |
| 538 const base::Closure& refresh_complete) { | 538 const base::Closure& refresh_complete) { |
| 539 libusb_ref_device(platform_device); | 539 libusb_ref_device(platform_device); |
| 540 ignored_devices_.insert(platform_device); | 540 ignored_devices_.insert(platform_device); |
| 541 refresh_complete.Run(); | 541 refresh_complete.Run(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 } // namespace device | 544 } // namespace device |
| OLD | NEW |