OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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_request_error_coordinator.h" | |
6 | |
7 #import "base/ios/weak_nsobject.h" | |
8 #include "base/mac/scoped_nsobject.h" | |
9 #include "components/strings/grit/components_strings.h" | |
10 #include "ui/base/l10n/l10n_util.h" | |
11 | |
12 @interface PaymentRequestErrorCoordinator () { | |
13 base::WeakNSProtocol<id<PaymentRequestErrorCoordinatorDelegate>> _delegate; | |
14 base::scoped_nsobject<PaymentRequestErrorViewController> _viewController; | |
15 } | |
16 | |
17 @end | |
18 | |
19 @implementation PaymentRequestErrorCoordinator | |
20 | |
21 @synthesize callback = _callback; | |
22 | |
23 - (id<PaymentRequestErrorCoordinatorDelegate>)delegate { | |
24 return _delegate.get(); | |
25 } | |
26 | |
27 - (void)setDelegate:(id<PaymentRequestErrorCoordinatorDelegate>)delegate { | |
28 _delegate.reset(delegate); | |
29 } | |
30 | |
31 - (void)start { | |
32 _viewController.reset([[PaymentRequestErrorViewController alloc] init]); | |
33 [_viewController | |
34 setErrorMessage:l10n_util::GetNSString(IDS_PAYMENTS_ERROR_MESSAGE)]; | |
35 [_viewController setDelegate:self]; | |
36 [_viewController loadModel]; | |
37 | |
38 [[self baseViewController] presentViewController:_viewController | |
39 animated:YES | |
40 completion:nil]; | |
41 } | |
42 | |
43 - (void)stop { | |
44 [_viewController dismissViewControllerAnimated:YES completion:nil]; | |
Moe
2017/02/21 05:07:06
I'm not sure I'm understanding the docs about dism
lpromero
2017/02/21 12:26:22
Yes, this one is a bit weird.
Historically, -dism
Moe
2017/02/21 15:37:40
Thank you for the explanation Louis! Your are righ
| |
45 _viewController.reset(); | |
46 } | |
47 | |
48 #pragma mark - PaymentRequestErrorViewControllerDelegate | |
49 | |
50 - (void)paymentRequestErrorViewControllerDidDismiss: | |
51 (PaymentRequestErrorViewController*)controller { | |
52 [_delegate paymentRequestErrorCoordinatorDidDismiss:self]; | |
53 } | |
54 | |
55 @end | |
OLD | NEW |