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

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

Issue 2066493007: Updates PhysicalWebScanner to use the new CBManagerState enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/common/physical_web/physical_web_scanner.mm
diff --git a/ios/chrome/common/physical_web/physical_web_scanner.mm b/ios/chrome/common/physical_web/physical_web_scanner.mm
index 3b947a3f6e9498a54a9a66402e535862f2b02e34..2457f225a5cacc46102e6ce517f596118ddb774e 100644
--- a/ios/chrome/common/physical_web/physical_web_scanner.mm
+++ b/ios/chrome/common/physical_web/physical_web_scanner.mm
@@ -114,7 +114,7 @@ enum BeaconType {
[devicesUrls_ removeAllObjects];
[devices_ removeAllObjects];
started_ = YES;
- if ([centralManager_ state] == CBCentralManagerStatePoweredOn)
+ if ([self bluetoothEnabled])
[self reallyStart];
else
pendingStart_ = YES;
@@ -127,8 +127,7 @@ enum BeaconType {
[request cancel];
}
[pendingRequests_ removeAllObjects];
- if (!pendingStart_ &&
- [centralManager_ state] == CBCentralManagerStatePoweredOn) {
+ if (!pendingStart_ && [self bluetoothEnabled]) {
[centralManager_ stopScan];
}
pendingStart_ = NO;
@@ -170,7 +169,13 @@ enum BeaconType {
}
- (BOOL)bluetoothEnabled {
+// TODO(crbug.com/619982): The CBManager base class appears to still be in
+// flux. Unwind this #ifdef once the APIs settle.
+#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+ return [centralManager_ state] == CBManagerStatePoweredOn;
+#else
return [centralManager_ state] == CBCentralManagerStatePoweredOn;
+#endif
}
- (void)reallyStart {
@@ -186,7 +191,7 @@ enum BeaconType {
#pragma mark CBCentralManagerDelegate methods
- (void)centralManagerDidUpdateState:(CBCentralManager*)central {
- if ([centralManager_ state] == CBCentralManagerStatePoweredOn) {
+ if ([self bluetoothEnabled]) {
if (pendingStart_)
[self reallyStart];
} else {
« 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