Chromium Code Reviews| Index: ios/chrome/browser/payments/credit_card_edit_coordinator.mm |
| diff --git a/ios/chrome/browser/payments/credit_card_edit_coordinator.mm b/ios/chrome/browser/payments/credit_card_edit_coordinator.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..db9cd4ce2933b4e0322175f46df48a1d4e840fba |
| --- /dev/null |
| +++ b/ios/chrome/browser/payments/credit_card_edit_coordinator.mm |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#import "ios/chrome/browser/payments/credit_card_edit_coordinator.h" |
| + |
| +#include "base/logging.h" |
| + |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| +@interface CreditCardEditCoordinator () { |
| + CreditCardEditViewController* _viewController; |
| +} |
| + |
| +@end |
| + |
| +@implementation CreditCardEditCoordinator |
| + |
| +@synthesize creditCard = _creditCard; |
| +@synthesize paymentRequest = _paymentRequest; |
| +@synthesize delegate = _delegate; |
| + |
| +- (void)start { |
| + _viewController = [[CreditCardEditViewController alloc] |
| + initWithPaymentRequest:_paymentRequest |
| + creditCard:_creditCard]; |
| + [_viewController setDelegate:self]; |
| + [_viewController loadModel]; |
| + |
| + DCHECK(self.baseViewController.navigationController); |
| + [[self baseViewController].navigationController |
| + pushViewController:_viewController |
| + animated:YES]; |
| +} |
| + |
| +- (void)stop { |
| + [self.baseViewController.navigationController popViewControllerAnimated:YES]; |
|
lpromero
2017/03/13 16:54:09
Could you instead do:
[_viewController.navigationC
Moe
2017/03/16 01:35:32
It does! Thanks.
|
| + _viewController = nil; |
| +} |
| + |
| +#pragma mark - CreditCardEditViewControllerDelegate |
| + |
| +- (void)creditCardEditViewController:(CreditCardEditViewController*)controller |
| + didFinishEditingCreditCard:(autofill::CreditCard*)creditCard { |
| + [_delegate creditCardEditCoordinator:self |
| + didFinishEditingCreditCard:creditCard]; |
| +} |
| + |
| +- (void)creditCardEditViewControllerDidReturn: |
| + (CreditCardEditViewController*)controller { |
| + [_delegate creditCardEditCoordinatorDidReturn:self]; |
| +} |
| + |
| +@end |