| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.h" | 5 #include "device/usb/usb_device.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "device/usb/usb_device_handle.h" | 8 #include "device/usb/usb_device_handle.h" |
| 9 #include "device/usb/webusb_descriptors.h" | 9 #include "device/usb/webusb_descriptors.h" |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void UsbDevice::ActiveConfigurationChanged(int configuration_value) { | 66 void UsbDevice::ActiveConfigurationChanged(int configuration_value) { |
| 67 for (const auto& config : configurations_) { | 67 for (const auto& config : configurations_) { |
| 68 if (config.configuration_value == configuration_value) { | 68 if (config.configuration_value == configuration_value) { |
| 69 active_configuration_ = &config; | 69 active_configuration_ = &config; |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 void UsbDevice::NotifyDeviceRemoved() { | 75 void UsbDevice::NotifyDeviceRemoved() { |
| 76 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(this)); | 76 for (auto& observer : observer_list_) |
| 77 observer.OnDeviceRemoved(this); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void UsbDevice::OnDisconnect() { | 80 void UsbDevice::OnDisconnect() { |
| 80 // Swap out the handle list as HandleClosed() will try to modify it. | 81 // Swap out the handle list as HandleClosed() will try to modify it. |
| 81 std::list<UsbDeviceHandle*> handles; | 82 std::list<UsbDeviceHandle*> handles; |
| 82 handles.swap(handles_); | 83 handles.swap(handles_); |
| 83 for (auto* handle : handles_) | 84 for (auto* handle : handles_) |
| 84 handle->Close(); | 85 handle->Close(); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void UsbDevice::HandleClosed(UsbDeviceHandle* handle) { | 88 void UsbDevice::HandleClosed(UsbDeviceHandle* handle) { |
| 88 handles_.remove(handle); | 89 handles_.remove(handle); |
| 89 } | 90 } |
| 90 | 91 |
| 91 } // namespace device | 92 } // namespace device |
| OLD | NEW |