| 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/JSONValuesForV8.h" | 8 #include "bindings/core/v8/JSONValuesForV8.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 632 |
| 633 scriptState->domWindow()->frame()->interfaceProvider()->getInterface( | 633 scriptState->domWindow()->frame()->interfaceProvider()->getInterface( |
| 634 mojo::GetProxy(&m_paymentProvider)); | 634 mojo::GetProxy(&m_paymentProvider)); |
| 635 m_paymentProvider.set_connection_error_handler(convertToBaseCallback( | 635 m_paymentProvider.set_connection_error_handler(convertToBaseCallback( |
| 636 WTF::bind(&PaymentRequest::OnError, wrapWeakPersistent(this), | 636 WTF::bind(&PaymentRequest::OnError, wrapWeakPersistent(this), |
| 637 mojom::blink::PaymentErrorReason::UNKNOWN))); | 637 mojom::blink::PaymentErrorReason::UNKNOWN))); |
| 638 m_paymentProvider->Init( | 638 m_paymentProvider->Init( |
| 639 m_clientBinding.CreateInterfacePtrAndBind(), | 639 m_clientBinding.CreateInterfacePtrAndBind(), |
| 640 mojo::WTFArray<mojom::blink::PaymentMethodDataPtr>::From( | 640 mojo::WTFArray<mojom::blink::PaymentMethodDataPtr>::From( |
| 641 validatedMethodData), | 641 validatedMethodData), |
| 642 maybeKeepShippingOptions(mojom::blink::PaymentDetails::From(details), | 642 maybeKeepShippingOptions( |
| 643 keepShippingOptions), | 643 mojom::blink::PaymentDetails::From(details), |
| 644 keepShippingOptions && m_options.requestShipping()), |
| 644 mojom::blink::PaymentOptions::From(m_options)); | 645 mojom::blink::PaymentOptions::From(m_options)); |
| 645 } | 646 } |
| 646 | 647 |
| 647 void PaymentRequest::contextDestroyed() { | 648 void PaymentRequest::contextDestroyed() { |
| 648 clearResolversAndCloseMojoConnection(); | 649 clearResolversAndCloseMojoConnection(); |
| 649 } | 650 } |
| 650 | 651 |
| 651 void PaymentRequest::OnShippingAddressChange( | 652 void PaymentRequest::OnShippingAddressChange( |
| 652 mojom::blink::PaymentAddressPtr address) { | 653 mojom::blink::PaymentAddressPtr address) { |
| 653 DCHECK(m_showResolver); | 654 DCHECK(m_showResolver); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 m_completeTimer.stop(); | 812 m_completeTimer.stop(); |
| 812 m_completeResolver.clear(); | 813 m_completeResolver.clear(); |
| 813 m_showResolver.clear(); | 814 m_showResolver.clear(); |
| 814 m_abortResolver.clear(); | 815 m_abortResolver.clear(); |
| 815 if (m_clientBinding.is_bound()) | 816 if (m_clientBinding.is_bound()) |
| 816 m_clientBinding.Close(); | 817 m_clientBinding.Close(); |
| 817 m_paymentProvider.reset(); | 818 m_paymentProvider.reset(); |
| 818 } | 819 } |
| 819 | 820 |
| 820 } // namespace blink | 821 } // namespace blink |
| OLD | NEW |