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

Unified Diff: ios/chrome/browser/payments/payment_method_selection_coordinator.mm

Issue 2710493006: [ObjC ARC] Converts ios/chrome/browser/payments:payments to ARC. (Closed)
Patch Set: rebase? Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/payments/payment_method_selection_coordinator.mm
diff --git a/ios/chrome/browser/payments/payment_method_selection_coordinator.mm b/ios/chrome/browser/payments/payment_method_selection_coordinator.mm
index 6cf1de3c3d0bc93f2f886281b7a32edd9750a110..a6a614ac1382d506b3a26df98ce09a3a65e5b860 100644
--- a/ios/chrome/browser/payments/payment_method_selection_coordinator.mm
+++ b/ios/chrome/browser/payments/payment_method_selection_coordinator.mm
@@ -4,15 +4,16 @@
#import "ios/chrome/browser/payments/payment_method_selection_coordinator.h"
-#import "base/ios/weak_nsobject.h"
-#include "base/mac/scoped_nsobject.h"
#include "components/autofill/core/browser/credit_card.h"
#include "ios/chrome/browser/payments/payment_request.h"
-@interface PaymentMethodSelectionCoordinator () {
- base::WeakNSProtocol<id<PaymentMethodSelectionCoordinatorDelegate>> _delegate;
- base::scoped_nsobject<PaymentMethodSelectionViewController> _viewController;
-}
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface PaymentMethodSelectionCoordinator ()
+@property(nonatomic, strong)
+ PaymentMethodSelectionViewController* viewController;
// Called when the user selects a payment method. The cell is checked, the
// UI is locked so that the user can't interact with it, then the delegate is
@@ -23,20 +24,13 @@
@end
@implementation PaymentMethodSelectionCoordinator
-
@synthesize paymentRequest = _paymentRequest;
-
-- (id<PaymentMethodSelectionCoordinatorDelegate>)delegate {
- return _delegate.get();
-}
-
-- (void)setDelegate:(id<PaymentMethodSelectionCoordinatorDelegate>)delegate {
- _delegate.reset(delegate);
-}
+@synthesize delegate = _delegate;
+@synthesize viewController = _viewController;
- (void)start {
- _viewController.reset([[PaymentMethodSelectionViewController alloc]
- initWithPaymentRequest:_paymentRequest]);
+ _viewController = [[PaymentMethodSelectionViewController alloc]
+ initWithPaymentRequest:_paymentRequest];
[_viewController setDelegate:self];
[_viewController loadModel];
@@ -49,7 +43,7 @@
- (void)stop {
[[self baseViewController].navigationController
popViewControllerAnimated:YES];
- _viewController.reset();
+ _viewController = nil;
}
#pragma mark - PaymentMethodSelectionViewControllerDelegate
@@ -67,22 +61,17 @@
}
- (void)delayedNotifyDelegateOfSelection:(autofill::CreditCard*)paymentMethod {
- _viewController.get().view.userInteractionEnabled = NO;
- base::WeakNSObject<PaymentMethodSelectionCoordinator> weakSelf(self);
- dispatch_after(
- dispatch_time(DISPATCH_TIME_NOW,
- static_cast<int64_t>(0.2 * NSEC_PER_SEC)),
- dispatch_get_main_queue(), ^{
- base::scoped_nsobject<PaymentMethodSelectionCoordinator> strongSelf(
- [weakSelf retain]);
- // Early return if the coordinator has been deallocated.
- if (!strongSelf)
- return;
-
- _viewController.get().view.userInteractionEnabled = YES;
- [_delegate paymentMethodSelectionCoordinator:self
- didSelectPaymentMethod:paymentMethod];
- });
+ _viewController.view.userInteractionEnabled = NO;
+ __weak PaymentMethodSelectionCoordinator* weakSelf = self;
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
+ static_cast<int64_t>(0.2 * NSEC_PER_SEC)),
+ dispatch_get_main_queue(), ^{
+ PaymentMethodSelectionCoordinator* strongSelf = weakSelf;
+ strongSelf.viewController.view.userInteractionEnabled = YES;
+ [strongSelf.delegate
+ paymentMethodSelectionCoordinator:strongSelf
+ didSelectPaymentMethod:paymentMethod];
+ });
}
@end

Powered by Google App Engine
This is Rietveld 408576698