Index: ios/chrome/browser/payments/payment_request_error_coordinator.mm |
diff --git a/ios/chrome/browser/payments/payment_request_error_coordinator.mm b/ios/chrome/browser/payments/payment_request_error_coordinator.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..30c294cc159128602a4d21899c9d42f6bb4cc482 |
--- /dev/null |
+++ b/ios/chrome/browser/payments/payment_request_error_coordinator.mm |
@@ -0,0 +1,55 @@ |
+// 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/payment_request_error_coordinator.h" |
+ |
+#import "base/ios/weak_nsobject.h" |
+#include "base/mac/scoped_nsobject.h" |
+#include "components/strings/grit/components_strings.h" |
+#include "ui/base/l10n/l10n_util.h" |
+ |
+@interface PaymentRequestErrorCoordinator () { |
+ base::WeakNSProtocol<id<PaymentRequestErrorCoordinatorDelegate>> _delegate; |
+ base::scoped_nsobject<PaymentRequestErrorViewController> _viewController; |
+} |
+ |
+@end |
+ |
+@implementation PaymentRequestErrorCoordinator |
+ |
+@synthesize callback = _callback; |
+ |
+- (id<PaymentRequestErrorCoordinatorDelegate>)delegate { |
+ return _delegate.get(); |
+} |
+ |
+- (void)setDelegate:(id<PaymentRequestErrorCoordinatorDelegate>)delegate { |
+ _delegate.reset(delegate); |
+} |
+ |
+- (void)start { |
+ _viewController.reset([[PaymentRequestErrorViewController alloc] init]); |
+ [_viewController |
+ setErrorMessage:l10n_util::GetNSString(IDS_PAYMENTS_ERROR_MESSAGE)]; |
+ [_viewController setDelegate:self]; |
+ [_viewController loadModel]; |
+ |
+ [[self baseViewController] presentViewController:_viewController |
+ animated:YES |
+ completion:nil]; |
+} |
+ |
+- (void)stop { |
+ [_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
|
+ _viewController.reset(); |
+} |
+ |
+#pragma mark - PaymentRequestErrorViewControllerDelegate |
+ |
+- (void)paymentRequestErrorViewControllerDidDismiss: |
+ (PaymentRequestErrorViewController*)controller { |
+ [_delegate paymentRequestErrorCoordinatorDidDismiss:self]; |
+} |
+ |
+@end |