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

Side by Side Diff: ios/chrome/common/physical_web/ios_chrome_physical_web_data_source.mm

Issue 2248983003: Avoid failing assert when Physical Web scanner is inactive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/physical_web/ios_chrome_physical_web_data_source.h"
6 6
7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
9 #include "base/values.h" 8 #include "base/values.h"
10 #import "ios/chrome/common/physical_web/physical_web_scanner.h" 9 #import "ios/chrome/common/physical_web/physical_web_scanner.h"
11 10
12 IOSChromePhysicalWebDataSource::IOSChromePhysicalWebDataSource() {} 11 IOSChromePhysicalWebDataSource::IOSChromePhysicalWebDataSource() {}
13 12
14 IOSChromePhysicalWebDataSource::~IOSChromePhysicalWebDataSource() { 13 IOSChromePhysicalWebDataSource::~IOSChromePhysicalWebDataSource() {
15 StopDiscovery(); 14 StopDiscovery();
16 } 15 }
17 16
(...skipping 12 matching lines...) Expand all
30 [scanner_ setNetworkRequestEnabled:network_request_enabled]; 29 [scanner_ setNetworkRequestEnabled:network_request_enabled];
31 [scanner_ start]; 30 [scanner_ start];
32 } 31 }
33 32
34 void IOSChromePhysicalWebDataSource::StopDiscovery() { 33 void IOSChromePhysicalWebDataSource::StopDiscovery() {
35 [scanner_ stop]; 34 [scanner_ stop];
36 scanner_.reset(); 35 scanner_.reset();
37 } 36 }
38 37
39 std::unique_ptr<base::ListValue> IOSChromePhysicalWebDataSource::GetMetadata() { 38 std::unique_ptr<base::ListValue> IOSChromePhysicalWebDataSource::GetMetadata() {
40 std::unique_ptr<base::ListValue> metadata = [scanner_ metadata]; 39 if (!scanner_) {
41 DCHECK(metadata); 40 return base::MakeUnique<base::ListValue>();
42 return metadata; 41 }
42 return [scanner_ metadata];
43 } 43 }
44 44
45 bool IOSChromePhysicalWebDataSource::HasUnresolvedDiscoveries() { 45 bool IOSChromePhysicalWebDataSource::HasUnresolvedDiscoveries() {
46 return [scanner_ unresolvedBeaconsCount] > 0; 46 return [scanner_ unresolvedBeaconsCount] > 0;
47 } 47 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698