OLD | NEW |
(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 #ifndef COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 6 #define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/values.h" |
| 11 |
| 12 // Helper class for accessing Physical Web metadata and controlling the scanner. |
| 13 class PhysicalWebDataSource { |
| 14 public: |
| 15 PhysicalWebDataSource(); |
| 16 virtual ~PhysicalWebDataSource(); |
| 17 |
| 18 // Returns the global instance of the PhysicalWebDataSource singleton. This |
| 19 // does not create the singleton and will return NULL if an instance has not |
| 20 // yet been set with SetInstance. |
| 21 static PhysicalWebDataSource* GetInstance(); |
| 22 |
| 23 // Sets the global instance of the PhysicalWebDataSource singleton. |
| 24 static void SetInstance(PhysicalWebDataSource* instance); |
| 25 |
| 26 // Starts scanning for Physical Web URLs. If |network_request_enabled| is |
| 27 // true, discovered URLs will be sent to a resolution service. |
| 28 virtual void StartDiscovery(bool network_request_enabled) = 0; |
| 29 |
| 30 // Stops scanning for Physical Web URLs and clears cached URL content. |
| 31 virtual void StopDiscovery() = 0; |
| 32 |
| 33 // Returns a list of resolved URLs and associated page metadata. If network |
| 34 // requests are disabled, the list will be empty. |
| 35 virtual std::unique_ptr<base::ListValue> GetMetadata() = 0; |
| 36 |
| 37 // Returns boolean |true| if network requests are disabled and there are one |
| 38 // or more discovered URLs that have not been sent to the resolution service. |
| 39 virtual bool HasUnresolvedDiscoveries() = 0; |
| 40 }; |
| 41 |
| 42 #endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
OLD | NEW |