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

Side by Side Diff: ios/chrome/browser/payments/payment_method_selection_coordinator.mm

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/payments/payment_method_selection_coordinator.h"
6
7 #import "base/ios/weak_nsobject.h"
8 #include "base/mac/scoped_nsobject.h"
9 #include "components/autofill/core/browser/credit_card.h"
10
11 @interface PaymentMethodSelectionCoordinator () {
12 base::WeakNSProtocol<id<PaymentMethodSelectionCoordinatorDelegate>> _delegate;
13 base::scoped_nsobject<PaymentMethodSelectionViewController> _viewController;
14 }
15
16 @end
17
18 @implementation PaymentMethodSelectionCoordinator
19
20 @synthesize paymentMethods = _paymentMethods;
21 @synthesize selectedPaymentMethod = _selectedPaymentMethod;
22
23 - (id<PaymentMethodSelectionCoordinatorDelegate>)delegate {
24 return _delegate.get();
25 }
26
27 - (void)setDelegate:(id<PaymentMethodSelectionCoordinatorDelegate>)delegate {
28 _delegate.reset(delegate);
29 }
30
31 - (void)start {
32 _viewController.reset([[PaymentMethodSelectionViewController alloc] init]);
33 [_viewController setPaymentMethods:_paymentMethods];
34 [_viewController setSelectedPaymentMethod:_selectedPaymentMethod];
35 [_viewController setDelegate:self];
36 [_viewController loadModel];
37
38 DCHECK([self baseViewController].navigationController);
39 [[self baseViewController].navigationController
40 pushViewController:_viewController
41 animated:YES];
42 }
43
44 - (void)stop {
45 [[self baseViewController].navigationController
46 popViewControllerAnimated:YES];
47 _viewController.reset();
48 }
49
50 #pragma mark - PaymentMethodSelectionViewControllerDelegate
51
52 - (void)paymentMethodSelectionViewController:
53 (PaymentMethodSelectionViewController*)controller
54 selectedPaymentMethod:
55 (autofill::CreditCard*)paymentMethod {
56 _selectedPaymentMethod = paymentMethod;
57 [_delegate paymentMethodSelectionCoordinator:self
58 selectedPaymentMethod:paymentMethod];
59 }
60
61 - (void)paymentMethodSelectionViewControllerDidReturn:
62 (PaymentMethodSelectionViewController*)controller {
63 [_delegate paymentMethodSelectionCoordinatorDidReturn:self];
64 }
65
66 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698