| 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 #import "ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.h" | 5 #import "ios/chrome/browser/physical_web/ios_chrome_physical_web_data_source.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #import "ios/chrome/browser/physical_web/physical_web_initial_state_recorder.h" |
| 9 #import "ios/chrome/common/physical_web/physical_web_scanner.h" | 10 #import "ios/chrome/common/physical_web/physical_web_scanner.h" |
| 10 | 11 |
| 11 IOSChromePhysicalWebDataSource::IOSChromePhysicalWebDataSource() {} | 12 IOSChromePhysicalWebDataSource::IOSChromePhysicalWebDataSource() {} |
| 12 | 13 |
| 13 IOSChromePhysicalWebDataSource::~IOSChromePhysicalWebDataSource() { | 14 IOSChromePhysicalWebDataSource::~IOSChromePhysicalWebDataSource() { |
| 14 StopDiscovery(); | 15 StopDiscovery(); |
| 15 } | 16 } |
| 16 | 17 |
| 17 void IOSChromePhysicalWebDataSource::StartDiscovery( | 18 void IOSChromePhysicalWebDataSource::StartDiscovery( |
| 18 bool network_request_enabled) { | 19 bool network_request_enabled) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 41 std::unique_ptr<base::ListValue> IOSChromePhysicalWebDataSource::GetMetadata() { | 42 std::unique_ptr<base::ListValue> IOSChromePhysicalWebDataSource::GetMetadata() { |
| 42 if (!scanner_) { | 43 if (!scanner_) { |
| 43 return base::MakeUnique<base::ListValue>(); | 44 return base::MakeUnique<base::ListValue>(); |
| 44 } | 45 } |
| 45 return [scanner_ metadata]; | 46 return [scanner_ metadata]; |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool IOSChromePhysicalWebDataSource::HasUnresolvedDiscoveries() { | 49 bool IOSChromePhysicalWebDataSource::HasUnresolvedDiscoveries() { |
| 49 return [scanner_ unresolvedBeaconsCount] > 0; | 50 return [scanner_ unresolvedBeaconsCount] > 0; |
| 50 } | 51 } |
| 52 |
| 53 void IOSChromePhysicalWebDataSource::RecordInitialState( |
| 54 PrefService* pref_service) { |
| 55 initialStateRecorder_.reset([[PhysicalWebInitialStateRecorder alloc] |
| 56 initWithPrefService:pref_service]); |
| 57 [initialStateRecorder_ collectAndRecordState]; |
| 58 } |
| OLD | NEW |