Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.mm

Issue 2458613004: Record the initial state of the Physical Web at startup (Closed)
Patch Set: changes for olivierrobin@, rohitrao@, sdefresne@ Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.mm
diff --git a/ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.mm b/ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.mm
deleted file mode 100644
index 12edafa0a6d3178384cd40a280c991762cbeffec..0000000000000000000000000000000000000000
--- a/ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.mm
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-#import "ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.h"
-
-#include "base/memory/ptr_util.h"
-#include "base/values.h"
-#import "ios/chrome/common/physical_web/physical_web_scanner.h"
-
-IOSChromePhysicalWebDataSource::IOSChromePhysicalWebDataSource() {}
-
-IOSChromePhysicalWebDataSource::~IOSChromePhysicalWebDataSource() {
- StopDiscovery();
-}
-
-void IOSChromePhysicalWebDataSource::StartDiscovery(
- bool network_request_enabled) {
- // If there are unresolved beacons it means the scanner is started but does
- // not have network requests enabled. In this case we should avoid recreating
- // the scanner as it would clear the cache of nearby beacons.
- if (network_request_enabled && HasUnresolvedDiscoveries()) {
- [scanner_ setNetworkRequestEnabled:YES];
- return;
- }
-
- [scanner_ stop];
- scanner_.reset([[PhysicalWebScanner alloc] initWithDelegate:nil]);
-
- // Configure the scanner to notify us when a URL is no longer nearby.
- [scanner_ setOnLostDetectionEnabled:YES];
- [scanner_ setNetworkRequestEnabled:network_request_enabled];
- [scanner_ start];
-}
-
-void IOSChromePhysicalWebDataSource::StopDiscovery() {
- [scanner_ stop];
- scanner_.reset();
-}
-
-std::unique_ptr<base::ListValue> IOSChromePhysicalWebDataSource::GetMetadata() {
- if (!scanner_) {
- return base::MakeUnique<base::ListValue>();
- }
- return [scanner_ metadata];
-}
-
-bool IOSChromePhysicalWebDataSource::HasUnresolvedDiscoveries() {
- return [scanner_ unresolvedBeaconsCount] > 0;
-}

Powered by Google App Engine
This is Rietveld 408576698