| 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/browser/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 #import "ios/chrome/browser/physical_web/physical_web_initial_state_recorder.h" | 8 #import "ios/chrome/browser/physical_web/physical_web_initial_state_recorder.h" |
| 9 #import "ios/chrome/common/physical_web/physical_web_scanner.h" | 9 #import "ios/chrome/common/physical_web/physical_web_scanner.h" |
| 10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 11 IOSChromePhysicalWebDataSource::IOSChromePhysicalWebDataSource( | 15 IOSChromePhysicalWebDataSource::IOSChromePhysicalWebDataSource( |
| 12 PrefService* pref_service) { | 16 PrefService* pref_service) { |
| 13 initialStateRecorder_.reset([[PhysicalWebInitialStateRecorder alloc] | 17 initialStateRecorder_.reset([[PhysicalWebInitialStateRecorder alloc] |
| 14 initWithPrefService:pref_service]); | 18 initWithPrefService:pref_service]); |
| 15 [initialStateRecorder_ collectAndRecordState]; | 19 [initialStateRecorder_ collectAndRecordState]; |
| 16 } | 20 } |
| 17 | 21 |
| 18 IOSChromePhysicalWebDataSource::~IOSChromePhysicalWebDataSource() { | 22 IOSChromePhysicalWebDataSource::~IOSChromePhysicalWebDataSource() { |
| 19 [initialStateRecorder_ invalidate]; | 23 [initialStateRecorder_ invalidate]; |
| 20 StopDiscovery(); | 24 StopDiscovery(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 48 IOSChromePhysicalWebDataSource::GetMetadataList() { | 52 IOSChromePhysicalWebDataSource::GetMetadataList() { |
| 49 if (!scanner_) { | 53 if (!scanner_) { |
| 50 return base::MakeUnique<physical_web::MetadataList>(); | 54 return base::MakeUnique<physical_web::MetadataList>(); |
| 51 } | 55 } |
| 52 return [scanner_ metadataList]; | 56 return [scanner_ metadataList]; |
| 53 } | 57 } |
| 54 | 58 |
| 55 bool IOSChromePhysicalWebDataSource::HasUnresolvedDiscoveries() { | 59 bool IOSChromePhysicalWebDataSource::HasUnresolvedDiscoveries() { |
| 56 return [scanner_ unresolvedBeaconsCount] > 0; | 60 return [scanner_ unresolvedBeaconsCount] > 0; |
| 57 } | 61 } |
| OLD | NEW |