| 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/hid/input_service_linux.h" | 5 #include "device/hid/input_service_linux.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 DCHECK(CalledOnValidThread()); | 234 DCHECK(CalledOnValidThread()); |
| 235 DeviceMap::const_iterator it = devices_.find(id); | 235 DeviceMap::const_iterator it = devices_.find(id); |
| 236 if (it == devices_.end()) | 236 if (it == devices_.end()) |
| 237 return false; | 237 return false; |
| 238 *info = it->second; | 238 *info = it->second; |
| 239 return true; | 239 return true; |
| 240 } | 240 } |
| 241 | 241 |
| 242 void InputServiceLinux::AddDevice(const InputDeviceInfo& info) { | 242 void InputServiceLinux::AddDevice(const InputDeviceInfo& info) { |
| 243 devices_[info.id] = info; | 243 devices_[info.id] = info; |
| 244 FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceAdded(info)); | 244 for (auto& observer : observers_) |
| 245 observer.OnInputDeviceAdded(info); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void InputServiceLinux::RemoveDevice(const std::string& id) { | 248 void InputServiceLinux::RemoveDevice(const std::string& id) { |
| 248 devices_.erase(id); | 249 devices_.erase(id); |
| 249 FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceRemoved(id)); | 250 for (auto& observer : observers_) |
| 251 observer.OnInputDeviceRemoved(id); |
| 250 } | 252 } |
| 251 | 253 |
| 252 bool InputServiceLinux::CalledOnValidThread() const { | 254 bool InputServiceLinux::CalledOnValidThread() const { |
| 253 return thread_checker_.CalledOnValidThread(); | 255 return thread_checker_.CalledOnValidThread(); |
| 254 } | 256 } |
| 255 | 257 |
| 256 } // namespace device | 258 } // namespace device |
| OLD | NEW |