| 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 #ifndef COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_IMPL_H_ | 4 #ifndef COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_IMPL_H_ |
| 5 #define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_IMPL_H_ | 5 #define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_IMPL_H_ |
| 6 | 6 |
| 7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
| 8 #include "components/physical_web/data_source/physical_web_data_source.h" | 8 #include "components/physical_web/data_source/physical_web_data_source.h" |
| 9 | 9 |
| 10 class GURL; | 10 class GURL; |
| 11 | 11 |
| 12 namespace physical_web { | 12 namespace physical_web { |
| 13 | 13 |
| 14 class PhysicalWebListener; | 14 class PhysicalWebListener; |
| 15 | 15 |
| 16 class PhysicalWebDataSourceImpl : public PhysicalWebDataSource { | 16 class PhysicalWebDataSourceImpl : public PhysicalWebDataSource { |
| 17 public: | 17 public: |
| 18 PhysicalWebDataSourceImpl(); | 18 PhysicalWebDataSourceImpl(); |
| 19 ~PhysicalWebDataSourceImpl() override; | 19 ~PhysicalWebDataSourceImpl() override; |
| 20 | 20 |
| 21 // Register for changes to Physical Web URLs and associated page metadata. | 21 // Register for changes to Physical Web URLs and associated page metadata. |
| 22 void RegisterListener(PhysicalWebListener* physical_web_listener) override; | 22 void RegisterListener(PhysicalWebListener* physical_web_listener, |
| 23 ScanMode scan_mode) override; |
| 23 | 24 |
| 24 // Unregister for changes to Physical Web URLs and associated page metadata. | 25 // Unregister for changes to Physical Web URLs and associated page metadata. |
| 25 void UnregisterListener(PhysicalWebListener* physical_web_listener) override; | 26 void UnregisterListener(PhysicalWebListener* physical_web_listener) override; |
| 26 | 27 |
| 27 // Notify all registered listeners that a URL has been found. | 28 // Notify all registered listeners that a URL has been found. |
| 28 void NotifyOnFound(const GURL& url); | 29 void NotifyOnFound(const GURL& url); |
| 29 | 30 |
| 30 // Notify all registered listeners that a URL has been lost. | 31 // Notify all registered listeners that a URL has been lost. |
| 31 void NotifyOnLost(const GURL& url); | 32 void NotifyOnLost(const GURL& url); |
| 32 | 33 |
| 33 // Notify all registered listeners that a distance has changed for a URL. | 34 // Notify all registered listeners that a distance has changed for a URL. |
| 34 void NotifyOnDistanceChanged(const GURL& url, | 35 void NotifyOnDistanceChanged(const GURL& url, double distance_estimate); |
| 35 double distance_estimate); | |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 base::ObserverList<PhysicalWebListener> observer_list_; | 38 base::ObserverList<PhysicalWebListener> observer_list_; |
| 39 std::unordered_map<PhysicalWebListener*, ScanMode> scan_modes_; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 } // namespace physical_web | 42 } // namespace physical_web |
| 42 | 43 |
| 43 #endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_IMPL_H_ | 44 #endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_IMPL_H_ |
| OLD | NEW |