| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/bluetooth_device_client.h" | 5 #include "device/bluetooth/dbus/bluetooth_device_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 bluetooth_object_manager::kBluetoothObjectManagerServicePath)); | 458 bluetooth_object_manager::kBluetoothObjectManagerServicePath)); |
| 459 object_manager_->RegisterInterface( | 459 object_manager_->RegisterInterface( |
| 460 bluetooth_device::kBluetoothDeviceInterface, this); | 460 bluetooth_device::kBluetoothDeviceInterface, this); |
| 461 } | 461 } |
| 462 | 462 |
| 463 private: | 463 private: |
| 464 // Called by dbus::ObjectManager when an object with the device interface | 464 // Called by dbus::ObjectManager when an object with the device interface |
| 465 // is created. Informs observers. | 465 // is created. Informs observers. |
| 466 void ObjectAdded(const dbus::ObjectPath& object_path, | 466 void ObjectAdded(const dbus::ObjectPath& object_path, |
| 467 const std::string& interface_name) override { | 467 const std::string& interface_name) override { |
| 468 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, | 468 for (auto& observer : observers_) |
| 469 DeviceAdded(object_path)); | 469 observer.DeviceAdded(object_path); |
| 470 } | 470 } |
| 471 | 471 |
| 472 // Called by dbus::ObjectManager when an object with the device interface | 472 // Called by dbus::ObjectManager when an object with the device interface |
| 473 // is removed. Informs observers. | 473 // is removed. Informs observers. |
| 474 void ObjectRemoved(const dbus::ObjectPath& object_path, | 474 void ObjectRemoved(const dbus::ObjectPath& object_path, |
| 475 const std::string& interface_name) override { | 475 const std::string& interface_name) override { |
| 476 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, | 476 for (auto& observer : observers_) |
| 477 DeviceRemoved(object_path)); | 477 observer.DeviceRemoved(object_path); |
| 478 } | 478 } |
| 479 | 479 |
| 480 // Called by BluetoothPropertySet when a property value is changed, | 480 // Called by BluetoothPropertySet when a property value is changed, |
| 481 // either by result of a signal or response to a GetAll() or Get() | 481 // either by result of a signal or response to a GetAll() or Get() |
| 482 // call. Informs observers. | 482 // call. Informs observers. |
| 483 void OnPropertyChanged(const dbus::ObjectPath& object_path, | 483 void OnPropertyChanged(const dbus::ObjectPath& object_path, |
| 484 const std::string& property_name) { | 484 const std::string& property_name) { |
| 485 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, | 485 for (auto& observer : observers_) |
| 486 DevicePropertyChanged(object_path, property_name)); | 486 observer.DevicePropertyChanged(object_path, property_name); |
| 487 } | 487 } |
| 488 | 488 |
| 489 // Called when a response for successful method call is received. | 489 // Called when a response for successful method call is received. |
| 490 void OnSuccess(const base::Closure& callback, dbus::Response* response) { | 490 void OnSuccess(const base::Closure& callback, dbus::Response* response) { |
| 491 DCHECK(response); | 491 DCHECK(response); |
| 492 callback.Run(); | 492 callback.Run(); |
| 493 } | 493 } |
| 494 | 494 |
| 495 // Called when a response for the GetConnInfo method is received. | 495 // Called when a response for the GetConnInfo method is received. |
| 496 void OnGetConnInfoSuccess(const ConnInfoCallback& callback, | 496 void OnGetConnInfoSuccess(const ConnInfoCallback& callback, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 | 563 |
| 564 BluetoothDeviceClient::BluetoothDeviceClient() {} | 564 BluetoothDeviceClient::BluetoothDeviceClient() {} |
| 565 | 565 |
| 566 BluetoothDeviceClient::~BluetoothDeviceClient() {} | 566 BluetoothDeviceClient::~BluetoothDeviceClient() {} |
| 567 | 567 |
| 568 BluetoothDeviceClient* BluetoothDeviceClient::Create() { | 568 BluetoothDeviceClient* BluetoothDeviceClient::Create() { |
| 569 return new BluetoothDeviceClientImpl(); | 569 return new BluetoothDeviceClientImpl(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 } // namespace bluez | 572 } // namespace bluez |
| OLD | NEW |