| 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/ui/payments/payment_request_manager.h" | 5 #import "ios/chrome/browser/ui/payments/payment_request_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/ios/block_types.h" | 9 #include "base/ios/block_types.h" |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| 11 #import "base/mac/bind_objc_block.h" | 11 #import "base/mac/bind_objc_block.h" |
| 12 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #import "base/values.h" | 17 #import "base/values.h" |
| 18 #include "components/autofill/core/browser/autofill_country.h" | 18 #include "components/autofill/core/browser/autofill_country.h" |
| 19 #include "components/autofill/core/browser/autofill_data_util.h" | 19 #include "components/autofill/core/browser/autofill_data_util.h" |
| 20 #include "components/autofill/core/browser/autofill_manager.h" | 20 #include "components/autofill/core/browser/autofill_manager.h" |
| 21 #include "components/autofill/core/browser/credit_card.h" | 21 #include "components/autofill/core/browser/credit_card.h" |
| 22 #include "components/autofill/core/browser/personal_data_manager.h" | 22 #include "components/autofill/core/browser/personal_data_manager.h" |
| 23 #include "components/autofill/ios/browser/autofill_driver_ios.h" | 23 #include "components/autofill/ios/browser/autofill_driver_ios.h" |
| 24 #include "components/payments/core/address_normalization_manager.h" | 24 #include "components/payments/core/address_normalization_manager.h" |
| 25 #include "components/payments/core/can_make_payment_query.h" | 25 #include "components/payments/core/can_make_payment_query.h" |
| 26 #include "components/payments/core/payment_address.h" | 26 #include "components/payments/core/payment_address.h" |
| 27 #include "components/payments/core/payment_prefs.h" |
| 27 #include "components/payments/core/payment_request_base_delegate.h" | 28 #include "components/payments/core/payment_request_base_delegate.h" |
| 28 #include "components/payments/core/payment_request_data_util.h" | 29 #include "components/payments/core/payment_request_data_util.h" |
| 30 #include "components/prefs/pref_service.h" |
| 29 #include "ios/chrome/browser/application_context.h" | 31 #include "ios/chrome/browser/application_context.h" |
| 30 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" | 32 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" |
| 31 #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h" | 33 #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h" |
| 32 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 34 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 33 #include "ios/chrome/browser/payments/ios_can_make_payment_query_factory.h" | 35 #include "ios/chrome/browser/payments/ios_can_make_payment_query_factory.h" |
| 34 #include "ios/chrome/browser/payments/payment_request.h" | 36 #include "ios/chrome/browser/payments/payment_request.h" |
| 35 #include "ios/chrome/browser/procedural_block_types.h" | 37 #include "ios/chrome/browser/procedural_block_types.h" |
| 36 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 38 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 37 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 39 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 38 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" | 40 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 } | 773 } |
| 772 | 774 |
| 773 if (_paymentRequest->request_payer_phone()) { | 775 if (_paymentRequest->request_payer_phone()) { |
| 774 paymentResponse.payer_phone = | 776 paymentResponse.payer_phone = |
| 775 _pendingPaymentResponse.contactAddress.GetRawInfo( | 777 _pendingPaymentResponse.contactAddress.GetRawInfo( |
| 776 autofill::PHONE_HOME_WHOLE_NUMBER); | 778 autofill::PHONE_HOME_WHOLE_NUMBER); |
| 777 } | 779 } |
| 778 | 780 |
| 779 _paymentRequest->RecordUseStats(); | 781 _paymentRequest->RecordUseStats(); |
| 780 | 782 |
| 783 _paymentRequest->GetPrefService()->SetBoolean( |
| 784 payments::kPaymentsFirstTransactionCompleted, true); |
| 785 |
| 781 [_paymentRequestJsManager | 786 [_paymentRequestJsManager |
| 782 resolveRequestPromiseWithPaymentResponse:paymentResponse | 787 resolveRequestPromiseWithPaymentResponse:paymentResponse |
| 783 completionHandler:nil]; | 788 completionHandler:nil]; |
| 784 [self setUnblockEventQueueTimer]; | 789 [self setUnblockEventQueueTimer]; |
| 785 [self setPaymentResponseTimeoutTimer]; | 790 [self setPaymentResponseTimeoutTimer]; |
| 786 } | 791 } |
| 787 | 792 |
| 788 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator | 793 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator |
| 789 didSelectShippingAddress: | 794 didSelectShippingAddress: |
| 790 (const autofill::AutofillProfile&)shippingAddress { | 795 (const autofill::AutofillProfile&)shippingAddress { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 809 #pragma mark - CRWWebStateObserver methods | 814 #pragma mark - CRWWebStateObserver methods |
| 810 | 815 |
| 811 - (void)webState:(web::WebState*)webState | 816 - (void)webState:(web::WebState*)webState |
| 812 didCommitNavigationWithDetails: | 817 didCommitNavigationWithDetails: |
| 813 (const web::LoadCommittedDetails&)load_details { | 818 (const web::LoadCommittedDetails&)load_details { |
| 814 [self dismissUI]; | 819 [self dismissUI]; |
| 815 [self enableCurrentWebState]; | 820 [self enableCurrentWebState]; |
| 816 } | 821 } |
| 817 | 822 |
| 818 @end | 823 @end |
| OLD | NEW |