| 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_PHYSICAL_WEB_DATA_SOURCE_H_ | 5 #ifndef COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 6 #define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ | 6 #define COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace physical_web { | 15 namespace physical_web { |
| 16 | 16 |
| 17 class PhysicalWebListener; | 17 class PhysicalWebListener; |
| 18 | 18 |
| 19 // Enum describing scan policies. |
| 20 enum ScanMode { |
| 21 // Request no particular scan policy. Opportunistic listeners will receive |
| 22 // notifications when any other listener requests a scan. |
| 23 OPPORTUNISTIC = 0, |
| 24 // Request a scan that runs occassionally, even when Chrome is not in the |
| 25 // foreground. Android only. |
| 26 BACKGROUND_INTERMITTENT = 1 << 0, |
| 27 }; |
| 28 |
| 19 // Metadata struct for associating data with Physical Web URLs. | 29 // Metadata struct for associating data with Physical Web URLs. |
| 20 struct Metadata { | 30 struct Metadata { |
| 21 Metadata(); | 31 Metadata(); |
| 22 Metadata(const Metadata& other); | 32 Metadata(const Metadata& other); |
| 23 ~Metadata(); | 33 ~Metadata(); |
| 24 // The URL broadcasted by the beacon and scanned by the client device. | 34 // The URL broadcasted by the beacon and scanned by the client device. |
| 25 // REQUIRED | 35 // REQUIRED |
| 26 GURL scanned_url; | 36 GURL scanned_url; |
| 27 // The URL that the scanned_url redirects to. | 37 // The URL that the scanned_url redirects to. |
| 28 // This is the URL that users should be directed to. | 38 // This is the URL that users should be directed to. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual std::unique_ptr<MetadataList> GetMetadataList() = 0; | 92 virtual std::unique_ptr<MetadataList> GetMetadataList() = 0; |
| 83 | 93 |
| 84 // Returns boolean |true| if network requests are disabled and there are one | 94 // Returns boolean |true| if network requests are disabled and there are one |
| 85 // or more discovered URLs that have not been sent to the resolution service. | 95 // or more discovered URLs that have not been sent to the resolution service. |
| 86 // The method can be called at any time to check for unresolved discoveries. | 96 // The method can be called at any time to check for unresolved discoveries. |
| 87 // If discovery is inactive or network requests are enabled, it will always | 97 // If discovery is inactive or network requests are enabled, it will always |
| 88 // return false. | 98 // return false. |
| 89 virtual bool HasUnresolvedDiscoveries() = 0; | 99 virtual bool HasUnresolvedDiscoveries() = 0; |
| 90 | 100 |
| 91 // Register for changes to Physical Web URLs and associated page metadata. | 101 // Register for changes to Physical Web URLs and associated page metadata. |
| 92 virtual void RegisterListener(PhysicalWebListener* physical_web_listener) = 0; | 102 // This may be called multiple times in order to change the associated scan |
| 103 // mode. |
| 104 virtual void RegisterListener(PhysicalWebListener* physical_web_listener, |
| 105 ScanMode scan_mode) = 0; |
| 93 | 106 |
| 94 // Unregister for changes to Physical Web URLs and associated page metadata. | 107 // Unregister for changes to Physical Web URLs and associated page metadata. |
| 95 virtual void UnregisterListener( | 108 virtual void UnregisterListener( |
| 96 PhysicalWebListener* physical_web_listener) = 0; | 109 PhysicalWebListener* physical_web_listener) = 0; |
| 97 }; | 110 }; |
| 98 | 111 |
| 99 } // namespace physical_web | 112 } // namespace physical_web |
| 100 | 113 |
| 101 #endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ | 114 #endif // COMPONENTS_PHYSICAL_WEB_DATA_SOURCE_PHYSICAL_WEB_DATA_SOURCE_H_ |
| OLD | NEW |