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

Side by Side Diff: ios/chrome/browser/ui/overscroll_actions/overscroll_actions_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 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/browser/ui/overscroll_actions/overscroll_actions_view.h" 5 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/objc_release_properties.h" 10 #include "base/mac/objc_property_releaser.h"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "ios/chrome/browser/ui/rtl_geometry.h" 12 #include "ios/chrome/browser/ui/rtl_geometry.h"
13 #include "ios/chrome/browser/ui/uikit_ui_util.h" 13 #include "ios/chrome/browser/ui/uikit_ui_util.h"
14 #include "ios/chrome/grit/ios_theme_resources.h" 14 #include "ios/chrome/grit/ios_theme_resources.h"
15 15
16 namespace { 16 namespace {
17 // Actions images. 17 // Actions images.
18 NSString* const kNewTabActionImage = @"ptr_new_tab"; 18 NSString* const kNewTabActionImage = @"ptr_new_tab";
19 NSString* const kNewTabActionActiveImage = @"ptr_new_tab_active"; 19 NSString* const kNewTabActionActiveImage = @"ptr_new_tab_active";
20 NSString* const kRefreshActionImage = @"ptr_reload"; 20 NSString* const kRefreshActionImage = @"ptr_reload";
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Last recorded pull start absolute time. 127 // Last recorded pull start absolute time.
128 // Unit is in seconds. 128 // Unit is in seconds.
129 CFTimeInterval _pullStartTimeInSeconds; 129 CFTimeInterval _pullStartTimeInSeconds;
130 // Tap gesture recognizer that allow the user to tap on an action to activate 130 // Tap gesture recognizer that allow the user to tap on an action to activate
131 // it. 131 // it.
132 base::scoped_nsobject<UITapGestureRecognizer> _tapGesture; 132 base::scoped_nsobject<UITapGestureRecognizer> _tapGesture;
133 // Array of layers that will be centered vertically. 133 // Array of layers that will be centered vertically.
134 // The array is built the first time the method -layersToCenterVertically is 134 // The array is built the first time the method -layersToCenterVertically is
135 // called. 135 // called.
136 base::scoped_nsobject<NSArray> _layersToCenterVertically; 136 base::scoped_nsobject<NSArray> _layersToCenterVertically;
137 base::mac::ObjCPropertyReleaser _propertyReleaser_OverscrollActionsView;
137 } 138 }
138 139
139 // Redefined to readwrite. 140 // Redefined to readwrite.
140 @property(nonatomic, assign, readwrite) OverscrollAction selectedAction; 141 @property(nonatomic, assign, readwrite) OverscrollAction selectedAction;
141 142
142 // Actions image views. 143 // Actions image views.
143 @property(nonatomic, retain) UIImageView* addTabActionImageView; 144 @property(nonatomic, retain) UIImageView* addTabActionImageView;
144 @property(nonatomic, retain) UIImageView* refreshActionImageView; 145 @property(nonatomic, retain) UIImageView* refreshActionImageView;
145 @property(nonatomic, retain) UIImageView* closeTabActionImageView; 146 @property(nonatomic, retain) UIImageView* closeTabActionImageView;
146 147
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 @synthesize overscrollState = _overscrollState; 235 @synthesize overscrollState = _overscrollState;
235 @synthesize shadowView = _shadowView; 236 @synthesize shadowView = _shadowView;
236 @synthesize backgroundView = _backgroundView; 237 @synthesize backgroundView = _backgroundView;
237 @synthesize snapshotView = _snapshotView; 238 @synthesize snapshotView = _snapshotView;
238 @synthesize selectionCircleCroppingLayer = _selectionCircleCroppingLayer; 239 @synthesize selectionCircleCroppingLayer = _selectionCircleCroppingLayer;
239 @synthesize delegate = _delegate; 240 @synthesize delegate = _delegate;
240 241
241 - (instancetype)initWithFrame:(CGRect)frame { 242 - (instancetype)initWithFrame:(CGRect)frame {
242 self = [super initWithFrame:frame]; 243 self = [super initWithFrame:frame];
243 if (self) { 244 if (self) {
245 _propertyReleaser_OverscrollActionsView.Init(self,
246 [OverscrollActionsView class]);
244 _deformationBehaviorEnabled = YES; 247 _deformationBehaviorEnabled = YES;
245 self.autoresizingMask = 248 self.autoresizingMask =
246 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 249 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
247 _selectionCircleLayer = [self newSelectionCircleLayer]; 250 _selectionCircleLayer = [self newSelectionCircleLayer];
248 _selectionCircleMaskLayer = [self newSelectionCircleLayer]; 251 _selectionCircleMaskLayer = [self newSelectionCircleLayer];
249 _selectionCircleMaskLayer.contentsGravity = kCAGravityCenter; 252 _selectionCircleMaskLayer.contentsGravity = kCAGravityCenter;
250 _selectionCircleCroppingLayer = [[CALayer alloc] init]; 253 _selectionCircleCroppingLayer = [[CALayer alloc] init];
251 _selectionCircleCroppingLayer.frame = self.bounds; 254 _selectionCircleCroppingLayer.frame = self.bounds;
252 [_selectionCircleCroppingLayer setMasksToBounds:YES]; 255 [_selectionCircleCroppingLayer setMasksToBounds:YES];
253 256
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 initWithTarget:self 298 initWithTarget:self
296 action:@selector(tapGesture:)]); 299 action:@selector(tapGesture:)]);
297 [_tapGesture setDelegate:self]; 300 [_tapGesture setDelegate:self];
298 [self addGestureRecognizer:_tapGesture]; 301 [self addGestureRecognizer:_tapGesture];
299 } 302 }
300 return self; 303 return self;
301 } 304 }
302 305
303 - (void)dealloc { 306 - (void)dealloc {
304 [self.snapshotView removeFromSuperview]; 307 [self.snapshotView removeFromSuperview];
305 base::mac::ReleaseProperties(self);
306 [super dealloc]; 308 [super dealloc];
307 } 309 }
308 310
309 - (BOOL)selectionCroppingEnabled { 311 - (BOOL)selectionCroppingEnabled {
310 return [_selectionCircleCroppingLayer masksToBounds]; 312 return [_selectionCircleCroppingLayer masksToBounds];
311 } 313 }
312 314
313 - (void)setSelectionCroppingEnabled:(BOOL)enableSelectionCropping { 315 - (void)setSelectionCroppingEnabled:(BOOL)enableSelectionCropping {
314 [_selectionCircleCroppingLayer setMasksToBounds:enableSelectionCropping]; 316 [_selectionCircleCroppingLayer setMasksToBounds:enableSelectionCropping];
315 } 317 }
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 CGPoint tapLocation = [tapRecognizer locationInView:self]; 991 CGPoint tapLocation = [tapRecognizer locationInView:self];
990 OverscrollAction action = [self actionAtLocation:tapLocation]; 992 OverscrollAction action = [self actionAtLocation:tapLocation];
991 if (action != OverscrollAction::NONE) { 993 if (action != OverscrollAction::NONE) {
992 [self updateSelectionForTouchedAction:action]; 994 [self updateSelectionForTouchedAction:action];
993 [self setSelectedAction:action]; 995 [self setSelectedAction:action];
994 [self.delegate overscrollActionsViewDidTapTriggerAction:self]; 996 [self.delegate overscrollActionsViewDidTapTriggerAction:self];
995 } 997 }
996 } 998 }
997 999
998 @end 1000 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698