| 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 #include "modules/payments/PaymentRequest.h" | 5 #include "modules/payments/PaymentRequest.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8StringResource.h" | 10 #include "bindings/core/v8/V8StringResource.h" |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 mojo::MakeRequest(&m_paymentProvider)); | 794 mojo::MakeRequest(&m_paymentProvider)); |
| 795 m_paymentProvider.set_connection_error_handler(convertToBaseCallback( | 795 m_paymentProvider.set_connection_error_handler(convertToBaseCallback( |
| 796 WTF::bind(&PaymentRequest::OnError, wrapWeakPersistent(this), | 796 WTF::bind(&PaymentRequest::OnError, wrapWeakPersistent(this), |
| 797 PaymentErrorReason::UNKNOWN))); | 797 PaymentErrorReason::UNKNOWN))); |
| 798 m_paymentProvider->Init( | 798 m_paymentProvider->Init( |
| 799 m_clientBinding.CreateInterfacePtrAndBind(), | 799 m_clientBinding.CreateInterfacePtrAndBind(), |
| 800 std::move(validatedMethodData), std::move(validatedDetails), | 800 std::move(validatedMethodData), std::move(validatedDetails), |
| 801 payments::mojom::blink::PaymentOptions::From(m_options)); | 801 payments::mojom::blink::PaymentOptions::From(m_options)); |
| 802 } | 802 } |
| 803 | 803 |
| 804 void PaymentRequest::contextDestroyed() { | 804 void PaymentRequest::contextDestroyed(ExecutionContext*) { |
| 805 clearResolversAndCloseMojoConnection(); | 805 clearResolversAndCloseMojoConnection(); |
| 806 } | 806 } |
| 807 | 807 |
| 808 void PaymentRequest::OnShippingAddressChange(PaymentAddressPtr address) { | 808 void PaymentRequest::OnShippingAddressChange(PaymentAddressPtr address) { |
| 809 DCHECK(m_showResolver); | 809 DCHECK(m_showResolver); |
| 810 DCHECK(!m_completeResolver); | 810 DCHECK(!m_completeResolver); |
| 811 | 811 |
| 812 String errorMessage; | 812 String errorMessage; |
| 813 if (!PaymentsValidators::isValidShippingAddress(address, &errorMessage)) { | 813 if (!PaymentsValidators::isValidShippingAddress(address, &errorMessage)) { |
| 814 m_showResolver->reject(DOMException::create(SyntaxError, errorMessage)); | 814 m_showResolver->reject(DOMException::create(SyntaxError, errorMessage)); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 m_completeResolver.clear(); | 997 m_completeResolver.clear(); |
| 998 m_showResolver.clear(); | 998 m_showResolver.clear(); |
| 999 m_abortResolver.clear(); | 999 m_abortResolver.clear(); |
| 1000 m_canMakePaymentResolver.clear(); | 1000 m_canMakePaymentResolver.clear(); |
| 1001 if (m_clientBinding.is_bound()) | 1001 if (m_clientBinding.is_bound()) |
| 1002 m_clientBinding.Close(); | 1002 m_clientBinding.Close(); |
| 1003 m_paymentProvider.reset(); | 1003 m_paymentProvider.reset(); |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 } // namespace blink | 1006 } // namespace blink |
| OLD | NEW |