Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/payments/payment_request_manager.h" | 5 #import "ios/chrome/browser/payments/payment_request_manager.h" |
| 6 | 6 |
| 7 #include "base/ios/block_types.h" | 7 #include "base/ios/block_types.h" |
| 8 #include "base/ios/ios_util.h" | 8 #include "base/ios/ios_util.h" |
| 9 #import "base/mac/bind_objc_block.h" | 9 #import "base/mac/bind_objc_block.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| 11 #include "base/mac/scoped_nsobject.h" | |
| 11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 13 #import "base/values.h" | 14 #import "base/values.h" |
| 14 #include "components/autofill/core/browser/autofill_manager.h" | 15 #include "components/autofill/core/browser/autofill_manager.h" |
| 15 #include "components/autofill/core/browser/personal_data_manager.h" | 16 #include "components/autofill/core/browser/personal_data_manager.h" |
| 16 #include "components/autofill/ios/browser/autofill_driver_ios.h" | 17 #include "components/autofill/ios/browser/autofill_driver_ios.h" |
| 17 #include "components/payments/core/payment_address.h" | 18 #include "components/payments/core/payment_address.h" |
| 18 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" | 19 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" |
| 19 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 20 #import "ios/chrome/browser/payments/js_payment_request_manager.h" | 21 #import "ios/chrome/browser/payments/js_payment_request_manager.h" |
| 21 #include "ios/chrome/browser/payments/payment_request.h" | 22 #include "ios/chrome/browser/payments/payment_request.h" |
| 22 #import "ios/chrome/browser/payments/payment_request_coordinator.h" | 23 #import "ios/chrome/browser/payments/payment_request_coordinator.h" |
| 23 #include "ios/chrome/browser/procedural_block_types.h" | 24 #include "ios/chrome/browser/procedural_block_types.h" |
| 25 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | |
| 26 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | |
| 27 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" | |
| 24 #include "ios/web/public/favicon_status.h" | 28 #include "ios/web/public/favicon_status.h" |
| 25 #include "ios/web/public/navigation_item.h" | 29 #include "ios/web/public/navigation_item.h" |
| 26 #include "ios/web/public/navigation_manager.h" | 30 #include "ios/web/public/navigation_manager.h" |
| 27 #include "ios/web/public/payments/payment_request.h" | 31 #include "ios/web/public/payments/payment_request.h" |
| 28 #include "ios/web/public/ssl_status.h" | 32 #include "ios/web/public/ssl_status.h" |
| 29 #import "ios/web/public/url_scheme_util.h" | 33 #import "ios/web/public/url_scheme_util.h" |
| 30 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" | 34 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
| 31 #import "ios/web/public/web_state/ui/crw_web_view_proxy.h" | 35 #import "ios/web/public/web_state/ui/crw_web_view_proxy.h" |
| 32 #include "ios/web/public/web_state/url_verification_constants.h" | 36 #include "ios/web/public/web_state/url_verification_constants.h" |
| 33 #include "ios/web/public/web_state/web_state.h" | 37 #include "ios/web/public/web_state/web_state.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 } | 536 } |
| 533 | 537 |
| 534 #pragma mark - PaymentRequestCoordinatorDelegate methods | 538 #pragma mark - PaymentRequestCoordinatorDelegate methods |
| 535 | 539 |
| 536 - (void)paymentRequestCoordinatorDidCancel: | 540 - (void)paymentRequestCoordinatorDidCancel: |
| 537 (PaymentRequestCoordinator*)coordinator { | 541 (PaymentRequestCoordinator*)coordinator { |
| 538 [self terminateRequestWithErrorMessage:@"The payment request was canceled." | 542 [self terminateRequestWithErrorMessage:@"The payment request was canceled." |
| 539 callback:nil]; | 543 callback:nil]; |
| 540 } | 544 } |
| 541 | 545 |
| 546 - (void)paymentRequestCoordinatorDidSelectSettings: | |
| 547 (PaymentRequestCoordinator*)coordinator { | |
| 548 [self terminateRequestWithErrorMessage:@"The payment request was canceled." | |
|
Moe
2017/04/06 05:18:13
While you're at it, please refactor these messages
macourteau
2017/04/06 14:21:22
Done.
| |
| 549 callback:nil]; | |
|
Moe
2017/04/06 05:18:13
Could you do the following logic in a callback tha
macourteau
2017/04/06 14:21:22
Done.
| |
| 550 | |
| 551 UIWindow* main_window = [[UIApplication sharedApplication] keyWindow]; | |
|
Moe
2017/04/06 05:18:13
nit: mainWindow
macourteau
2017/04/06 14:21:22
Done.
| |
| 552 DCHECK(main_window); | |
| 553 base::scoped_nsobject<GenericChromeCommand> command( | |
|
Moe
2017/04/06 05:18:13
I believe you don't need a base::scoped_nsobject w
macourteau
2017/04/06 14:21:22
Done.
| |
| 554 [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_AUTOFILL_SETTINGS]); | |
| 555 [main_window chromeExecuteCommand:command]; | |
| 556 } | |
| 557 | |
| 542 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator | 558 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator |
| 543 didConfirmWithPaymentResponse:(web::PaymentResponse)paymentResponse { | 559 didConfirmWithPaymentResponse:(web::PaymentResponse)paymentResponse { |
| 544 [_paymentRequestJsManager | 560 [_paymentRequestJsManager |
| 545 resolveRequestPromiseWithPaymentResponse:paymentResponse | 561 resolveRequestPromiseWithPaymentResponse:paymentResponse |
| 546 completionHandler:nil]; | 562 completionHandler:nil]; |
| 547 [self setUnblockEventQueueTimer]; | 563 [self setUnblockEventQueueTimer]; |
| 548 [self setPaymentResponseTimeoutTimer]; | 564 [self setPaymentResponseTimeoutTimer]; |
| 549 } | 565 } |
| 550 | 566 |
| 551 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator | 567 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 569 - (void)webState:(web::WebState*)webState | 585 - (void)webState:(web::WebState*)webState |
| 570 didCommitNavigationWithDetails: | 586 didCommitNavigationWithDetails: |
| 571 (const web::LoadCommittedDetails&)load_details { | 587 (const web::LoadCommittedDetails&)load_details { |
| 572 [self dismissUI]; | 588 [self dismissUI]; |
| 573 _isScriptInjected = NO; | 589 _isScriptInjected = NO; |
| 574 [self enableCurrentWebState]; | 590 [self enableCurrentWebState]; |
| 575 [self initializeWebViewForPaymentRequest]; | 591 [self initializeWebViewForPaymentRequest]; |
| 576 } | 592 } |
| 577 | 593 |
| 578 @end | 594 @end |
| OLD | NEW |