OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PaymentRequest_h |
| 6 #define PaymentRequest_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "core/dom/ActiveDOMObject.h" |
| 12 #include "core/events/EventTarget.h" |
| 13 #include "modules/payments/PaymentDetails.h" |
| 14 #include "modules/payments/PaymentOptions.h" |
| 15 #include "modules/payments/ShippingAddress.h" |
| 16 #include "platform/heap/Handle.h" |
| 17 #include "wtf/Noncopyable.h" |
| 18 #include "wtf/Vector.h" |
| 19 #include "wtf/text/WTFString.h" |
| 20 |
| 21 namespace blink { |
| 22 |
| 23 class ExecutionContext; |
| 24 class ScriptState; |
| 25 |
| 26 class PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInl
ineData<PaymentRequest>, public ActiveDOMObject { |
| 27 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PaymentRequest); |
| 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest); |
| 29 DEFINE_WRAPPERTYPEINFO(); |
| 30 WTF_MAKE_NONCOPYABLE(PaymentRequest); |
| 31 |
| 32 public: |
| 33 static PaymentRequest* create(ExecutionContext*, const Vector<String>& suppo
rtedMethods, const PaymentDetails&, const PaymentOptions& = PaymentOptions(), co
nst ScriptValue& data = ScriptValue()); |
| 34 |
| 35 virtual ~PaymentRequest(); |
| 36 |
| 37 ScriptPromise show(ScriptState*); |
| 38 void abort(); |
| 39 |
| 40 ShippingAddress* shippingAddress() const { return m_shippingAddress.get(); } |
| 41 const String& shippingOption() const { return m_shippingOption; } |
| 42 |
| 43 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingaddresschange); |
| 44 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingoptionchange); |
| 45 |
| 46 // EventTargetWithInlineData: |
| 47 const AtomicString& interfaceName() const override; |
| 48 ExecutionContext* executionContext() const override; |
| 49 |
| 50 DECLARE_TRACE(); |
| 51 |
| 52 private: |
| 53 PaymentRequest(ExecutionContext*, const Vector<String>& supportedMethods, co
nst PaymentDetails&, const PaymentOptions&, const ScriptValue& data); |
| 54 |
| 55 Vector<String> m_supportedMethods; |
| 56 PaymentDetails m_details; |
| 57 PaymentOptions m_options; |
| 58 String m_serializedData; |
| 59 Member<ShippingAddress> m_shippingAddress; |
| 60 String m_shippingOption; |
| 61 }; |
| 62 |
| 63 } // namespace blink |
| 64 |
| 65 #endif // PaymentRequest_h |
OLD | NEW |