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

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

Issue 2804853002: Cancels payment request when Settings is tapped, and opens the Autofill settings page. (Closed)
Patch Set: Rebase and Addresses comments from mahmadi@. Created 3 years, 8 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_manager.mm
diff --git a/ios/chrome/browser/payments/payment_request_manager.mm b/ios/chrome/browser/payments/payment_request_manager.mm
index 56fbab0920d246eafb29f94aee59d5d5677583bf..bbf9749a5220eeadeb66ef1e9d6dfdfe0534d394 100644
--- a/ios/chrome/browser/payments/payment_request_manager.mm
+++ b/ios/chrome/browser/payments/payment_request_manager.mm
@@ -21,6 +21,9 @@
#include "ios/chrome/browser/payments/payment_request.h"
#import "ios/chrome/browser/payments/payment_request_coordinator.h"
#include "ios/chrome/browser/procedural_block_types.h"
+#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
+#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
+#import "ios/chrome/browser/ui/commands/ios_command_ids.h"
#include "ios/web/public/favicon_status.h"
#include "ios/web/public/navigation_item.h"
#include "ios/web/public/navigation_manager.h"
@@ -48,6 +51,9 @@ const NSTimeInterval kNoopInterval = 0.1;
// PaymentResponse.complete().
const NSTimeInterval kTimeoutInterval = 60.0;
+NSString* kAbortMessage = @"The payment request was aborted.";
+NSString* kCancelMessage = @"The payment request was canceled.";
+
} // namespace
@interface PaymentRequestManager ()<CRWWebStateObserver,
@@ -225,8 +231,7 @@ const NSTimeInterval kTimeoutInterval = 60.0;
}
- (void)cancelRequest {
- [self terminateRequestWithErrorMessage:@"The payment request was canceled."
- callback:nil];
+ [self terminateRequestWithErrorMessage:kCancelMessage callback:nil];
}
- (void)terminateRequestWithErrorMessage:(NSString*)errorMessage
@@ -387,9 +392,8 @@ const NSTimeInterval kTimeoutInterval = 60.0;
// Early return if the manager has been deallocated.
if (!strongSelf)
return;
- [strongSelf
- terminateRequestWithErrorMessage:@"The payment request was aborted."
- callback:cancellationCallback];
+ [strongSelf terminateRequestWithErrorMessage:kAbortMessage
marq (ping after 24h) 2017/04/06 15:16:45 Delete lines 391-394 and just call the method on w
macourteau 2017/04/06 15:24:00 Done.
+ callback:cancellationCallback];
};
[_paymentRequestCoordinator displayErrorWithCallback:callback];
@@ -410,9 +414,7 @@ const NSTimeInterval kTimeoutInterval = 60.0;
// Early return if the manager has been deallocated.
if (!strongSelf)
return;
- [strongSelf
- terminateRequestWithErrorMessage:@"The payment request was canceled."
- callback:nil];
+ [strongSelf terminateRequestWithErrorMessage:kCancelMessage callback:nil];
marq (ping after 24h) 2017/04/06 15:16:45 Delete lines 413-416 and just call the method on w
macourteau 2017/04/06 15:23:59 Done.
};
[_paymentRequestCoordinator displayErrorWithCallback:callback];
@@ -535,8 +537,20 @@ const NSTimeInterval kTimeoutInterval = 60.0;
- (void)paymentRequestCoordinatorDidCancel:
(PaymentRequestCoordinator*)coordinator {
- [self terminateRequestWithErrorMessage:@"The payment request was canceled."
- callback:nil];
+ [self terminateRequestWithErrorMessage:kCancelMessage callback:nil];
+}
+
+- (void)paymentRequestCoordinatorDidSelectSettings:
+ (PaymentRequestCoordinator*)coordinator {
+ ProceduralBlockWithBool callback = ^(BOOL) {
+ UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow];
+ DCHECK(mainWindow);
+ GenericChromeCommand* command =
+ [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_AUTOFILL_SETTINGS];
+ [mainWindow chromeExecuteCommand:command];
+ };
+
+ [self terminateRequestWithErrorMessage:kCancelMessage callback:callback];
}
- (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator

Powered by Google App Engine
This is Rietveld 408576698