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/popup_menu/popup_menu_controller.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 #import "ios/chrome/browser/ui/popup_menu/popup_menu_controller.h" 5 #import "ios/chrome/browser/ui/popup_menu/popup_menu_controller.h"
6 6
7 #import "base/ios/weak_nsobject.h" 7 #import "base/ios/weak_nsobject.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/objc_release_properties.h" 10 #include "base/mac/objc_property_releaser.h"
11 #import "ios/chrome/browser/ui/animation_util.h" 11 #import "ios/chrome/browser/ui/animation_util.h"
12 #import "ios/chrome/browser/ui/popup_menu/popup_menu_view.h" 12 #import "ios/chrome/browser/ui/popup_menu/popup_menu_view.h"
13 #include "ios/chrome/browser/ui/rtl_geometry.h" 13 #include "ios/chrome/browser/ui/rtl_geometry.h"
14 #import "ios/chrome/browser/ui/uikit_ui_util.h" 14 #import "ios/chrome/browser/ui/uikit_ui_util.h"
15 #import "ios/chrome/common/material_timing.h" 15 #import "ios/chrome/common/material_timing.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 18
19 using ios::material::TimingFunction; 19 using ios::material::TimingFunction;
20 20
(...skipping 27 matching lines...) Expand all
48 static CGPoint AnimateInIntermediaryPoint(CGPoint source, CGPoint destination) { 48 static CGPoint AnimateInIntermediaryPoint(CGPoint source, CGPoint destination) {
49 CGPoint midPoint = CGPointZero; 49 CGPoint midPoint = CGPointZero;
50 midPoint.x = destination.x; 50 midPoint.x = destination.x;
51 midPoint.y = source.y - 0.8 * fabs(destination.y - source.y); 51 midPoint.y = source.y - 0.8 * fabs(destination.y - source.y);
52 return midPoint; 52 return midPoint;
53 } 53 }
54 54
55 } // anonymous namespace 55 } // anonymous namespace
56 56
57 @interface PopupMenuController ()<PopupMenuViewDelegate> { 57 @interface PopupMenuController ()<PopupMenuViewDelegate> {
58 base::mac::ObjCPropertyReleaser propertyReleaser_PopupMenuController_;
58 CGPoint sourceAnimationPoint_; 59 CGPoint sourceAnimationPoint_;
59 } 60 }
60 @end 61 @end
61 62
62 @implementation PopupMenuController 63 @implementation PopupMenuController
63 64
64 @synthesize containerView = containerView_; 65 @synthesize containerView = containerView_;
65 @synthesize backgroundButton = backgroundButton_; 66 @synthesize backgroundButton = backgroundButton_;
66 @synthesize popupContainer = popupContainer_; 67 @synthesize popupContainer = popupContainer_;
67 @synthesize delegate = delegate_; 68 @synthesize delegate = delegate_;
68 69
69 - (id)initWithParentView:(UIView*)parent { 70 - (id)initWithParentView:(UIView*)parent {
70 return [self initWithParentView:parent 71 return [self initWithParentView:parent
71 backgroundButtonParent:nil 72 backgroundButtonParent:nil
72 backgroundButtonColor:nil 73 backgroundButtonColor:nil
73 backgroundButtonAlpha:1.0 74 backgroundButtonAlpha:1.0
74 backgroundButtonTag:kBackgroundButtonNoTag 75 backgroundButtonTag:kBackgroundButtonNoTag
75 backgroundButtonSelector:nil]; 76 backgroundButtonSelector:nil];
76 } 77 }
77 78
78 - (id)initWithParentView:(UIView*)parent 79 - (id)initWithParentView:(UIView*)parent
79 backgroundButtonParent:(UIView*)backgroundButtonParent 80 backgroundButtonParent:(UIView*)backgroundButtonParent
80 backgroundButtonColor:(UIColor*)backgroundButtonColor 81 backgroundButtonColor:(UIColor*)backgroundButtonColor
81 backgroundButtonAlpha:(CGFloat)backgroundButtonAlpha 82 backgroundButtonAlpha:(CGFloat)backgroundButtonAlpha
82 backgroundButtonTag:(NSInteger)backgroundButtonTag 83 backgroundButtonTag:(NSInteger)backgroundButtonTag
83 backgroundButtonSelector:(SEL)backgroundButtonSelector { 84 backgroundButtonSelector:(SEL)backgroundButtonSelector {
84 DCHECK(parent); 85 DCHECK(parent);
85 self = [super init]; 86 self = [super init];
86 if (self) { 87 if (self) {
88 propertyReleaser_PopupMenuController_.Init(self,
89 [PopupMenuController class]);
90
87 popupContainer_ = [[PopupMenuView alloc] 91 popupContainer_ = [[PopupMenuView alloc]
88 initWithFrame:CGRectMake(0, 0, kPopupContainerWidth, 92 initWithFrame:CGRectMake(0, 0, kPopupContainerWidth,
89 kPopupContainerHeight)]; 93 kPopupContainerHeight)];
90 94
91 containerView_ = [[UIView alloc] initWithFrame:[parent bounds]]; 95 containerView_ = [[UIView alloc] initWithFrame:[parent bounds]];
92 containerView_.backgroundColor = [UIColor clearColor]; 96 containerView_.backgroundColor = [UIColor clearColor];
93 [containerView_ setAccessibilityViewIsModal:YES]; 97 [containerView_ setAccessibilityViewIsModal:YES];
94 [popupContainer_ setDelegate:self]; 98 [popupContainer_ setDelegate:self];
95 // All views are added to the |containerView_| that in turn is added to the 99 // All views are added to the |containerView_| that in turn is added to the
96 // parent view. The Container View is needed to have a simple alpha 100 // parent view. The Container View is needed to have a simple alpha
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 animations:^{ 169 animations:^{
166 [containerView_ setAlpha:1.0]; 170 [containerView_ setAlpha:1.0];
167 } 171 }
168 completion:completionBlock]; 172 completion:completionBlock];
169 } 173 }
170 174
171 - (void)dealloc { 175 - (void)dealloc {
172 [popupContainer_ removeFromSuperview]; 176 [popupContainer_ removeFromSuperview];
173 [backgroundButton_ removeFromSuperview]; 177 [backgroundButton_ removeFromSuperview];
174 [containerView_ removeFromSuperview]; 178 [containerView_ removeFromSuperview];
175 base::mac::ReleaseProperties(self);
176 [super dealloc]; 179 [super dealloc];
177 } 180 }
178 181
179 - (void)tappedBehindPopup:(id)sender { 182 - (void)tappedBehindPopup:(id)sender {
180 [self dismissPopupMenu]; 183 [self dismissPopupMenu];
181 } 184 }
182 185
183 - (void)animateInFromPoint:(CGPoint)source toPoint:(CGPoint)destination { 186 - (void)animateInFromPoint:(CGPoint)source toPoint:(CGPoint)destination {
184 sourceAnimationPoint_ = source; 187 sourceAnimationPoint_ = source;
185 188
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 278 }
276 279
277 #pragma mark - 280 #pragma mark -
278 #pragma mark PopupMenuViewDelegate 281 #pragma mark PopupMenuViewDelegate
279 282
280 - (void)dismissPopupMenu { 283 - (void)dismissPopupMenu {
281 [delegate_ dismissPopupMenu:self]; 284 [delegate_ dismissPopupMenu:self];
282 } 285 }
283 286
284 @end 287 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698