| OLD | NEW |
| 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 "components/physical_web/data_source/fake_physical_web_data_source.h" | 5 #include "components/physical_web/data_source/fake_physical_web_data_source.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "components/physical_web/data_source/physical_web_listener.h" | 9 #include "components/physical_web/data_source/physical_web_listener.h" |
| 10 #include "url/gurl.h" |
| 10 | 11 |
| 11 using base::ListValue; | 12 using base::ListValue; |
| 12 using base::DictionaryValue; | 13 using base::DictionaryValue; |
| 13 | 14 |
| 14 namespace physical_web { | 15 namespace physical_web { |
| 15 | 16 |
| 16 std::unique_ptr<DictionaryValue> CreatePhysicalWebPage( | 17 std::unique_ptr<DictionaryValue> CreatePhysicalWebPage( |
| 17 const std::string& resolved_url, | 18 const std::string& resolved_url, |
| 18 double distance_estimate, | 19 double distance_estimate, |
| 19 int scan_timestamp, | 20 int scan_timestamp, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void FakePhysicalWebDataSource::UnregisterListener( | 85 void FakePhysicalWebDataSource::UnregisterListener( |
| 85 PhysicalWebListener* physical_web_listener) { | 86 PhysicalWebListener* physical_web_listener) { |
| 86 observer_list_.RemoveObserver(physical_web_listener); | 87 observer_list_.RemoveObserver(physical_web_listener); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void FakePhysicalWebDataSource::SetMetadata( | 90 void FakePhysicalWebDataSource::SetMetadata( |
| 90 std::unique_ptr<ListValue> metadata) { | 91 std::unique_ptr<ListValue> metadata) { |
| 91 metadata_ = std::move(metadata); | 92 metadata_ = std::move(metadata); |
| 92 } | 93 } |
| 93 | 94 |
| 94 void FakePhysicalWebDataSource::NotifyOnFound(const std::string& url) { | 95 void FakePhysicalWebDataSource::NotifyOnFound(const GURL& url) { |
| 95 for (PhysicalWebListener& observer : observer_list_) | 96 for (PhysicalWebListener& observer : observer_list_) |
| 96 observer.OnFound(url); | 97 observer.OnFound(url); |
| 97 } | 98 } |
| 98 | 99 |
| 99 void FakePhysicalWebDataSource::NotifyOnLost(const std::string& url) { | 100 void FakePhysicalWebDataSource::NotifyOnLost(const GURL& url) { |
| 100 for (PhysicalWebListener& observer : observer_list_) | 101 for (PhysicalWebListener& observer : observer_list_) |
| 101 observer.OnLost(url); | 102 observer.OnLost(url); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void FakePhysicalWebDataSource::NotifyOnDistanceChanged( | 105 void FakePhysicalWebDataSource::NotifyOnDistanceChanged( |
| 105 const std::string& url, | 106 const GURL& url, |
| 106 double distance_estimate) { | 107 double distance_estimate) { |
| 107 for (PhysicalWebListener& observer : observer_list_) | 108 for (PhysicalWebListener& observer : observer_list_) |
| 108 observer.OnDistanceChanged(url, distance_estimate); | 109 observer.OnDistanceChanged(url, distance_estimate); |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace physical_web | 112 } // namespace physical_web |
| OLD | NEW |