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" |
11 #include "bindings/modules/v8/V8PaymentDetails.h" | 11 #include "bindings/modules/v8/V8PaymentDetails.h" |
12 #include "core/EventTypeNames.h" | 12 #include "core/EventTypeNames.h" |
13 #include "core/dom/DOMException.h" | 13 #include "core/dom/DOMException.h" |
14 #include "core/dom/ExceptionCode.h" | 14 #include "core/dom/ExceptionCode.h" |
15 #include "core/events/Event.h" | 15 #include "core/events/Event.h" |
16 #include "core/events/EventQueue.h" | 16 #include "core/events/EventQueue.h" |
17 #include "modules/EventTargetModulesNames.h" | 17 #include "modules/EventTargetModulesNames.h" |
18 #include "modules/payments/PaymentAddress.h" | 18 #include "modules/payments/PaymentAddress.h" |
19 #include "modules/payments/PaymentItem.h" | 19 #include "modules/payments/PaymentItem.h" |
20 #include "modules/payments/PaymentRequestUpdateEvent.h" | 20 #include "modules/payments/PaymentRequestUpdateEvent.h" |
21 #include "modules/payments/PaymentResponse.h" | 21 #include "modules/payments/PaymentResponse.h" |
22 #include "modules/payments/PaymentShippingOption.h" | 22 #include "modules/payments/PaymentShippingOption.h" |
23 #include "modules/payments/PaymentsValidators.h" | 23 #include "modules/payments/PaymentsValidators.h" |
24 #include "mojo/public/cpp/bindings/interface_request.h" | 24 #include "mojo/public/cpp/bindings/interface_request.h" |
25 #include "mojo/public/cpp/bindings/wtf_array.h" | 25 #include "mojo/public/cpp/bindings/wtf_array.h" |
26 #include "platform/mojo/MojoHelper.h" | 26 #include "platform/mojo/MojoHelper.h" |
27 #include "public/platform/InterfaceProvider.h" | 27 #include "public/platform/InterfaceProvider.h" |
28 #include "public/platform/WebTraceLocation.h" | |
please use gerrit instead
2016/08/08 16:35:58
Why was this include added?
pals
2016/08/09 01:53:09
Its for the BLINK_FROM_HERE.
| |
28 #include "wtf/HashSet.h" | 29 #include "wtf/HashSet.h" |
29 #include <utility> | 30 #include <utility> |
30 | 31 |
31 namespace mojo { | 32 namespace mojo { |
32 | 33 |
33 using blink::mojom::blink::PaymentCurrencyAmount; | 34 using blink::mojom::blink::PaymentCurrencyAmount; |
34 using blink::mojom::blink::PaymentCurrencyAmountPtr; | 35 using blink::mojom::blink::PaymentCurrencyAmountPtr; |
35 using blink::mojom::blink::PaymentDetails; | 36 using blink::mojom::blink::PaymentDetails; |
36 using blink::mojom::blink::PaymentDetailsModifier; | 37 using blink::mojom::blink::PaymentDetailsModifier; |
37 using blink::mojom::blink::PaymentDetailsModifierPtr; | 38 using blink::mojom::blink::PaymentDetailsModifierPtr; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 visitor->trace(m_shippingAddress); | 482 visitor->trace(m_shippingAddress); |
482 visitor->trace(m_showResolver); | 483 visitor->trace(m_showResolver); |
483 visitor->trace(m_completeResolver); | 484 visitor->trace(m_completeResolver); |
484 visitor->trace(m_abortResolver); | 485 visitor->trace(m_abortResolver); |
485 EventTargetWithInlineData::trace(visitor); | 486 EventTargetWithInlineData::trace(visitor); |
486 ContextLifecycleObserver::trace(visitor); | 487 ContextLifecycleObserver::trace(visitor); |
487 } | 488 } |
488 | 489 |
489 void PaymentRequest::onCompleteTimeoutForTesting() | 490 void PaymentRequest::onCompleteTimeoutForTesting() |
490 { | 491 { |
492 m_completeTimer.stop(); | |
491 onCompleteTimeout(0); | 493 onCompleteTimeout(0); |
492 } | 494 } |
493 | 495 |
494 PaymentRequest::PaymentRequest(ScriptState* scriptState, const HeapVector<Paymen tMethodData>& methodData, const PaymentDetails& details, const PaymentOptions& o ptions, ExceptionState& exceptionState) | 496 PaymentRequest::PaymentRequest(ScriptState* scriptState, const HeapVector<Paymen tMethodData>& methodData, const PaymentDetails& details, const PaymentOptions& o ptions, ExceptionState& exceptionState) |
495 : ContextLifecycleObserver(scriptState->getExecutionContext()) | 497 : ContextLifecycleObserver(scriptState->getExecutionContext()) |
496 , ActiveScriptWrappable(this) | 498 , ActiveScriptWrappable(this) |
497 , m_options(options) | 499 , m_options(options) |
498 , m_clientBinding(this) | 500 , m_clientBinding(this) |
499 , m_completeTimer(this, &PaymentRequest::onCompleteTimeout) | 501 , m_completeTimer(this, &PaymentRequest::onCompleteTimeout) |
500 { | 502 { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 return; | 681 return; |
680 } | 682 } |
681 | 683 |
682 m_showResolver->reject(DOMException::create(AbortError)); | 684 m_showResolver->reject(DOMException::create(AbortError)); |
683 m_abortResolver->resolve(); | 685 m_abortResolver->resolve(); |
684 clearResolversAndCloseMojoConnection(); | 686 clearResolversAndCloseMojoConnection(); |
685 } | 687 } |
686 | 688 |
687 void PaymentRequest::onCompleteTimeout(TimerBase*) | 689 void PaymentRequest::onCompleteTimeout(TimerBase*) |
688 { | 690 { |
689 m_completeTimer.stop(); | |
690 m_paymentProvider->Complete(mojom::blink::PaymentComplete(Fail)); | 691 m_paymentProvider->Complete(mojom::blink::PaymentComplete(Fail)); |
691 clearResolversAndCloseMojoConnection(); | 692 clearResolversAndCloseMojoConnection(); |
692 } | 693 } |
693 | 694 |
694 void PaymentRequest::clearResolversAndCloseMojoConnection() | 695 void PaymentRequest::clearResolversAndCloseMojoConnection() |
695 { | 696 { |
696 m_completeResolver.clear(); | 697 m_completeResolver.clear(); |
697 m_showResolver.clear(); | 698 m_showResolver.clear(); |
698 m_abortResolver.clear(); | 699 m_abortResolver.clear(); |
699 if (m_clientBinding.is_bound()) | 700 if (m_clientBinding.is_bound()) |
700 m_clientBinding.Close(); | 701 m_clientBinding.Close(); |
701 m_paymentProvider.reset(); | 702 m_paymentProvider.reset(); |
702 } | 703 } |
703 | 704 |
704 } // namespace blink | 705 } // namespace blink |
OLD | NEW |