Chromium Code Reviews| Index: third_party/WebKit/Source/modules/payments/PaymentRequest.h |
| diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.h b/third_party/WebKit/Source/modules/payments/PaymentRequest.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5eff7d2fd5a398c9d42818df926cc116c30ab8a5 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PaymentRequest_h |
| +#define PaymentRequest_h |
| + |
| +#include "bindings/core/v8/ScriptPromise.h" |
| +#include "bindings/core/v8/ScriptValue.h" |
| +#include "bindings/core/v8/ScriptWrappable.h" |
| +#include "core/dom/ContextLifecycleObserver.h" |
| +#include "core/events/EventTarget.h" |
| +#include "modules/payments/PaymentDetails.h" |
| +#include "modules/payments/PaymentOptions.h" |
| +#include "modules/payments/ShippingAddress.h" |
| +#include "platform/heap/Handle.h" |
| +#include "wtf/Noncopyable.h" |
| +#include "wtf/Vector.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace blink { |
| + |
| +class ExceptionState; |
| +class ExecutionContext; |
| +class ScriptState; |
| + |
| +class PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest>, public ContextLifecycleObserver { |
|
haraken
2016/03/01 02:33:47
I don't think PaymentRequest needs to be a Context
please use gerrit instead
2016/03/02 00:32:53
Done.
|
| + REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PaymentRequest); |
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest); |
| + DEFINE_WRAPPERTYPEINFO(); |
| + WTF_MAKE_NONCOPYABLE(PaymentRequest); |
| + |
| +public: |
| + static PaymentRequest* create(ExecutionContext*, const Vector<String>& supportedMethods, const PaymentDetails&, ExceptionState&); |
| + static PaymentRequest* create(ExecutionContext*, const Vector<String>& supportedMethods, const PaymentDetails&, const PaymentOptions&, ExceptionState&); |
| + static PaymentRequest* create(ExecutionContext*, const Vector<String>& supportedMethods, const PaymentDetails&, const PaymentOptions&, const ScriptValue& data, ExceptionState&); |
| + |
| + virtual ~PaymentRequest(); |
| + |
| + ScriptPromise show(ScriptState*); |
| + void abort(); |
| + |
| + ShippingAddress* shippingAddress() const { return m_shippingAddress.get(); } |
| + const String& shippingOption() const { return m_shippingOption; } |
| + |
| + DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingaddresschange); |
| + DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingoptionchange); |
| + |
| + // EventTargetWithInlineData: |
| + const AtomicString& interfaceName() const override; |
| + ExecutionContext* executionContext() const override; |
| + |
| + DECLARE_TRACE(); |
| + |
| +private: |
| + PaymentRequest(ExecutionContext*, const Vector<String>& supportedMethods, const PaymentDetails&, const PaymentOptions&, const ScriptValue& data, ExceptionState&); |
| + |
| + Vector<String> m_supportedMethods; |
| + PaymentDetails m_details; |
| + PaymentOptions m_options; |
| + String m_stringifiedData; |
| + Member<ShippingAddress> m_shippingAddress; |
| + String m_shippingOption; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // PaymentRequest_h |