| OLD | NEW |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 - (instancetype)initWithDelegate:(id<PhysicalWebScannerDelegate>)delegate { | 102 - (instancetype)initWithDelegate:(id<PhysicalWebScannerDelegate>)delegate { |
| 103 self = [super init]; | 103 self = [super init]; |
| 104 if (self) { | 104 if (self) { |
| 105 delegate_ = delegate; | 105 delegate_ = delegate; |
| 106 devices_.reset([[NSMutableArray alloc] init]); | 106 devices_.reset([[NSMutableArray alloc] init]); |
| 107 devicesUrls_.reset([[NSMutableSet alloc] init]); | 107 devicesUrls_.reset([[NSMutableSet alloc] init]); |
| 108 finalUrls_.reset([[NSMutableSet alloc] init]); | 108 finalUrls_.reset([[NSMutableSet alloc] init]); |
| 109 pendingRequests_.reset([[NSMutableArray alloc] init]); | 109 pendingRequests_.reset([[NSMutableArray alloc] init]); |
| 110 centralManager_.reset([[CBCentralManager alloc] | 110 centralManager_.reset([[CBCentralManager alloc] |
| 111 initWithDelegate:self | 111 initWithDelegate:self |
| 112 queue:dispatch_get_main_queue()]); | 112 queue:dispatch_get_main_queue() |
| 113 options:@{ |
| 114 CBCentralManagerOptionShowPowerAlertKey : @NO |
| 115 }]); |
| 113 unresolvedDevices_.reset([[NSMutableArray alloc] init]); | 116 unresolvedDevices_.reset([[NSMutableArray alloc] init]); |
| 114 [[NSHTTPCookieStorage sharedHTTPCookieStorage] | 117 [[NSHTTPCookieStorage sharedHTTPCookieStorage] |
| 115 setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyNever]; | 118 setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyNever]; |
| 116 } | 119 } |
| 117 return self; | 120 return self; |
| 118 } | 121 } |
| 119 | 122 |
| 120 - (instancetype)init { | 123 - (instancetype)init { |
| 121 NOTREACHED(); | 124 NOTREACHED(); |
| 122 return nil; | 125 return nil; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 [strongSelf.get()->devices_ addObject:device]; | 483 [strongSelf.get()->devices_ addObject:device]; |
| 481 [strongSelf.get()->delegate_ scannerUpdatedDevices:weakSelf]; | 484 [strongSelf.get()->delegate_ scannerUpdatedDevices:weakSelf]; |
| 482 [strongSelf.get()->finalUrls_ addObject:[device url]]; | 485 [strongSelf.get()->finalUrls_ addObject:[device url]]; |
| 483 } | 486 } |
| 484 } | 487 } |
| 485 [strongSelf.get()->pendingRequests_ removeObject:strongRequest]; | 488 [strongSelf.get()->pendingRequests_ removeObject:strongRequest]; |
| 486 }]; | 489 }]; |
| 487 } | 490 } |
| 488 | 491 |
| 489 @end | 492 @end |
| OLD | NEW |