Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: device/bluetooth/dbus/bluetooth_adapter_client.cc

Issue 2423793002: Remove usage of FOR_EACH_OBSERVER macro in device/ (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_adapter_client.h" 5 #include "device/bluetooth/dbus/bluetooth_adapter_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 bluetooth_object_manager::kBluetoothObjectManagerServicePath)); 419 bluetooth_object_manager::kBluetoothObjectManagerServicePath));
420 object_manager_->RegisterInterface( 420 object_manager_->RegisterInterface(
421 bluetooth_adapter::kBluetoothAdapterInterface, this); 421 bluetooth_adapter::kBluetoothAdapterInterface, this);
422 } 422 }
423 423
424 private: 424 private:
425 // Called by dbus::ObjectManager when an object with the adapter interface 425 // Called by dbus::ObjectManager when an object with the adapter interface
426 // is created. Informs observers. 426 // is created. Informs observers.
427 void ObjectAdded(const dbus::ObjectPath& object_path, 427 void ObjectAdded(const dbus::ObjectPath& object_path,
428 const std::string& interface_name) override { 428 const std::string& interface_name) override {
429 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, 429 for (auto& observer : observers_)
430 AdapterAdded(object_path)); 430 observer.AdapterAdded(object_path);
431 } 431 }
432 432
433 // Called by dbus::ObjectManager when an object with the adapter interface 433 // Called by dbus::ObjectManager when an object with the adapter interface
434 // is removed. Informs observers. 434 // is removed. Informs observers.
435 void ObjectRemoved(const dbus::ObjectPath& object_path, 435 void ObjectRemoved(const dbus::ObjectPath& object_path,
436 const std::string& interface_name) override { 436 const std::string& interface_name) override {
437 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, 437 for (auto& observer : observers_)
438 AdapterRemoved(object_path)); 438 observer.AdapterRemoved(object_path);
439 } 439 }
440 440
441 // Called by dbus::PropertySet when a property value is changed, 441 // Called by dbus::PropertySet when a property value is changed,
442 // either by result of a signal or response to a GetAll() or Get() 442 // either by result of a signal or response to a GetAll() or Get()
443 // call. Informs observers. 443 // call. Informs observers.
444 void OnPropertyChanged(const dbus::ObjectPath& object_path, 444 void OnPropertyChanged(const dbus::ObjectPath& object_path,
445 const std::string& property_name) { 445 const std::string& property_name) {
446 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, 446 for (auto& observer : observers_)
447 AdapterPropertyChanged(object_path, property_name)); 447 observer.AdapterPropertyChanged(object_path, property_name);
448 } 448 }
449 449
450 // Called when a response for successful method call is received. 450 // Called when a response for successful method call is received.
451 void OnCreateServiceRecord(const ServiceRecordCallback& callback, 451 void OnCreateServiceRecord(const ServiceRecordCallback& callback,
452 dbus::Response* response) { 452 dbus::Response* response) {
453 DCHECK(response); 453 DCHECK(response);
454 dbus::MessageReader reader(response); 454 dbus::MessageReader reader(response);
455 uint32_t handle = 0; 455 uint32_t handle = 0;
456 if (!reader.PopUint32(&handle)) 456 if (!reader.PopUint32(&handle))
457 LOG(ERROR) << "Invalid response from CreateServiceRecord."; 457 LOG(ERROR) << "Invalid response from CreateServiceRecord.";
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 BluetoothAdapterClient::BluetoothAdapterClient() {} 498 BluetoothAdapterClient::BluetoothAdapterClient() {}
499 499
500 BluetoothAdapterClient::~BluetoothAdapterClient() {} 500 BluetoothAdapterClient::~BluetoothAdapterClient() {}
501 501
502 BluetoothAdapterClient* BluetoothAdapterClient::Create() { 502 BluetoothAdapterClient* BluetoothAdapterClient::Create() {
503 return new BluetoothAdapterClientImpl; 503 return new BluetoothAdapterClientImpl;
504 } 504 }
505 505
506 } // namespace bluez 506 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_advertisement_bluez.cc ('k') | device/bluetooth/dbus/bluetooth_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698