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

Side by Side Diff: components/physical_web/data_source/physical_web_data_source_impl.cc

Issue 2444753002: Reduce usage of FOR_EACH_OBSERVER macro in components/ (Closed)
Patch Set: Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/observer_list.h" 5 #include "base/observer_list.h"
6 #include "components/physical_web/data_source/physical_web_data_source.h" 6 #include "components/physical_web/data_source/physical_web_data_source.h"
7 #include "components/physical_web/data_source/physical_web_data_source_impl.h" 7 #include "components/physical_web/data_source/physical_web_data_source_impl.h"
8 #include "components/physical_web/data_source/physical_web_listener.h" 8 #include "components/physical_web/data_source/physical_web_listener.h"
9 9
10 PhysicalWebDataSourceImpl::PhysicalWebDataSourceImpl() {} 10 PhysicalWebDataSourceImpl::PhysicalWebDataSourceImpl() {}
11 11
12 PhysicalWebDataSourceImpl::~PhysicalWebDataSourceImpl() {} 12 PhysicalWebDataSourceImpl::~PhysicalWebDataSourceImpl() {}
13 13
14 void PhysicalWebDataSourceImpl::RegisterListener( 14 void PhysicalWebDataSourceImpl::RegisterListener(
15 PhysicalWebListener* physical_web_listener) { 15 PhysicalWebListener* physical_web_listener) {
16 observer_list_.AddObserver(physical_web_listener); 16 observer_list_.AddObserver(physical_web_listener);
17 } 17 }
18 18
19 void PhysicalWebDataSourceImpl::UnregisterListener( 19 void PhysicalWebDataSourceImpl::UnregisterListener(
20 PhysicalWebListener* physical_web_listener) { 20 PhysicalWebListener* physical_web_listener) {
21 observer_list_.RemoveObserver(physical_web_listener); 21 observer_list_.RemoveObserver(physical_web_listener);
22 } 22 }
23 23
24 void PhysicalWebDataSourceImpl::NotifyOnFound(const std::string& url) { 24 void PhysicalWebDataSourceImpl::NotifyOnFound(const std::string& url) {
25 FOR_EACH_OBSERVER(PhysicalWebListener, observer_list_, OnFound(url)); 25 for (PhysicalWebListener& observer : observer_list_)
26 observer.OnFound(url);
26 } 27 }
27 28
28 void PhysicalWebDataSourceImpl::NotifyOnLost(const std::string& url) { 29 void PhysicalWebDataSourceImpl::NotifyOnLost(const std::string& url) {
29 FOR_EACH_OBSERVER(PhysicalWebListener, observer_list_, OnLost(url)); 30 for (PhysicalWebListener& observer : observer_list_)
31 observer.OnLost(url);
30 } 32 }
31 33
32 void PhysicalWebDataSourceImpl::NotifyOnDistanceChanged( 34 void PhysicalWebDataSourceImpl::NotifyOnDistanceChanged(
33 const std::string& url, 35 const std::string& url,
34 double distance_estimate) { 36 double distance_estimate) {
35 FOR_EACH_OBSERVER(PhysicalWebListener, observer_list_, 37 for (PhysicalWebListener& observer : observer_list_)
36 OnDistanceChanged(url, distance_estimate)); 38 observer.OnDistanceChanged(url, distance_estimate);
37 } 39 }
OLDNEW
« no previous file with comments | « components/pairing/fake_host_pairing_controller.cc ('k') | components/prefs/default_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698