Chromium Code Reviews| 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 |