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 PaymentRequestEvent_h | 5 #ifndef PaymentRequestEvent_h |
6 #define PaymentRequestEvent_h | 6 #define PaymentRequestEvent_h |
7 | 7 |
| 8 #include "bindings/core/v8/ScriptValue.h" |
8 #include "modules/EventModules.h" | 9 #include "modules/EventModules.h" |
9 #include "modules/payments/PaymentRequestEventInit.h" | 10 #include "modules/payments/PaymentRequestEventInit.h" |
10 #include "modules/serviceworkers/ExtendableEvent.h" | 11 #include "modules/serviceworkers/ExtendableEvent.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 | 13 |
13 namespace WTF { | 14 namespace WTF { |
14 class AtomicString; | 15 class AtomicString; |
15 } | 16 } |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class RespondWithObserver; | 20 class RespondWithObserver; |
| 21 class ScriptState; |
20 | 22 |
21 class MODULES_EXPORT PaymentRequestEvent final : public ExtendableEvent { | 23 class MODULES_EXPORT PaymentRequestEvent final : public ExtendableEvent { |
22 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
23 WTF_MAKE_NONCOPYABLE(PaymentRequestEvent); | 25 WTF_MAKE_NONCOPYABLE(PaymentRequestEvent); |
24 | 26 |
25 public: | 27 public: |
26 static PaymentRequestEvent* Create(const AtomicString& type, | 28 static PaymentRequestEvent* Create(const AtomicString& type, |
27 const PaymentRequestEventInit&); | 29 const PaymentRequestEventInit&); |
28 static PaymentRequestEvent* Create(const AtomicString& type, | 30 static PaymentRequestEvent* Create(const AtomicString& type, |
29 const PaymentRequestEventInit&, | 31 const PaymentRequestEventInit&, |
30 RespondWithObserver*, | 32 RespondWithObserver*, |
31 WaitUntilObserver*); | 33 WaitUntilObserver*); |
32 ~PaymentRequestEvent() override; | 34 ~PaymentRequestEvent() override; |
33 | 35 |
34 const AtomicString& InterfaceName() const override; | 36 const AtomicString& InterfaceName() const override; |
35 | 37 |
36 const String& topLevelOrigin() const; | 38 const String& topLevelOrigin() const; |
37 const String& paymentRequestOrigin() const; | 39 const String& paymentRequestOrigin() const; |
38 const String& paymentRequestId() const; | 40 const String& paymentRequestId() const; |
39 const HeapVector<PaymentMethodData>& methodData() const; | 41 const HeapVector<PaymentMethodData>& methodData() const; |
40 void total(PaymentItem& value) const; | 42 const ScriptValue total(ScriptState*) const; |
41 const HeapVector<PaymentDetailsModifier>& modifiers() const; | 43 const HeapVector<PaymentDetailsModifier>& modifiers() const; |
42 const String& instrumentKey() const; | 44 const String& instrumentKey() const; |
43 | 45 |
44 ScriptPromise openWindow(ScriptState*, const String& url); | 46 ScriptPromise openWindow(ScriptState*, const String& url); |
45 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); | 47 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); |
46 | 48 |
47 DECLARE_VIRTUAL_TRACE(); | 49 DECLARE_VIRTUAL_TRACE(); |
48 | 50 |
49 private: | 51 private: |
50 PaymentRequestEvent(const AtomicString& type, | 52 PaymentRequestEvent(const AtomicString& type, |
51 const PaymentRequestEventInit&, | 53 const PaymentRequestEventInit&, |
52 RespondWithObserver*, | 54 RespondWithObserver*, |
53 WaitUntilObserver*); | 55 WaitUntilObserver*); |
54 | 56 |
55 String top_level_origin_; | 57 String top_level_origin_; |
56 String payment_request_origin_; | 58 String payment_request_origin_; |
57 String payment_request_id_; | 59 String payment_request_id_; |
58 HeapVector<PaymentMethodData> method_data_; | 60 HeapVector<PaymentMethodData> method_data_; |
59 PaymentItem total_; | 61 PaymentItem total_; |
60 HeapVector<PaymentDetailsModifier> modifiers_; | 62 HeapVector<PaymentDetailsModifier> modifiers_; |
61 String instrument_key_; | 63 String instrument_key_; |
62 | 64 |
63 Member<RespondWithObserver> observer_; | 65 Member<RespondWithObserver> observer_; |
64 }; | 66 }; |
65 | 67 |
66 } // namespace blink | 68 } // namespace blink |
67 | 69 |
68 #endif // PaymentRequestEvent_h | 70 #endif // PaymentRequestEvent_h |
OLD | NEW |