| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/bluetooth/dbus/fake_bluetooth_input_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_input_client.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 FakeBluetoothDeviceClient::kConnectUnpairablePath) { | 88 FakeBluetoothDeviceClient::kConnectUnpairablePath) { |
| 89 properties->reconnect_mode.ReplaceValue( | 89 properties->reconnect_mode.ReplaceValue( |
| 90 bluetooth_input::kDeviceReconnectModeProperty); | 90 bluetooth_input::kDeviceReconnectModeProperty); |
| 91 } else { | 91 } else { |
| 92 properties->reconnect_mode.ReplaceValue( | 92 properties->reconnect_mode.ReplaceValue( |
| 93 bluetooth_input::kAnyReconnectModeProperty); | 93 bluetooth_input::kAnyReconnectModeProperty); |
| 94 } | 94 } |
| 95 | 95 |
| 96 properties_map_[object_path] = properties; | 96 properties_map_[object_path] = properties; |
| 97 | 97 |
| 98 FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, | 98 for (auto& observer : observers_) |
| 99 InputAdded(object_path)); | 99 observer.InputAdded(object_path); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void FakeBluetoothInputClient::RemoveInputDevice( | 102 void FakeBluetoothInputClient::RemoveInputDevice( |
| 103 const dbus::ObjectPath& object_path) { | 103 const dbus::ObjectPath& object_path) { |
| 104 PropertiesMap::iterator it = properties_map_.find(object_path); | 104 PropertiesMap::iterator it = properties_map_.find(object_path); |
| 105 | 105 |
| 106 if (it == properties_map_.end()) | 106 if (it == properties_map_.end()) |
| 107 return; | 107 return; |
| 108 | 108 |
| 109 FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, | 109 for (auto& observer : observers_) |
| 110 InputRemoved(object_path)); | 110 observer.InputRemoved(object_path); |
| 111 | 111 |
| 112 delete it->second; | 112 delete it->second; |
| 113 properties_map_.erase(it); | 113 properties_map_.erase(it); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void FakeBluetoothInputClient::OnPropertyChanged( | 116 void FakeBluetoothInputClient::OnPropertyChanged( |
| 117 const dbus::ObjectPath& object_path, | 117 const dbus::ObjectPath& object_path, |
| 118 const std::string& property_name) { | 118 const std::string& property_name) { |
| 119 FOR_EACH_OBSERVER(BluetoothInputClient::Observer, observers_, | 119 for (auto& observer : observers_) |
| 120 InputPropertyChanged(object_path, property_name)); | 120 observer.InputPropertyChanged(object_path, property_name); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace bluez | 123 } // namespace bluez |
| OLD | NEW |