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

Side by Side Diff: ios/chrome/browser/payments/payment_request_coordinator.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_coordinator.h" 5 #import "ios/chrome/browser/payments/payment_request_coordinator.h"
6 6
7 #include <unordered_set> 7 #include <unordered_set>
8 #include <vector> 8 #include <vector>
9 9
10 #import "base/ios/weak_nsobject.h" 10 #import "base/ios/weak_nsobject.h"
11 #include "base/mac/objc_property_releaser.h" 11 #include "base/mac/objc_release_properties.h"
12 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "components/autofill/core/browser/autofill_data_util.h" 14 #include "components/autofill/core/browser/autofill_data_util.h"
15 #include "components/autofill/core/browser/autofill_profile.h" 15 #include "components/autofill/core/browser/autofill_profile.h"
16 #include "components/autofill/core/browser/credit_card.h" 16 #include "components/autofill/core/browser/credit_card.h"
17 #include "components/autofill/core/browser/field_types.h" 17 #include "components/autofill/core/browser/field_types.h"
18 #include "components/autofill/core/browser/personal_data_manager.h" 18 #include "components/autofill/core/browser/personal_data_manager.h"
19 #include "ios/chrome/browser/application_context.h" 19 #include "ios/chrome/browser/application_context.h"
20 20
21 @interface PaymentRequestCoordinator () { 21 @interface PaymentRequestCoordinator () {
22 autofill::PersonalDataManager* _personalDataManager; // weak 22 autofill::PersonalDataManager* _personalDataManager; // weak
23 base::WeakNSProtocol<id<PaymentRequestCoordinatorDelegate>> _delegate; 23 base::WeakNSProtocol<id<PaymentRequestCoordinatorDelegate>> _delegate;
24 base::scoped_nsobject<UINavigationController> _navigationController; 24 base::scoped_nsobject<UINavigationController> _navigationController;
25 base::scoped_nsobject<PaymentRequestViewController> _viewController; 25 base::scoped_nsobject<PaymentRequestViewController> _viewController;
26 base::scoped_nsobject<PaymentItemsDisplayCoordinator> 26 base::scoped_nsobject<PaymentItemsDisplayCoordinator>
27 _itemsDisplayCoordinator; 27 _itemsDisplayCoordinator;
28 base::scoped_nsobject<ShippingAddressSelectionCoordinator> 28 base::scoped_nsobject<ShippingAddressSelectionCoordinator>
29 _shippingAddressSelectionCoordinator; 29 _shippingAddressSelectionCoordinator;
30 base::scoped_nsobject<PaymentMethodSelectionCoordinator> 30 base::scoped_nsobject<PaymentMethodSelectionCoordinator>
31 _methodSelectionCoordinator; 31 _methodSelectionCoordinator;
32
33 base::mac::ObjCPropertyReleaser _propertyReleaser_PaymentRequestCoordinator;
34 } 32 }
35 33
36 // Returns the credit cards available from |_personalDataManager| that match 34 // Returns the credit cards available from |_personalDataManager| that match
37 // a supported type specified in |_paymentRequest|. 35 // a supported type specified in |_paymentRequest|.
38 - (std::vector<autofill::CreditCard*>)supportedMethods; 36 - (std::vector<autofill::CreditCard*>)supportedMethods;
39 37
40 @end 38 @end
41 39
42 @implementation PaymentRequestCoordinator 40 @implementation PaymentRequestCoordinator
43 41
44 @synthesize paymentRequest = _paymentRequest; 42 @synthesize paymentRequest = _paymentRequest;
45 @synthesize pageFavicon = _pageFavicon; 43 @synthesize pageFavicon = _pageFavicon;
46 @synthesize pageTitle = _pageTitle; 44 @synthesize pageTitle = _pageTitle;
47 @synthesize pageHost = _pageHost; 45 @synthesize pageHost = _pageHost;
48 @synthesize selectedShippingAddress = _selectedShippingAddress; 46 @synthesize selectedShippingAddress = _selectedShippingAddress;
49 @synthesize selectedPaymentMethod = _selectedPaymentMethod; 47 @synthesize selectedPaymentMethod = _selectedPaymentMethod;
50 48
51 - (instancetype)initWithBaseViewController:(UIViewController*)baseViewController 49 - (instancetype)initWithBaseViewController:(UIViewController*)baseViewController
52 personalDataManager: 50 personalDataManager:
53 (autofill::PersonalDataManager*)personalDataManager { 51 (autofill::PersonalDataManager*)personalDataManager {
54 if ((self = [super initWithBaseViewController:baseViewController])) { 52 if ((self = [super initWithBaseViewController:baseViewController])) {
55 _propertyReleaser_PaymentRequestCoordinator.Init(
56 self, [PaymentRequestCoordinator class]);
57 _personalDataManager = personalDataManager; 53 _personalDataManager = personalDataManager;
58 } 54 }
59 return self; 55 return self;
60 } 56 }
61 57
58 - (void)dealloc {
59 base::mac::ReleaseProperties(self);
60 [super dealloc];
61 }
62
62 - (id<PaymentRequestCoordinatorDelegate>)delegate { 63 - (id<PaymentRequestCoordinatorDelegate>)delegate {
63 return _delegate.get(); 64 return _delegate.get();
64 } 65 }
65 66
66 - (void)setDelegate:(id<PaymentRequestCoordinatorDelegate>)delegate { 67 - (void)setDelegate:(id<PaymentRequestCoordinatorDelegate>)delegate {
67 _delegate.reset(delegate); 68 _delegate.reset(delegate);
68 } 69 }
69 70
70 - (void)start { 71 - (void)start {
71 const std::vector<autofill::AutofillProfile*> addresses = 72 const std::vector<autofill::AutofillProfile*> addresses =
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 _methodSelectionCoordinator.reset(); 276 _methodSelectionCoordinator.reset();
276 } 277 }
277 278
278 - (void)paymentMethodSelectionCoordinatorDidReturn: 279 - (void)paymentMethodSelectionCoordinatorDidReturn:
279 (PaymentMethodSelectionCoordinator*)coordinator { 280 (PaymentMethodSelectionCoordinator*)coordinator {
280 [_methodSelectionCoordinator stop]; 281 [_methodSelectionCoordinator stop];
281 _methodSelectionCoordinator.reset(); 282 _methodSelectionCoordinator.reset();
282 } 283 }
283 284
284 @end 285 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698