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

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

Issue 2512613005: [ObjC ARC] Converts ios/chrome/common/physical_web:physical_web to ARC.Automatically generated AR… (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
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_device.h" 5 #import "ios/chrome/common/physical_web/physical_web_device.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "ios/chrome/common/physical_web/physical_web_types.h" 9 #include "ios/chrome/common/physical_web/physical_web_types.h"
10 10
11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
11 @implementation PhysicalWebDevice { 15 @implementation PhysicalWebDevice {
12 base::scoped_nsobject<NSURL> url_; 16 base::scoped_nsobject<NSURL> url_;
13 base::scoped_nsobject<NSURL> requestURL_; 17 base::scoped_nsobject<NSURL> requestURL_;
14 base::scoped_nsobject<NSURL> icon_; 18 base::scoped_nsobject<NSURL> icon_;
15 base::scoped_nsobject<NSString> title_; 19 base::scoped_nsobject<NSString> title_;
16 base::scoped_nsobject<NSString> description_; 20 base::scoped_nsobject<NSString> description_;
17 int rssi_; 21 int rssi_;
18 int transmitPower_; 22 int transmitPower_;
19 double rank_; 23 double rank_;
20 base::scoped_nsobject<NSDate> scanTimestamp_; 24 base::scoped_nsobject<NSDate> scanTimestamp_;
21 } 25 }
22 26
23 @synthesize rssi = rssi_; 27 @synthesize rssi = rssi_;
24 @synthesize transmitPower = transmitPower_; 28 @synthesize transmitPower = transmitPower_;
25 @synthesize rank = rank_; 29 @synthesize rank = rank_;
26 30
27 - (instancetype)initWithURL:(NSURL*)url 31 - (instancetype)initWithURL:(NSURL*)url
28 requestURL:(NSURL*)requestURL 32 requestURL:(NSURL*)requestURL
29 icon:(NSURL*)icon 33 icon:(NSURL*)icon
30 title:(NSString*)title 34 title:(NSString*)title
31 description:(NSString*)description 35 description:(NSString*)description
32 transmitPower:(int)transmitPower 36 transmitPower:(int)transmitPower
33 rssi:(int)rssi 37 rssi:(int)rssi
34 rank:(double)rank 38 rank:(double)rank
35 scanTimestamp:(NSDate*)scanTimestamp { 39 scanTimestamp:(NSDate*)scanTimestamp {
36 self = [super init]; 40 self = [super init];
37 if (self) { 41 if (self) {
38 url_.reset([url retain]); 42 url_.reset(url);
39 requestURL_.reset([requestURL retain]); 43 requestURL_.reset(requestURL);
40 icon_.reset([icon retain]); 44 icon_.reset(icon);
41 title_.reset([title copy]); 45 title_.reset([title copy]);
42 description_.reset([description copy]); 46 description_.reset([description copy]);
43 transmitPower_ = transmitPower; 47 transmitPower_ = transmitPower;
44 rssi_ = rssi; 48 rssi_ = rssi;
45 rank_ = rank > physical_web::kMaxRank ? physical_web::kMaxRank : rank; 49 rank_ = rank > physical_web::kMaxRank ? physical_web::kMaxRank : rank;
46 scanTimestamp_.reset([scanTimestamp retain]); 50 scanTimestamp_.reset(scanTimestamp);
47 } 51 }
48 return self; 52 return self;
49 } 53 }
50 54
51 - (instancetype)init { 55 - (instancetype)init {
52 NOTREACHED(); 56 NOTREACHED();
53 return nil; 57 return nil;
54 } 58 }
55 59
56 - (NSURL*)url { 60 - (NSURL*)url {
(...skipping 14 matching lines...) Expand all
71 75
72 - (NSString*)description { 76 - (NSString*)description {
73 return description_; 77 return description_;
74 } 78 }
75 79
76 - (NSDate*)scanTimestamp { 80 - (NSDate*)scanTimestamp {
77 return scanTimestamp_; 81 return scanTimestamp_;
78 } 82 }
79 83
80 - (void)setScanTimestamp:(NSDate*)value { 84 - (void)setScanTimestamp:(NSDate*)value {
81 scanTimestamp_.reset([value retain]); 85 scanTimestamp_.reset(value);
82 } 86 }
83 87
84 @end 88 @end
OLDNEW
« no previous file with comments | « ios/chrome/common/physical_web/physical_web_device.h ('k') | ios/chrome/common/physical_web/physical_web_request.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698