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

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

Issue 2349483002: Implement Physical Web listener registration (Closed)
Patch Set: Add unit tests Created 4 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/observer_list.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"
8 #include "components/physical_web/data_source/physical_web_listener.h"
9
10 PhysicalWebDataSourceImpl::PhysicalWebDataSourceImpl() {
11 // observer_list_* = new ObserverList<PhysicalWebListener>();
cco3 2016/09/20 22:11:33 Is this intentional?
hayesjordan 2016/09/20 22:21:47 No, I forgot to delete it.
12 }
13
14 PhysicalWebDataSourceImpl::~PhysicalWebDataSourceImpl() {
15 // delete &observer_list_;
16 }
17
18 void PhysicalWebDataSourceImpl::RegisterListener(
19 PhysicalWebListener* physical_web_listener) {
20 observer_list_.AddObserver(physical_web_listener);
21 }
22
23 void PhysicalWebDataSourceImpl::UnregisterListener(
24 PhysicalWebListener* physical_web_listener) {
25 observer_list_.RemoveObserver(physical_web_listener);
26 }
27
28 void PhysicalWebDataSourceImpl::NotifyOnFound(const std::string& url) {
29 FOR_EACH_OBSERVER(PhysicalWebListener, observer_list_, OnFound(url));
30 }
31
32 void PhysicalWebDataSourceImpl::NotifyOnLost(const std::string& url) {
33 FOR_EACH_OBSERVER(PhysicalWebListener, observer_list_, OnLost(url));
34 }
35
36 void PhysicalWebDataSourceImpl::NotifyOnDistanceChanged(
37 const std::string& url,
38 double distance_estimate) {
39 FOR_EACH_OBSERVER(PhysicalWebListener, observer_list_,
40 OnDistanceChanged(url, distance_estimate));
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698