Index: components/physical_web_data_source/physical_web_data_source.h |
diff --git a/components/physical_web_data_source/physical_web_data_source.h b/components/physical_web_data_source/physical_web_data_source.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3e03c876eb56e9f754fa0fba91a02626c9cdf709 |
--- /dev/null |
+++ b/components/physical_web_data_source/physical_web_data_source.h |
@@ -0,0 +1,42 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
+#define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
+ |
+#include <memory> |
+ |
+#include "base/values.h" |
+ |
+// Helper class for accessing Physical Web metadata and controlling the scanner. |
+class PhysicalWebDataSource { |
+ public: |
+ PhysicalWebDataSource(); |
+ virtual ~PhysicalWebDataSource(); |
+ |
+ // Returns the global instance of the PhysicalWebDataSource singleton. This |
+ // does not create the singleton and will return NULL if an instance has not |
+ // yet been set with SetInstance. |
+ static PhysicalWebDataSource* GetInstance(); |
+ |
+ // Sets the global instance of the PhysicalWebDataSource singleton. |
+ static void SetInstance(PhysicalWebDataSource* instance); |
+ |
+ // Starts scanning for Physical Web URLs. If |network_request_enabled| is |
+ // true, discovered URLs will be sent to a resolution service. |
+ virtual void StartDiscovery(bool network_request_enabled) = 0; |
+ |
+ // Stops scanning for Physical Web URLs and clears cached URL content. |
+ virtual void StopDiscovery() = 0; |
+ |
+ // Returns a list of resolved URLs and associated page metadata. If network |
+ // requests are disabled, the list will be empty. |
+ virtual std::unique_ptr<base::ListValue> GetMetadata() = 0; |
+ |
+ // Returns boolean |true| if network requests are disabled and there are one |
+ // or more discovered URLs that have not been sent to the resolution service. |
+ virtual bool HasUnresolvedDiscoveries() = 0; |
+}; |
+ |
+#endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |