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

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

Issue 2507213003: Stop providing Physical Web metadata after Bluetooth is disabled (Closed)
Patch Set: 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 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/physical_web_scanner.h" 5 #import "ios/chrome/common/physical_web/physical_web_scanner.h"
6 6
7 #import <CoreBluetooth/CoreBluetooth.h> 7 #import <CoreBluetooth/CoreBluetooth.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 [pendingRequests_ removeAllObjects]; 157 [pendingRequests_ removeAllObjects];
158 if (!pendingStart_ && [self bluetoothEnabled]) { 158 if (!pendingStart_ && [self bluetoothEnabled]) {
159 [self reallyStop]; 159 [self reallyStop];
160 } 160 }
161 pendingStart_ = NO; 161 pendingStart_ = NO;
162 started_ = NO; 162 started_ = NO;
163 } 163 }
164 164
165 - (NSArray*)devices { 165 - (NSArray*)devices {
166 if (![self bluetoothEnabled]) {
167 return [NSArray array];
168 }
166 return [devices_ sortedArrayUsingComparator:^(id obj1, id obj2) { 169 return [devices_ sortedArrayUsingComparator:^(id obj1, id obj2) {
Olivier 2016/11/17 09:04:36 Should we clear devices_ ?
mattreynolds 2016/11/18 00:03:25 When onLostDetectionEnabled_==NO, I think we shoul
167 PhysicalWebDevice* device1 = obj1; 170 PhysicalWebDevice* device1 = obj1;
168 PhysicalWebDevice* device2 = obj2; 171 PhysicalWebDevice* device2 = obj2;
169 // Sorts in ascending order. 172 // Sorts in ascending order.
170 if ([device1 rank] > [device2 rank]) { 173 if ([device1 rank] > [device2 rank]) {
171 return NSOrderedDescending; 174 return NSOrderedDescending;
172 } 175 }
173 if ([device1 rank] < [device2 rank]) { 176 if ([device1 rank] < [device2 rank]) {
174 return NSOrderedAscending; 177 return NSOrderedAscending;
175 } 178 }
176 return NSOrderedSame; 179 return NSOrderedSame;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 [strongSelf.get()->devices_ addObject:device]; 487 [strongSelf.get()->devices_ addObject:device];
485 [strongSelf.get()->delegate_ scannerUpdatedDevices:weakSelf]; 488 [strongSelf.get()->delegate_ scannerUpdatedDevices:weakSelf];
486 [strongSelf.get()->finalUrls_ addObject:[device url]]; 489 [strongSelf.get()->finalUrls_ addObject:[device url]];
487 } 490 }
488 } 491 }
489 [strongSelf.get()->pendingRequests_ removeObject:strongRequest]; 492 [strongSelf.get()->pendingRequests_ removeObject:strongRequest];
490 }]; 493 }];
491 } 494 }
492 495
493 @end 496 @end
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