| 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..ca66b0ae9c8c9f9bb4d672db060c9624dee90973
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/payments/payment_request_error_coordinator.mm
|
| @@ -0,0 +1,57 @@
|
| +// 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 presentingViewController]
|
| + dismissViewControllerAnimated:YES
|
| + completion:nil];
|
| + _viewController.reset();
|
| +}
|
| +
|
| +#pragma mark - PaymentRequestErrorViewControllerDelegate
|
| +
|
| +- (void)paymentRequestErrorViewControllerDidDismiss:
|
| + (PaymentRequestErrorViewController*)controller {
|
| + [_delegate paymentRequestErrorCoordinatorDidDismiss:self];
|
| +}
|
| +
|
| +@end
|
|
|