| 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/bluetooth/dbus/bluetooth_le_advertising_manager_client.h" | 5 #include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 object_manager_->RegisterInterface( | 143 object_manager_->RegisterInterface( |
| 144 bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface, | 144 bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface, |
| 145 this); | 145 this); |
| 146 } | 146 } |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 // Called by dbus::ObjectManager when an object with the advertising manager | 149 // Called by dbus::ObjectManager when an object with the advertising manager |
| 150 // interface is created. Informs observers. | 150 // interface is created. Informs observers. |
| 151 void ObjectAdded(const dbus::ObjectPath& object_path, | 151 void ObjectAdded(const dbus::ObjectPath& object_path, |
| 152 const std::string& interface_name) override { | 152 const std::string& interface_name) override { |
| 153 FOR_EACH_OBSERVER(BluetoothLEAdvertisingManagerClient::Observer, observers_, | 153 for (auto& observer : observers_) |
| 154 AdvertisingManagerAdded(object_path)); | 154 observer.AdvertisingManagerAdded(object_path); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Called by dbus::ObjectManager when an object with the advertising manager | 157 // Called by dbus::ObjectManager when an object with the advertising manager |
| 158 // interface is removed. Informs observers. | 158 // interface is removed. Informs observers. |
| 159 void ObjectRemoved(const dbus::ObjectPath& object_path, | 159 void ObjectRemoved(const dbus::ObjectPath& object_path, |
| 160 const std::string& interface_name) override { | 160 const std::string& interface_name) override { |
| 161 FOR_EACH_OBSERVER(BluetoothLEAdvertisingManagerClient::Observer, observers_, | 161 for (auto& observer : observers_) |
| 162 AdvertisingManagerRemoved(object_path)); | 162 observer.AdvertisingManagerRemoved(object_path); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Called when a response for successful method call is received. | 165 // Called when a response for successful method call is received. |
| 166 void OnSuccess(const base::Closure& callback, dbus::Response* response) { | 166 void OnSuccess(const base::Closure& callback, dbus::Response* response) { |
| 167 DCHECK(response); | 167 DCHECK(response); |
| 168 callback.Run(); | 168 callback.Run(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Called when a response for a failed method call is received. | 171 // Called when a response for a failed method call is received. |
| 172 void OnError(const ErrorCallback& error_callback, | 172 void OnError(const ErrorCallback& error_callback, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 203 BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {} | 203 BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {} |
| 204 | 204 |
| 205 BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {} | 205 BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {} |
| 206 | 206 |
| 207 BluetoothLEAdvertisingManagerClient* | 207 BluetoothLEAdvertisingManagerClient* |
| 208 BluetoothLEAdvertisingManagerClient::Create() { | 208 BluetoothLEAdvertisingManagerClient::Create() { |
| 209 return new BluetoothAdvertisementManagerClientImpl(); | 209 return new BluetoothAdvertisementManagerClientImpl(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace bluez | 212 } // namespace bluez |
| OLD | NEW |