| 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 #ifndef COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_FAKE_PHYSICAL_WEB_DATA_SOURCE_H_ | 5 #ifndef COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_FAKE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 6 #define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_FAKE_PHYSICAL_WEB_DATA_SOURCE_H_ | 6 #define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_FAKE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "components/physical_web/data_source/physical_web_data_source.h" | 12 #include "components/physical_web/data_source/physical_web_data_source.h" |
| 13 | 13 |
| 14 class GURL; |
| 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class DictionaryValue; | 17 class DictionaryValue; |
| 16 class ListValue; | 18 class ListValue; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace physical_web { | 21 namespace physical_web { |
| 20 | 22 |
| 21 std::unique_ptr<base::DictionaryValue> CreatePhysicalWebPage( | 23 std::unique_ptr<base::DictionaryValue> CreatePhysicalWebPage( |
| 22 const std::string& resolved_url, | 24 const std::string& resolved_url, |
| 23 double distance_estimate, | 25 double distance_estimate, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 | 44 |
| 43 std::unique_ptr<base::ListValue> GetMetadata() override; | 45 std::unique_ptr<base::ListValue> GetMetadata() override; |
| 44 | 46 |
| 45 bool HasUnresolvedDiscoveries() override; | 47 bool HasUnresolvedDiscoveries() override; |
| 46 | 48 |
| 47 void RegisterListener(PhysicalWebListener* physical_web_listener) override; | 49 void RegisterListener(PhysicalWebListener* physical_web_listener) override; |
| 48 void UnregisterListener(PhysicalWebListener* physical_web_listener) override; | 50 void UnregisterListener(PhysicalWebListener* physical_web_listener) override; |
| 49 | 51 |
| 50 // for testing | 52 // for testing |
| 51 void SetMetadata(std::unique_ptr<base::ListValue> metadata); | 53 void SetMetadata(std::unique_ptr<base::ListValue> metadata); |
| 52 void NotifyOnFound(const std::string& url); | 54 void NotifyOnFound(const GURL& url); |
| 53 void NotifyOnLost(const std::string& url); | 55 void NotifyOnLost(const GURL& url); |
| 54 void NotifyOnDistanceChanged(const std::string& url, | 56 void NotifyOnDistanceChanged(const GURL& url, double distance_estimate); |
| 55 double distance_estimate); | |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 std::unique_ptr<base::ListValue> metadata_; | 59 std::unique_ptr<base::ListValue> metadata_; |
| 59 base::ObserverList<PhysicalWebListener> observer_list_; | 60 base::ObserverList<PhysicalWebListener> observer_list_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(FakePhysicalWebDataSource); | 62 DISALLOW_COPY_AND_ASSIGN(FakePhysicalWebDataSource); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace physical_web | 65 } // namespace physical_web |
| 65 | 66 |
| 66 #endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_FAKE_PHYSICAL_WEB_DATA_SOURCE_H_ | 67 #endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_FAKE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| OLD | NEW |