| 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 IOS_CHROME_BROWSER_PHYSICAL_WEB_IOS_CHROME_PHYSICAL_WEB_DATA_SOURCE_H_ | 5 #ifndef IOS_CHROME_BROWSER_PHYSICAL_WEB_IOS_CHROME_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 6 #define IOS_CHROME_BROWSER_PHYSICAL_WEB_IOS_CHROME_PHYSICAL_WEB_DATA_SOURCE_H_ | 6 #define IOS_CHROME_BROWSER_PHYSICAL_WEB_IOS_CHROME_PHYSICAL_WEB_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "components/physical_web/data_source/physical_web_data_source_impl.h" | 10 #include "components/physical_web/data_source/physical_web_data_source_impl.h" |
| 11 | 11 |
| 12 namespace base { | |
| 13 class ListValue; | |
| 14 } | |
| 15 class PrefService; | 12 class PrefService; |
| 16 | 13 |
| 17 @class PhysicalWebScanner; | 14 @class PhysicalWebScanner; |
| 18 @class PhysicalWebInitialStateRecorder; | 15 @class PhysicalWebInitialStateRecorder; |
| 19 | 16 |
| 20 // iOS implementation of PhysicalWebDataSource | 17 // iOS implementation of PhysicalWebDataSource |
| 21 class IOSChromePhysicalWebDataSource | 18 class IOSChromePhysicalWebDataSource |
| 22 : public physical_web::PhysicalWebDataSourceImpl { | 19 : public physical_web::PhysicalWebDataSourceImpl { |
| 23 public: | 20 public: |
| 24 IOSChromePhysicalWebDataSource(PrefService* pref_service); | 21 IOSChromePhysicalWebDataSource(PrefService* pref_service); |
| 25 ~IOSChromePhysicalWebDataSource() override; | 22 ~IOSChromePhysicalWebDataSource() override; |
| 26 | 23 |
| 27 // Starts scanning for Physical Web URLs. If |network_request_enabled| is | 24 // Starts scanning for Physical Web URLs. If |network_request_enabled| is |
| 28 // true, discovered URLs will be sent to a resolution service. | 25 // true, discovered URLs will be sent to a resolution service. |
| 29 void StartDiscovery(bool network_request_enabled) override; | 26 void StartDiscovery(bool network_request_enabled) override; |
| 30 | 27 |
| 31 // Stops scanning for Physical Web URLs and clears cached URL content. | 28 // Stops scanning for Physical Web URLs and clears cached URL content. |
| 32 void StopDiscovery() override; | 29 void StopDiscovery() override; |
| 33 | 30 |
| 34 // Returns a list of resolved URLs and associated page metadata. If network | 31 // Returns a list of resolved URLs and associated page metadata. If network |
| 35 // requests are disabled, the list will be empty. | 32 // requests are disabled, the list will be empty. |
| 36 std::unique_ptr<base::ListValue> GetMetadata() override; | |
| 37 | |
| 38 // Returns a list of resolved URLs and associated page metadata. If network | |
| 39 // requests are disabled, the list will be empty. | |
| 40 std::unique_ptr<physical_web::MetadataList> GetMetadataList() override; | 33 std::unique_ptr<physical_web::MetadataList> GetMetadataList() override; |
| 41 | 34 |
| 42 // Returns boolean |true| if network requests are disabled and there are one | 35 // Returns boolean |true| if network requests are disabled and there are one |
| 43 // or more discovered URLs that have not been sent to the resolution service. | 36 // or more discovered URLs that have not been sent to the resolution service. |
| 44 bool HasUnresolvedDiscoveries() override; | 37 bool HasUnresolvedDiscoveries() override; |
| 45 | 38 |
| 46 private: | 39 private: |
| 47 // Scanner for nearby Physical Web URL devices. | 40 // Scanner for nearby Physical Web URL devices. |
| 48 base::scoped_nsobject<PhysicalWebScanner> scanner_; | 41 base::scoped_nsobject<PhysicalWebScanner> scanner_; |
| 49 | 42 |
| 50 // Utility for fetching initial application state for logging purposes. | 43 // Utility for fetching initial application state for logging purposes. |
| 51 base::scoped_nsobject<PhysicalWebInitialStateRecorder> initialStateRecorder_; | 44 base::scoped_nsobject<PhysicalWebInitialStateRecorder> initialStateRecorder_; |
| 52 | 45 |
| 53 DISALLOW_COPY_AND_ASSIGN(IOSChromePhysicalWebDataSource); | 46 DISALLOW_COPY_AND_ASSIGN(IOSChromePhysicalWebDataSource); |
| 54 }; | 47 }; |
| 55 | 48 |
| 56 #endif // IOS_CHROME_BROWSER_PHYSICAL_WEB_IOS_CHROME_PHYSICAL_WEB_DATA_SOURCE_H
_ | 49 #endif // IOS_CHROME_BROWSER_PHYSICAL_WEB_IOS_CHROME_PHYSICAL_WEB_DATA_SOURCE_H
_ |
| OLD | NEW |