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

Side by Side Diff: ios/chrome/browser/payments/payment_request_view_controller.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/payments/payment_request_view_controller.h" 5 #import "ios/chrome/browser/payments/payment_request_view_controller.h"
6 6
7 #import "base/ios/weak_nsobject.h" 7 #import "base/ios/weak_nsobject.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/mac/objc_property_releaser.h" 9 #include "base/mac/objc_release_properties.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "components/autofill/core/browser/autofill_data_util.h" 12 #include "components/autofill/core/browser/autofill_data_util.h"
13 #include "components/autofill/core/browser/autofill_profile.h" 13 #include "components/autofill/core/browser/autofill_profile.h"
14 #include "components/autofill/core/browser/credit_card.h" 14 #include "components/autofill/core/browser/credit_card.h"
15 #include "components/autofill/core/browser/field_types.h" 15 #include "components/autofill/core/browser/field_types.h"
16 #include "components/autofill/core/browser/personal_data_manager.h" 16 #include "components/autofill/core/browser/personal_data_manager.h"
17 #include "ios/chrome/browser/application_context.h" 17 #include "ios/chrome/browser/application_context.h"
18 #import "ios/chrome/browser/payments/cells/page_info_item.h" 18 #import "ios/chrome/browser/payments/cells/page_info_item.h"
19 #import "ios/chrome/browser/payments/cells/payment_method_item.h" 19 #import "ios/chrome/browser/payments/cells/payment_method_item.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 }; 59 };
60 60
61 } // namespace 61 } // namespace
62 62
63 @interface PaymentRequestViewController () { 63 @interface PaymentRequestViewController () {
64 base::WeakNSProtocol<id<PaymentRequestViewControllerDelegate>> _delegate; 64 base::WeakNSProtocol<id<PaymentRequestViewControllerDelegate>> _delegate;
65 base::scoped_nsobject<UIBarButtonItem> _cancelButton; 65 base::scoped_nsobject<UIBarButtonItem> _cancelButton;
66 base::scoped_nsobject<MDCFlatButton> _payButton; 66 base::scoped_nsobject<MDCFlatButton> _payButton;
67 67
68 ShippingAddressItem* _selectedShippingAddressItem; 68 ShippingAddressItem* _selectedShippingAddressItem;
69
70 base::mac::ObjCPropertyReleaser
71 _propertyReleaser_PaymentRequestViewController;
72 } 69 }
73 70
74 // Called when the user presses the cancel button. 71 // Called when the user presses the cancel button.
75 - (void)onCancel; 72 - (void)onCancel;
76 73
77 // Called when the user presses the confirm button. 74 // Called when the user presses the confirm button.
78 - (void)onConfirm; 75 - (void)onConfirm;
79 76
80 @end 77 @end
81 78
82 @implementation PaymentRequestViewController 79 @implementation PaymentRequestViewController
83 80
84 @synthesize paymentRequest = _paymentRequest; 81 @synthesize paymentRequest = _paymentRequest;
85 @synthesize pageFavicon = _pageFavicon; 82 @synthesize pageFavicon = _pageFavicon;
86 @synthesize pageTitle = _pageTitle; 83 @synthesize pageTitle = _pageTitle;
87 @synthesize pageHost = _pageHost; 84 @synthesize pageHost = _pageHost;
88 @synthesize selectedPaymentMethod = _selectedPaymentMethod; 85 @synthesize selectedPaymentMethod = _selectedPaymentMethod;
89 @synthesize selectedShippingAddress = _selectedShippingAddress; 86 @synthesize selectedShippingAddress = _selectedShippingAddress;
90 87
91 - (instancetype)init { 88 - (instancetype)init {
92 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) { 89 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) {
93 _propertyReleaser_PaymentRequestViewController.Init(
94 self, [PaymentRequestViewController class]);
95
96 [self setTitle:l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_TITLE)]; 90 [self setTitle:l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_TITLE)];
97 91
98 // Set up left (cancel) button. 92 // Set up left (cancel) button.
99 _cancelButton.reset([[UIBarButtonItem alloc] 93 _cancelButton.reset([[UIBarButtonItem alloc]
100 initWithTitle:l10n_util::GetNSString( 94 initWithTitle:l10n_util::GetNSString(
101 IDS_IOS_PAYMENT_REQUEST_CANCEL_BUTTON) 95 IDS_IOS_PAYMENT_REQUEST_CANCEL_BUTTON)
102 style:UIBarButtonItemStylePlain 96 style:UIBarButtonItemStylePlain
103 target:nil 97 target:nil
104 action:@selector(onCancel)]); 98 action:@selector(onCancel)]);
105 [_cancelButton setTitleTextAttributes:@{ 99 [_cancelButton setTitleTextAttributes:@{
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 [_payButton frame].size.width + kButtonEdgeInset; 137 [_payButton frame].size.width + kButtonEdgeInset;
144 buttonView.bounds = buttonViewBounds; 138 buttonView.bounds = buttonViewBounds;
145 139
146 UIBarButtonItem* payButtonItem = 140 UIBarButtonItem* payButtonItem =
147 [[[UIBarButtonItem alloc] initWithCustomView:buttonView] autorelease]; 141 [[[UIBarButtonItem alloc] initWithCustomView:buttonView] autorelease];
148 [self navigationItem].rightBarButtonItem = payButtonItem; 142 [self navigationItem].rightBarButtonItem = payButtonItem;
149 } 143 }
150 return self; 144 return self;
151 } 145 }
152 146
147 - (void)dealloc {
148 base::mac::ReleaseProperties(self);
149 [super dealloc];
150 }
151
153 - (id<PaymentRequestViewControllerDelegate>)delegate { 152 - (id<PaymentRequestViewControllerDelegate>)delegate {
154 return _delegate.get(); 153 return _delegate.get();
155 } 154 }
156 155
157 - (void)setDelegate:(id<PaymentRequestViewControllerDelegate>)delegate { 156 - (void)setDelegate:(id<PaymentRequestViewControllerDelegate>)delegate {
158 _delegate.reset(delegate); 157 _delegate.reset(delegate);
159 } 158 }
160 159
161 - (void)setSelectedPaymentMethod:(autofill::CreditCard*)method { 160 - (void)setSelectedPaymentMethod:(autofill::CreditCard*)method {
162 _selectedPaymentMethod = method; 161 _selectedPaymentMethod = method;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; 397 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath];
399 if (type == ItemTypeSummaryTotal && 398 if (type == ItemTypeSummaryTotal &&
400 _paymentRequest.details.display_items.empty()) { 399 _paymentRequest.details.display_items.empty()) {
401 return YES; 400 return YES;
402 } else { 401 } else {
403 return NO; 402 return NO;
404 } 403 }
405 } 404 }
406 405
407 @end 406 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698