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

Unified Diff: ios/chrome/browser/payments/shipping_option_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/shipping_option_selection_coordinator.mm
diff --git a/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm b/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm
index c30c6bed95c9138709c9b2fc7bb7577d7812e5a0..8d37c51738599c000fb86febbb78ec990f1338cb 100644
--- a/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm
+++ b/ios/chrome/browser/payments/shipping_option_selection_coordinator.mm
@@ -4,16 +4,17 @@
#import "ios/chrome/browser/payments/shipping_option_selection_coordinator.h"
-#import "base/ios/weak_nsobject.h"
-#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#import "ios/chrome/browser/payments/payment_request_util.h"
-@interface ShippingOptionSelectionCoordinator () {
- base::WeakNSProtocol<id<ShippingOptionSelectionCoordinatorDelegate>>
- _delegate;
- base::scoped_nsobject<ShippingOptionSelectionViewController> _viewController;
-}
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface ShippingOptionSelectionCoordinator ()
+
+@property(nonatomic, strong)
+ ShippingOptionSelectionViewController* viewController;
// Called when the user selects a shipping option. The cell is checked, the
// UI is locked so that the user can't interact with it, then the delegate is
@@ -27,18 +28,12 @@
@implementation ShippingOptionSelectionCoordinator
@synthesize paymentRequest = _paymentRequest;
-
-- (id<ShippingOptionSelectionCoordinatorDelegate>)delegate {
- return _delegate.get();
-}
-
-- (void)setDelegate:(id<ShippingOptionSelectionCoordinatorDelegate>)delegate {
- _delegate.reset(delegate);
-}
+@synthesize delegate = _delegate;
+@synthesize viewController = _viewController;
- (void)start {
- _viewController.reset([[ShippingOptionSelectionViewController alloc]
- initWithPaymentRequest:_paymentRequest]);
+ _viewController = [[ShippingOptionSelectionViewController alloc]
+ initWithPaymentRequest:_paymentRequest];
[_viewController setDelegate:self];
[_viewController loadModel];
@@ -50,13 +45,13 @@
- (void)stop {
[self.baseViewController.navigationController popViewControllerAnimated:YES];
- _viewController.reset();
+ _viewController = nil;
}
- (void)stopSpinnerAndDisplayError {
// Re-enable user interactions that were disabled earlier in
// delayedNotifyDelegateOfSelection.
- _viewController.get().view.userInteractionEnabled = YES;
+ _viewController.view.userInteractionEnabled = YES;
[_viewController setIsLoading:NO];
NSString* errorMessage =
@@ -83,24 +78,20 @@
- (void)delayedNotifyDelegateOfSelection:
(web::PaymentShippingOption*)shippingOption {
- _viewController.get().view.userInteractionEnabled = NO;
- base::WeakNSObject<ShippingOptionSelectionCoordinator> 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<ShippingOptionSelectionCoordinator> strongSelf(
- [weakSelf retain]);
- // Early return if the coordinator has been deallocated.
- if (!strongSelf)
- return;
- [_viewController setIsLoading:YES];
- [_viewController loadModel];
- [[_viewController collectionView] reloadData];
-
- [_delegate shippingOptionSelectionCoordinator:self
- didSelectShippingOption:shippingOption];
- });
+ _viewController.view.userInteractionEnabled = NO;
+ __weak ShippingOptionSelectionCoordinator* weakSelf = self;
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
+ static_cast<int64_t>(0.2 * NSEC_PER_SEC)),
+ dispatch_get_main_queue(), ^{
+ ShippingOptionSelectionCoordinator* strongSelf = weakSelf;
+ [strongSelf.viewController setIsLoading:YES];
+ [strongSelf.viewController loadModel];
+ [[strongSelf.viewController collectionView] reloadData];
+
+ [strongSelf.delegate
+ shippingOptionSelectionCoordinator:strongSelf
+ didSelectShippingOption:shippingOption];
+ });
}
@end

Powered by Google App Engine
This is Rietveld 408576698