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

Unified Diff: ios/chrome/browser/payments/payment_request_coordinator.mm

Issue 2701923003: [Payment Request] Error message screen (Closed)
Patch Set: Addressed comments Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/payments/payment_request_coordinator.mm
diff --git a/ios/chrome/browser/payments/payment_request_coordinator.mm b/ios/chrome/browser/payments/payment_request_coordinator.mm
index 29e293a9ca46110765d440276b69522fe62729b4..9a99a11ac43e4b1250dd0b284e220173abd07ec2 100644
--- a/ios/chrome/browser/payments/payment_request_coordinator.mm
+++ b/ios/chrome/browser/payments/payment_request_coordinator.mm
@@ -22,11 +22,13 @@
#include "components/autofill/core/browser/payments/full_card_request.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.h"
+#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/payments/payment_request.h"
#include "ios/chrome/browser/payments/payment_request_util.h"
#include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h"
+#include "ui/base/l10n/l10n_util.h"
// The unmask prompt UI for Payment Request.
class PRCardUnmaskPromptViewBridge
@@ -119,6 +121,7 @@ class FullCardRequester
base::WeakNSProtocol<id<PaymentRequestCoordinatorDelegate>> _delegate;
base::scoped_nsobject<UINavigationController> _navigationController;
base::scoped_nsobject<PaymentRequestViewController> _viewController;
+ base::scoped_nsobject<PaymentRequestErrorCoordinator> _errorCoordinator;
base::scoped_nsobject<PaymentItemsDisplayCoordinator>
_itemsDisplayCoordinator;
base::scoped_nsobject<ShippingAddressSelectionCoordinator>
@@ -192,8 +195,9 @@ class FullCardRequester
_shippingAddressSelectionCoordinator.reset();
_shippingOptionSelectionCoordinator.reset();
_methodSelectionCoordinator.reset();
- _navigationController.reset();
+ _errorCoordinator.reset();
_viewController.reset();
+ _navigationController.reset();
}
- (void)sendPaymentResponse {
@@ -273,6 +277,15 @@ class FullCardRequester
}
}
+- (void)displayErrorWithCallback:(void (^)())callback {
+ _errorCoordinator.reset([[PaymentRequestErrorCoordinator alloc]
+ initWithBaseViewController:_navigationController]);
+ [_errorCoordinator setCallback:callback];
+ [_errorCoordinator setDelegate:self];
+
+ [_errorCoordinator start];
+}
+
#pragma mark - PaymentRequestViewControllerDelegate
- (void)paymentRequestViewControllerDidCancel:
@@ -327,6 +340,19 @@ class FullCardRequester
[_methodSelectionCoordinator start];
}
+#pragma mark - PaymentRequestErrorCoordinatorDelegate
+
+- (void)paymentRequestErrorCoordinatorDidDismiss:
+ (PaymentRequestErrorCoordinator*)coordinator {
+ void (^callback)() = coordinator.callback;
lpromero 2017/02/21 16:51:07 Nit: Use ProceduralBlock.
Moe 2017/02/21 22:56:14 Just to make sure, since the callback gets dealloc
Moe 2017/02/21 22:56:14 Done.
lpromero 2017/02/22 13:31:44 Interesting question. If you were using ARC, line
+
+ [_errorCoordinator stop];
+ _errorCoordinator.reset();
+
+ if (callback)
+ callback();
+}
+
#pragma mark - PaymentItemsDisplayCoordinatorDelegate
- (void)paymentItemsDisplayCoordinatorDidReturn:

Powered by Google App Engine
This is Rietveld 408576698