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/stack_view/card_view.mm

Issue 2881183002: Revert of Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Created 3 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 // For performance reasons, the composition of the card frame is broken up into 5 // For performance reasons, the composition of the card frame is broken up into
6 // four pieces. The overall structure of the CardView is: 6 // four pieces. The overall structure of the CardView is:
7 // - CardView 7 // - CardView
8 // - Snapshot (UIImageView) 8 // - Snapshot (UIImageView)
9 // - FrameTop (UIImageView) 9 // - FrameTop (UIImageView)
10 // - FrameLeft (UIImageView) 10 // - FrameLeft (UIImageView)
11 // - FrameRight (UIImageView) 11 // - FrameRight (UIImageView)
12 // - FrameBottom (UIImageView) 12 // - FrameBottom (UIImageView)
13 // - CardTabView (UIView::DrawRect) 13 // - CardTabView (UIView::DrawRect)
14 // 14 //
15 // While it would be simpler to put the frame in one transparent UIImageView, 15 // While it would be simpler to put the frame in one transparent UIImageView,
16 // that would make the entire snapshot area needlessly color-blended. Instead 16 // that would make the entire snapshot area needlessly color-blended. Instead
17 // the frame is broken up into four pieces, top, left, bottom, right. 17 // the frame is broken up into four pieces, top, left, bottom, right.
18 // 18 //
19 // The frame's tab gets its own view above everything else (CardTabView) so that 19 // The frame's tab gets its own view above everything else (CardTabView) so that
20 // it can be animated out. It's also transparent since the tab has a curve and 20 // it can be animated out. It's also transparent since the tab has a curve and
21 // a shadow. 21 // a shadow.
22 22
23 #import "ios/chrome/browser/ui/stack_view/card_view.h" 23 #import "ios/chrome/browser/ui/stack_view/card_view.h"
24 24
25 #import <QuartzCore/QuartzCore.h> 25 #import <QuartzCore/QuartzCore.h>
26 #include <algorithm> 26 #include <algorithm>
27 27
28 #import "base/mac/foundation_util.h" 28 #import "base/mac/foundation_util.h"
29 #include "base/mac/objc_release_properties.h" 29 #import "base/mac/objc_property_releaser.h"
30 #import "base/mac/scoped_nsobject.h" 30 #import "base/mac/scoped_nsobject.h"
31 #include "components/strings/grit/components_strings.h" 31 #include "components/strings/grit/components_strings.h"
32 #import "ios/chrome/browser/ui/animation_util.h" 32 #import "ios/chrome/browser/ui/animation_util.h"
33 #import "ios/chrome/browser/ui/reversed_animation.h" 33 #import "ios/chrome/browser/ui/reversed_animation.h"
34 #import "ios/chrome/browser/ui/rtl_geometry.h" 34 #import "ios/chrome/browser/ui/rtl_geometry.h"
35 #import "ios/chrome/browser/ui/stack_view/close_button.h" 35 #import "ios/chrome/browser/ui/stack_view/close_button.h"
36 #import "ios/chrome/browser/ui/stack_view/title_label.h" 36 #import "ios/chrome/browser/ui/stack_view/title_label.h"
37 #import "ios/chrome/browser/ui/ui_util.h" 37 #import "ios/chrome/browser/ui/ui_util.h"
38 #import "ios/chrome/common/material_timing.h" 38 #import "ios/chrome/common/material_timing.h"
39 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" 39 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 - (void)cleanUpAnimations; 117 - (void)cleanUpAnimations;
118 118
119 // Initialize a CardTabView with |frame| and |isIncognito| state. 119 // Initialize a CardTabView with |frame| and |isIncognito| state.
120 - (instancetype)initWithFrame:(CGRect)frame 120 - (instancetype)initWithFrame:(CGRect)frame
121 isIncognito:(BOOL)isIncognito NS_DESIGNATED_INITIALIZER; 121 isIncognito:(BOOL)isIncognito NS_DESIGNATED_INITIALIZER;
122 122
123 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; 123 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
124 124
125 @end 125 @end
126 126
127 @implementation CardTabView 127 @implementation CardTabView {
128 base::mac::ObjCPropertyReleaser _propertyReleaser_CardTabView;
129 }
128 130
129 #pragma mark - Property Implementation 131 #pragma mark - Property Implementation
130 132
131 @synthesize closeButtonSide = _closeButtonSide; 133 @synthesize closeButtonSide = _closeButtonSide;
132 @synthesize favIconView = _faviconView; 134 @synthesize favIconView = _faviconView;
133 @synthesize favicon = _favicon; 135 @synthesize favicon = _favicon;
134 @synthesize closeButton = _closeButton; 136 @synthesize closeButton = _closeButton;
135 @synthesize titleLabel = _titleLabel; 137 @synthesize titleLabel = _titleLabel;
136 @synthesize isIncognito = _isIncognito; 138 @synthesize isIncognito = _isIncognito;
137 139
138 - (instancetype)initWithFrame:(CGRect)frame { 140 - (instancetype)initWithFrame:(CGRect)frame {
139 return [self initWithFrame:frame isIncognito:NO]; 141 return [self initWithFrame:frame isIncognito:NO];
140 } 142 }
141 143
142 - (instancetype)initWithFrame:(CGRect)frame isIncognito:(BOOL)isIncognito { 144 - (instancetype)initWithFrame:(CGRect)frame isIncognito:(BOOL)isIncognito {
143 self = [super initWithFrame:frame]; 145 self = [super initWithFrame:frame];
144 if (!self) 146 if (!self)
145 return self; 147 return self;
146 148
149 _propertyReleaser_CardTabView.Init(self, [CardTabView class]);
147 _isIncognito = isIncognito; 150 _isIncognito = isIncognito;
148 151
149 UIImage* image = ImageWithName(@"default_favicon", _isIncognito); 152 UIImage* image = ImageWithName(@"default_favicon", _isIncognito);
150 _faviconView = [[UIImageView alloc] initWithImage:image]; 153 _faviconView = [[UIImageView alloc] initWithImage:image];
151 [self addSubview:_faviconView]; 154 [self addSubview:_faviconView];
152 155
153 UIImage* normal = ImageWithName(@"card_close_button", _isIncognito); 156 UIImage* normal = ImageWithName(@"card_close_button", _isIncognito);
154 UIImage* pressed = ImageWithName(@"card_close_button_pressed", _isIncognito); 157 UIImage* pressed = ImageWithName(@"card_close_button_pressed", _isIncognito);
155 158
156 _closeButton = [[CloseButton alloc] initWithFrame:CGRectZero]; 159 _closeButton = [[CloseButton alloc] initWithFrame:CGRectZero];
(...skipping 11 matching lines...) Expand all
168 [self updateTitleColors]; 171 [self updateTitleColors];
169 172
170 return self; 173 return self;
171 } 174 }
172 175
173 - (instancetype)initWithCoder:(NSCoder*)aDecoder { 176 - (instancetype)initWithCoder:(NSCoder*)aDecoder {
174 NOTREACHED(); 177 NOTREACHED();
175 return nil; 178 return nil;
176 } 179 }
177 180
178 - (void)dealloc {
179 base::mac::ReleaseProperties(self);
180 [super dealloc];
181 }
182
183 - (void)setCloseButtonSide:(CardCloseButtonSide)closeButtonSide { 181 - (void)setCloseButtonSide:(CardCloseButtonSide)closeButtonSide {
184 if (_closeButtonSide != closeButtonSide) { 182 if (_closeButtonSide != closeButtonSide) {
185 _closeButtonSide = closeButtonSide; 183 _closeButtonSide = closeButtonSide;
186 [self setNeedsLayout]; 184 [self setNeedsLayout];
187 } 185 }
188 } 186 }
189 187
190 - (void)layoutSubviews { 188 - (void)layoutSubviews {
191 [super layoutSubviews]; 189 [super layoutSubviews];
192 self.favIconView.frame = [self faviconFrameForBounds:self.bounds]; 190 self.favIconView.frame = [self faviconFrameForBounds:self.bounds];
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 DCHECK(!target || [target respondsToSelector:action]); 1026 DCHECK(!target || [target respondsToSelector:action]);
1029 _accessibilityTarget = target; 1027 _accessibilityTarget = target;
1030 _accessibilityAction = action; 1028 _accessibilityAction = action;
1031 } 1029 }
1032 1030
1033 - (void)elementDidBecomeFocused:(id)sender { 1031 - (void)elementDidBecomeFocused:(id)sender {
1034 [_accessibilityTarget performSelector:_accessibilityAction withObject:sender]; 1032 [_accessibilityTarget performSelector:_accessibilityAction withObject:sender];
1035 } 1033 }
1036 1034
1037 @end 1035 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698