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" |
11 #include "components/payments/content/payment_request.mojom-blink.h" | 11 #include "components/payments/content/payment_request.mojom-blink.h" |
12 #include "core/dom/ContextLifecycleObserver.h" | 12 #include "core/dom/ContextLifecycleObserver.h" |
13 #include "core/events/EventTarget.h" | 13 #include "core/events/EventTarget.h" |
14 #include "modules/ModulesExport.h" | 14 #include "modules/ModulesExport.h" |
15 #include "modules/payments/PaymentCompleter.h" | 15 #include "modules/payments/PaymentCompleter.h" |
16 #include "modules/payments/PaymentDetails.h" | 16 #include "modules/payments/PaymentDetailsInit.h" |
please use gerrit instead
2017/03/22 17:14:01
No need to include it, because it's forward declar
zino
2017/03/27 13:15:13
Done.
| |
17 #include "modules/payments/PaymentMethodData.h" | 17 #include "modules/payments/PaymentMethodData.h" |
18 #include "modules/payments/PaymentOptions.h" | 18 #include "modules/payments/PaymentOptions.h" |
19 #include "modules/payments/PaymentUpdater.h" | 19 #include "modules/payments/PaymentUpdater.h" |
20 #include "mojo/public/cpp/bindings/binding.h" | 20 #include "mojo/public/cpp/bindings/binding.h" |
21 #include "platform/Timer.h" | 21 #include "platform/Timer.h" |
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 ExecutionContext; |
33 class PaymentAddress; | 33 class PaymentAddress; |
34 class PaymentDetailsInit; | |
34 class ScriptPromiseResolver; | 35 class ScriptPromiseResolver; |
35 class ScriptState; | 36 class ScriptState; |
36 | 37 |
37 class MODULES_EXPORT PaymentRequest final | 38 class MODULES_EXPORT PaymentRequest final |
38 : public EventTargetWithInlineData, | 39 : public EventTargetWithInlineData, |
39 NON_EXPORTED_BASE(public payments::mojom::blink::PaymentRequestClient), | 40 NON_EXPORTED_BASE(public payments::mojom::blink::PaymentRequestClient), |
40 public PaymentCompleter, | 41 public PaymentCompleter, |
41 public PaymentUpdater, | 42 public PaymentUpdater, |
42 public ContextLifecycleObserver, | 43 public ContextLifecycleObserver, |
43 public ActiveScriptWrappable<PaymentRequest> { | 44 public ActiveScriptWrappable<PaymentRequest> { |
44 DEFINE_WRAPPERTYPEINFO(); | 45 DEFINE_WRAPPERTYPEINFO(); |
45 USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest) | 46 USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest) |
46 WTF_MAKE_NONCOPYABLE(PaymentRequest); | 47 WTF_MAKE_NONCOPYABLE(PaymentRequest); |
47 | 48 |
48 public: | 49 public: |
49 static PaymentRequest* create(ExecutionContext*, | 50 static PaymentRequest* create(ExecutionContext*, |
50 const HeapVector<PaymentMethodData>&, | 51 const HeapVector<PaymentMethodData>&, |
51 const PaymentDetails&, | 52 const PaymentDetailsInit&, |
52 ExceptionState&); | 53 ExceptionState&); |
53 static PaymentRequest* create(ExecutionContext*, | 54 static PaymentRequest* create(ExecutionContext*, |
54 const HeapVector<PaymentMethodData>&, | 55 const HeapVector<PaymentMethodData>&, |
55 const PaymentDetails&, | 56 const PaymentDetailsInit&, |
56 const PaymentOptions&, | 57 const PaymentOptions&, |
57 ExceptionState&); | 58 ExceptionState&); |
58 | 59 |
59 virtual ~PaymentRequest(); | 60 virtual ~PaymentRequest(); |
60 | 61 |
61 ScriptPromise show(ScriptState*); | 62 ScriptPromise show(ScriptState*); |
62 ScriptPromise abort(ScriptState*); | 63 ScriptPromise abort(ScriptState*); |
63 | 64 |
64 PaymentAddress* getShippingAddress() const { return m_shippingAddress.get(); } | 65 PaymentAddress* getShippingAddress() const { return m_shippingAddress.get(); } |
65 const String& shippingOption() const { return m_shippingOption; } | 66 const String& shippingOption() const { return m_shippingOption; } |
(...skipping 18 matching lines...) Expand all Loading... | |
84 void onUpdatePaymentDetails(const ScriptValue& detailsScriptValue) override; | 85 void onUpdatePaymentDetails(const ScriptValue& detailsScriptValue) override; |
85 void onUpdatePaymentDetailsFailure(const String& error) override; | 86 void onUpdatePaymentDetailsFailure(const String& error) override; |
86 | 87 |
87 DECLARE_TRACE(); | 88 DECLARE_TRACE(); |
88 | 89 |
89 void onCompleteTimeoutForTesting(); | 90 void onCompleteTimeoutForTesting(); |
90 | 91 |
91 private: | 92 private: |
92 PaymentRequest(ExecutionContext*, | 93 PaymentRequest(ExecutionContext*, |
93 const HeapVector<PaymentMethodData>&, | 94 const HeapVector<PaymentMethodData>&, |
94 const PaymentDetails&, | 95 const PaymentDetailsInit&, |
95 const PaymentOptions&, | 96 const PaymentOptions&, |
96 ExceptionState&); | 97 ExceptionState&); |
97 | 98 |
98 // LifecycleObserver: | 99 // LifecycleObserver: |
99 void contextDestroyed(ExecutionContext*) override; | 100 void contextDestroyed(ExecutionContext*) override; |
100 | 101 |
101 // payments::mojom::blink::PaymentRequestClient: | 102 // payments::mojom::blink::PaymentRequestClient: |
102 void OnShippingAddressChange( | 103 void OnShippingAddressChange( |
103 payments::mojom::blink::PaymentAddressPtr) override; | 104 payments::mojom::blink::PaymentAddressPtr) override; |
104 void OnShippingOptionChange(const String& shippingOptionId) override; | 105 void OnShippingOptionChange(const String& shippingOptionId) override; |
(...skipping 18 matching lines...) Expand all Loading... | |
123 Member<ScriptPromiseResolver> m_abortResolver; | 124 Member<ScriptPromiseResolver> m_abortResolver; |
124 Member<ScriptPromiseResolver> m_canMakePaymentResolver; | 125 Member<ScriptPromiseResolver> m_canMakePaymentResolver; |
125 payments::mojom::blink::PaymentRequestPtr m_paymentProvider; | 126 payments::mojom::blink::PaymentRequestPtr m_paymentProvider; |
126 mojo::Binding<payments::mojom::blink::PaymentRequestClient> m_clientBinding; | 127 mojo::Binding<payments::mojom::blink::PaymentRequestClient> m_clientBinding; |
127 TaskRunnerTimer<PaymentRequest> m_completeTimer; | 128 TaskRunnerTimer<PaymentRequest> m_completeTimer; |
128 }; | 129 }; |
129 | 130 |
130 } // namespace blink | 131 } // namespace blink |
131 | 132 |
132 #endif // PaymentRequest_h | 133 #endif // PaymentRequest_h |
OLD | NEW |