| 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 #ifndef PaymentRequest_h | 5 #ifndef PaymentRequest_h |
| 6 #define PaymentRequest_h | 6 #define PaymentRequest_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "platform/heap/Handle.h" | 22 #include "platform/heap/Handle.h" |
| 23 #include "wtf/Compiler.h" | 23 #include "wtf/Compiler.h" |
| 24 #include "wtf/Noncopyable.h" | 24 #include "wtf/Noncopyable.h" |
| 25 #include "wtf/RefPtr.h" | 25 #include "wtf/RefPtr.h" |
| 26 #include "wtf/Vector.h" | 26 #include "wtf/Vector.h" |
| 27 #include "wtf/text/WTFString.h" | 27 #include "wtf/text/WTFString.h" |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 class ExceptionState; | 31 class ExceptionState; |
| 32 class ExecutionContext; |
| 32 class PaymentAddress; | 33 class PaymentAddress; |
| 33 class ScriptPromiseResolver; | 34 class ScriptPromiseResolver; |
| 34 class ScriptState; | 35 class ScriptState; |
| 35 | 36 |
| 36 class MODULES_EXPORT PaymentRequest final | 37 class MODULES_EXPORT PaymentRequest final |
| 37 : public EventTargetWithInlineData, | 38 : public EventTargetWithInlineData, |
| 38 NON_EXPORTED_BASE(public payments::mojom::blink::PaymentRequestClient), | 39 NON_EXPORTED_BASE(public payments::mojom::blink::PaymentRequestClient), |
| 39 public PaymentCompleter, | 40 public PaymentCompleter, |
| 40 public PaymentUpdater, | 41 public PaymentUpdater, |
| 41 public ContextLifecycleObserver, | 42 public ContextLifecycleObserver, |
| 42 public ActiveScriptWrappable<PaymentRequest> { | 43 public ActiveScriptWrappable<PaymentRequest> { |
| 43 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
| 44 USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest) | 45 USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest) |
| 45 WTF_MAKE_NONCOPYABLE(PaymentRequest); | 46 WTF_MAKE_NONCOPYABLE(PaymentRequest); |
| 46 | 47 |
| 47 public: | 48 public: |
| 48 static PaymentRequest* create(Document&, | 49 static PaymentRequest* create(ExecutionContext*, |
| 49 const HeapVector<PaymentMethodData>&, | 50 const HeapVector<PaymentMethodData>&, |
| 50 const PaymentDetails&, | 51 const PaymentDetails&, |
| 51 ExceptionState&); | 52 ExceptionState&); |
| 52 static PaymentRequest* create(Document&, | 53 static PaymentRequest* create(ExecutionContext*, |
| 53 const HeapVector<PaymentMethodData>&, | 54 const HeapVector<PaymentMethodData>&, |
| 54 const PaymentDetails&, | 55 const PaymentDetails&, |
| 55 const PaymentOptions&, | 56 const PaymentOptions&, |
| 56 ExceptionState&); | 57 ExceptionState&); |
| 57 | 58 |
| 58 virtual ~PaymentRequest(); | 59 virtual ~PaymentRequest(); |
| 59 | 60 |
| 60 ScriptPromise show(ScriptState*); | 61 ScriptPromise show(ScriptState*); |
| 61 ScriptPromise abort(ScriptState*); | 62 ScriptPromise abort(ScriptState*); |
| 62 | 63 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 81 | 82 |
| 82 // PaymentUpdater: | 83 // PaymentUpdater: |
| 83 void onUpdatePaymentDetails(const ScriptValue& detailsScriptValue) override; | 84 void onUpdatePaymentDetails(const ScriptValue& detailsScriptValue) override; |
| 84 void onUpdatePaymentDetailsFailure(const String& error) override; | 85 void onUpdatePaymentDetailsFailure(const String& error) override; |
| 85 | 86 |
| 86 DECLARE_TRACE(); | 87 DECLARE_TRACE(); |
| 87 | 88 |
| 88 void onCompleteTimeoutForTesting(); | 89 void onCompleteTimeoutForTesting(); |
| 89 | 90 |
| 90 private: | 91 private: |
| 91 PaymentRequest(Document&, | 92 PaymentRequest(ExecutionContext*, |
| 92 const HeapVector<PaymentMethodData>&, | 93 const HeapVector<PaymentMethodData>&, |
| 93 const PaymentDetails&, | 94 const PaymentDetails&, |
| 94 const PaymentOptions&, | 95 const PaymentOptions&, |
| 95 ExceptionState&); | 96 ExceptionState&); |
| 96 | 97 |
| 97 // LifecycleObserver: | 98 // LifecycleObserver: |
| 98 void contextDestroyed(ExecutionContext*) override; | 99 void contextDestroyed(ExecutionContext*) override; |
| 99 | 100 |
| 100 // payments::mojom::blink::PaymentRequestClient: | 101 // payments::mojom::blink::PaymentRequestClient: |
| 101 void OnShippingAddressChange( | 102 void OnShippingAddressChange( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 122 Member<ScriptPromiseResolver> m_abortResolver; | 123 Member<ScriptPromiseResolver> m_abortResolver; |
| 123 Member<ScriptPromiseResolver> m_canMakePaymentResolver; | 124 Member<ScriptPromiseResolver> m_canMakePaymentResolver; |
| 124 payments::mojom::blink::PaymentRequestPtr m_paymentProvider; | 125 payments::mojom::blink::PaymentRequestPtr m_paymentProvider; |
| 125 mojo::Binding<payments::mojom::blink::PaymentRequestClient> m_clientBinding; | 126 mojo::Binding<payments::mojom::blink::PaymentRequestClient> m_clientBinding; |
| 126 TaskRunnerTimer<PaymentRequest> m_completeTimer; | 127 TaskRunnerTimer<PaymentRequest> m_completeTimer; |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 } // namespace blink | 130 } // namespace blink |
| 130 | 131 |
| 131 #endif // PaymentRequest_h | 132 #endif // PaymentRequest_h |
| OLD | NEW |