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

Side by Side Diff: ios/chrome/browser/ui/history/history_entries_status_item.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: weak -> assign Created 3 years, 11 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
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/browser/ui/history/history_entries_status_item.h" 5 #import "ios/chrome/browser/ui/history/history_entries_status_item.h"
6 6
7 #include "base/ios/weak_nsobject.h" 7 #include "base/ios/weak_nsobject.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #import "base/mac/objc_property_releaser.h" 9 #include "base/mac/objc_release_properties.h"
10 #include "components/strings/grit/components_strings.h" 10 #include "components/strings/grit/components_strings.h"
11 #include "ios/chrome/browser/chrome_url_constants.h" 11 #include "ios/chrome/browser/chrome_url_constants.h"
12 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item .h" 12 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item .h"
13 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 13 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
14 #import "ios/chrome/browser/ui/util/label_link_controller.h" 14 #import "ios/chrome/browser/ui/util/label_link_controller.h"
15 #import "ios/chrome/common/string_util.h" 15 #import "ios/chrome/common/string_util.h"
16 #include "ios/chrome/grit/ios_strings.h" 16 #include "ios/chrome/grit/ios_strings.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/l10n/l10n_util_mac.h" 18 #include "ui/base/l10n/l10n_util_mac.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 // Delegate for HistoryEntriesStatusCell. 21 // Delegate for HistoryEntriesStatusCell.
22 @protocol HistoryEntriesStatusCellDelegate<NSObject> 22 @protocol HistoryEntriesStatusCellDelegate<NSObject>
23 // Notifies the delegate that |URL| should be opened. 23 // Notifies the delegate that |URL| should be opened.
24 - (void)historyEntriesStatusCell:(HistoryEntriesStatusCell*)cell 24 - (void)historyEntriesStatusCell:(HistoryEntriesStatusCell*)cell
25 didRequestOpenURL:(const GURL&)URL; 25 didRequestOpenURL:(const GURL&)URL;
26 @end 26 @end
27 27
28 @interface HistoryEntriesStatusCell () { 28 @interface HistoryEntriesStatusCell () {
29 // Property releaser for HistoryEntriesStatusItem.
30 base::mac::ObjCPropertyReleaser _propertyReleaser_HistoryEntriesStatusCell;
31 // Delegate for the HistoryEntriesStatusCell. Is notified when a link is 29 // Delegate for the HistoryEntriesStatusCell. Is notified when a link is
32 // tapped. 30 // tapped.
33 base::WeakNSProtocol<id<HistoryEntriesStatusCellDelegate>> _delegate; 31 base::WeakNSProtocol<id<HistoryEntriesStatusCellDelegate>> _delegate;
34 } 32 }
35 // Redeclare as readwrite. 33 // Redeclare as readwrite.
36 @property(nonatomic, retain, readwrite) 34 @property(nonatomic, retain, readwrite)
37 LabelLinkController* labelLinkController; 35 LabelLinkController* labelLinkController;
38 // Delegate for the HistoryEntriesStatusCell. Is notified when a link is 36 // Delegate for the HistoryEntriesStatusCell. Is notified when a link is
39 // tapped. 37 // tapped.
40 @property(nonatomic, assign) id<HistoryEntriesStatusCellDelegate> delegate; 38 @property(nonatomic, assign) id<HistoryEntriesStatusCellDelegate> delegate;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 isEqualToHistoryEntriesStatusItem:base::mac::ObjCCastStrict< 140 isEqualToHistoryEntriesStatusItem:base::mac::ObjCCastStrict<
143 HistoryEntriesStatusItem>(object)]; 141 HistoryEntriesStatusItem>(object)];
144 } 142 }
145 143
146 @end 144 @end
147 145
148 @implementation HistoryEntriesStatusCell 146 @implementation HistoryEntriesStatusCell
149 147
150 @synthesize labelLinkController = _labelLinkController; 148 @synthesize labelLinkController = _labelLinkController;
151 149
152 - (instancetype)initWithFrame:(CGRect)frame { 150 - (void)dealloc {
153 self = [super initWithFrame:frame]; 151 base::mac::ReleaseProperties(self);
154 if (self) { 152 [super dealloc];
155 _propertyReleaser_HistoryEntriesStatusCell.Init(
156 self, [HistoryEntriesStatusCell class]);
157 }
158 return self;
159 } 153 }
160 154
161 - (void)setLinksForSyncURL:(const GURL&)syncURL 155 - (void)setLinksForSyncURL:(const GURL&)syncURL
162 browsingDataURL:(const GURL&)browsingDataURL { 156 browsingDataURL:(const GURL&)browsingDataURL {
163 base::WeakNSObject<HistoryEntriesStatusCell> weakSelf(self); 157 base::WeakNSObject<HistoryEntriesStatusCell> weakSelf(self);
164 self.labelLinkController = [[[LabelLinkController alloc] 158 self.labelLinkController = [[[LabelLinkController alloc]
165 initWithLabel:self.textLabel 159 initWithLabel:self.textLabel
166 action:^(const GURL& URL) { 160 action:^(const GURL& URL) {
167 [[weakSelf delegate] historyEntriesStatusCell:weakSelf 161 [[weakSelf delegate] historyEntriesStatusCell:weakSelf
168 didRequestOpenURL:URL]; 162 didRequestOpenURL:URL];
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return _delegate; 198 return _delegate;
205 } 199 }
206 200
207 - (void)prepareForReuse { 201 - (void)prepareForReuse {
208 [super prepareForReuse]; 202 [super prepareForReuse];
209 self.labelLinkController = nil; 203 self.labelLinkController = nil;
210 self.delegate = nil; 204 self.delegate = nil;
211 } 205 }
212 206
213 @end 207 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698