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

Side by Side Diff: ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/omnibox/omnibox_popup_material_row.h" 5 #import "ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/objc_property_releaser.h" 8 #include "base/mac/objc_release_properties.h"
9 #import "ios/chrome/browser/ui/omnibox/truncating_attributed_label.h" 9 #import "ios/chrome/browser/ui/omnibox/truncating_attributed_label.h"
10 #include "ios/chrome/browser/ui/rtl_geometry.h" 10 #include "ios/chrome/browser/ui/rtl_geometry.h"
11 #include "ios/chrome/browser/ui/ui_util.h" 11 #include "ios/chrome/browser/ui/ui_util.h"
12 #import "ios/chrome/browser/ui/uikit_ui_util.h" 12 #import "ios/chrome/browser/ui/uikit_ui_util.h"
13 #include "ios/chrome/grit/ios_theme_resources.h" 13 #include "ios/chrome/grit/ios_theme_resources.h"
14 14
15 namespace { 15 namespace {
16 const CGFloat kImageDimensionLength = 19.0; 16 const CGFloat kImageDimensionLength = 19.0;
17 const CGFloat kLeadingPaddingIpad = 164; 17 const CGFloat kLeadingPaddingIpad = 164;
18 const CGFloat kLeadingPaddingIpadCompact = 71; 18 const CGFloat kLeadingPaddingIpadCompact = 71;
19 const CGFloat kAppendButtonTrailingMargin = 4; 19 const CGFloat kAppendButtonTrailingMargin = 4;
20 } 20 }
21 21
22 @interface OmniboxPopupMaterialRow () { 22 @interface OmniboxPopupMaterialRow () {
23 BOOL _incognito; 23 BOOL _incognito;
24 base::mac::ObjCPropertyReleaser _propertyReleaser_OmniboxPopupMaterialRow;
25 } 24 }
26 25
27 // Set the append button normal and highlighted images. 26 // Set the append button normal and highlighted images.
28 - (void)updateAppendButtonImages; 27 - (void)updateAppendButtonImages;
29 28
30 @end 29 @end
31 30
32 @implementation OmniboxPopupMaterialRow 31 @implementation OmniboxPopupMaterialRow
33 32
34 @synthesize textTruncatingLabel = _textTruncatingLabel; 33 @synthesize textTruncatingLabel = _textTruncatingLabel;
35 @synthesize detailTruncatingLabel = _detailTruncatingLabel; 34 @synthesize detailTruncatingLabel = _detailTruncatingLabel;
36 @synthesize appendButton = _appendButton; 35 @synthesize appendButton = _appendButton;
37 @synthesize physicalWebButton = _physicalWebButton; 36 @synthesize physicalWebButton = _physicalWebButton;
38 @synthesize answerImageView = _answerImageView; 37 @synthesize answerImageView = _answerImageView;
39 @synthesize imageView = _imageView; 38 @synthesize imageView = _imageView;
40 @synthesize rowHeight = _rowHeight; 39 @synthesize rowHeight = _rowHeight;
41 40
42 - (instancetype)initWithStyle:(UITableViewCellStyle)style 41 - (instancetype)initWithStyle:(UITableViewCellStyle)style
43 reuseIdentifier:(NSString*)reuseIdentifier { 42 reuseIdentifier:(NSString*)reuseIdentifier {
44 return [self initWithIncognito:NO]; 43 return [self initWithIncognito:NO];
45 } 44 }
46 45
47 - (instancetype)initWithIncognito:(BOOL)incognito { 46 - (instancetype)initWithIncognito:(BOOL)incognito {
48 self = [super initWithStyle:UITableViewCellStyleDefault 47 self = [super initWithStyle:UITableViewCellStyleDefault
49 reuseIdentifier:@"OmniboxPopupMaterialRow"]; 48 reuseIdentifier:@"OmniboxPopupMaterialRow"];
50 if (self) { 49 if (self) {
51 self.isAccessibilityElement = YES; 50 self.isAccessibilityElement = YES;
52 self.backgroundColor = [UIColor clearColor]; 51 self.backgroundColor = [UIColor clearColor];
53 _incognito = incognito; 52 _incognito = incognito;
54 _propertyReleaser_OmniboxPopupMaterialRow.Init(
55 self, [OmniboxPopupMaterialRow class]);
56
57 _textTruncatingLabel = 53 _textTruncatingLabel =
58 [[OmniboxPopupTruncatingLabel alloc] initWithFrame:CGRectZero]; 54 [[OmniboxPopupTruncatingLabel alloc] initWithFrame:CGRectZero];
59 _textTruncatingLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; 55 _textTruncatingLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
60 _textTruncatingLabel.userInteractionEnabled = NO; 56 _textTruncatingLabel.userInteractionEnabled = NO;
61 [self addSubview:_textTruncatingLabel]; 57 [self addSubview:_textTruncatingLabel];
62 58
63 _detailTruncatingLabel = 59 _detailTruncatingLabel =
64 [[OmniboxPopupTruncatingLabel alloc] initWithFrame:CGRectZero]; 60 [[OmniboxPopupTruncatingLabel alloc] initWithFrame:CGRectZero];
65 _detailTruncatingLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; 61 _detailTruncatingLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
66 _detailTruncatingLabel.userInteractionEnabled = NO; 62 _detailTruncatingLabel.userInteractionEnabled = NO;
(...skipping 23 matching lines...) Expand all
90 } 86 }
91 87
92 _answerImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; 88 _answerImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
93 _answerImageView.userInteractionEnabled = NO; 89 _answerImageView.userInteractionEnabled = NO;
94 _answerImageView.contentMode = UIViewContentModeScaleAspectFit; 90 _answerImageView.contentMode = UIViewContentModeScaleAspectFit;
95 [self addSubview:_answerImageView]; 91 [self addSubview:_answerImageView];
96 } 92 }
97 return self; 93 return self;
98 } 94 }
99 95
96 - (void)dealloc {
97 base::mac::ReleaseProperties(self);
98 [super dealloc];
99 }
100
100 - (void)layoutSubviews { 101 - (void)layoutSubviews {
101 [super layoutSubviews]; 102 [super layoutSubviews];
102 [self layoutAccessoryViews]; 103 [self layoutAccessoryViews];
103 } 104 }
104 105
105 - (void)layoutAccessoryViews { 106 - (void)layoutAccessoryViews {
106 LayoutRect imageViewLayout = LayoutRectMake( 107 LayoutRect imageViewLayout = LayoutRectMake(
107 IsCompactTablet() ? kLeadingPaddingIpadCompact : kLeadingPaddingIpad, 108 IsCompactTablet() ? kLeadingPaddingIpadCompact : kLeadingPaddingIpad,
108 CGRectGetWidth(self.bounds), 109 CGRectGetWidth(self.bounds),
109 floor((_rowHeight - kImageDimensionLength) / 2), kImageDimensionLength, 110 floor((_rowHeight - kImageDimensionLength) / 2), kImageDimensionLength,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 - (NSString*)accessibilityLabel { 182 - (NSString*)accessibilityLabel {
182 return _textTruncatingLabel.attributedText.string; 183 return _textTruncatingLabel.attributedText.string;
183 } 184 }
184 185
185 - (NSString*)accessibilityValue { 186 - (NSString*)accessibilityValue {
186 return _detailTruncatingLabel.attributedText.string; 187 return _detailTruncatingLabel.attributedText.string;
187 } 188 }
188 189
189 @end 190 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698