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" |
11 #include "bindings/modules/v8/V8AndroidPayMethodData.h" | 11 #include "bindings/modules/v8/V8AndroidPayMethodData.h" |
12 #include "bindings/modules/v8/V8BasicCardRequest.h" | 12 #include "bindings/modules/v8/V8BasicCardRequest.h" |
13 #include "bindings/modules/v8/V8PaymentDetails.h" | 13 #include "bindings/modules/v8/V8PaymentDetails.h" |
14 #include "core/EventTypeNames.h" | 14 #include "core/EventTypeNames.h" |
15 #include "core/dom/DOMException.h" | 15 #include "core/dom/DOMException.h" |
16 #include "core/dom/ExceptionCode.h" | 16 #include "core/dom/ExceptionCode.h" |
| 17 #include "core/dom/TaskRunnerHelper.h" |
17 #include "core/events/Event.h" | 18 #include "core/events/Event.h" |
18 #include "core/events/EventQueue.h" | 19 #include "core/events/EventQueue.h" |
19 #include "core/frame/FrameOwner.h" | 20 #include "core/frame/FrameOwner.h" |
20 #include "core/html/HTMLIFrameElement.h" | 21 #include "core/html/HTMLIFrameElement.h" |
21 #include "modules/EventTargetModulesNames.h" | 22 #include "modules/EventTargetModulesNames.h" |
22 #include "modules/payments/AndroidPayMethodData.h" | 23 #include "modules/payments/AndroidPayMethodData.h" |
23 #include "modules/payments/AndroidPayTokenization.h" | 24 #include "modules/payments/AndroidPayTokenization.h" |
24 #include "modules/payments/BasicCardRequest.h" | 25 #include "modules/payments/BasicCardRequest.h" |
25 #include "modules/payments/HTMLIFrameElementPayments.h" | 26 #include "modules/payments/HTMLIFrameElementPayments.h" |
26 #include "modules/payments/PaymentAddress.h" | 27 #include "modules/payments/PaymentAddress.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 } | 749 } |
749 | 750 |
750 PaymentRequest::PaymentRequest(Document& document, | 751 PaymentRequest::PaymentRequest(Document& document, |
751 const HeapVector<PaymentMethodData>& methodData, | 752 const HeapVector<PaymentMethodData>& methodData, |
752 const PaymentDetails& details, | 753 const PaymentDetails& details, |
753 const PaymentOptions& options, | 754 const PaymentOptions& options, |
754 ExceptionState& exceptionState) | 755 ExceptionState& exceptionState) |
755 : ContextLifecycleObserver(&document), | 756 : ContextLifecycleObserver(&document), |
756 m_options(options), | 757 m_options(options), |
757 m_clientBinding(this), | 758 m_clientBinding(this), |
758 m_completeTimer(this, &PaymentRequest::onCompleteTimeout) { | 759 m_completeTimer( |
| 760 TaskRunnerHelper::get(TaskType::MiscPlatformAPI, document.frame()), |
| 761 this, |
| 762 &PaymentRequest::onCompleteTimeout) { |
759 Vector<payments::mojom::blink::PaymentMethodDataPtr> validatedMethodData; | 763 Vector<payments::mojom::blink::PaymentMethodDataPtr> validatedMethodData; |
760 validateAndConvertPaymentMethodData(methodData, validatedMethodData, | 764 validateAndConvertPaymentMethodData(methodData, validatedMethodData, |
761 exceptionState); | 765 exceptionState); |
762 if (exceptionState.hadException()) | 766 if (exceptionState.hadException()) |
763 return; | 767 return; |
764 | 768 |
765 if (!document.isSecureContext()) { | 769 if (!document.isSecureContext()) { |
766 exceptionState.throwSecurityError("Must be in a secure context"); | 770 exceptionState.throwSecurityError("Must be in a secure context"); |
767 return; | 771 return; |
768 } | 772 } |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 m_completeResolver.clear(); | 1001 m_completeResolver.clear(); |
998 m_showResolver.clear(); | 1002 m_showResolver.clear(); |
999 m_abortResolver.clear(); | 1003 m_abortResolver.clear(); |
1000 m_canMakePaymentResolver.clear(); | 1004 m_canMakePaymentResolver.clear(); |
1001 if (m_clientBinding.is_bound()) | 1005 if (m_clientBinding.is_bound()) |
1002 m_clientBinding.Close(); | 1006 m_clientBinding.Close(); |
1003 m_paymentProvider.reset(); | 1007 m_paymentProvider.reset(); |
1004 } | 1008 } |
1005 | 1009 |
1006 } // namespace blink | 1010 } // namespace blink |
OLD | NEW |