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 |
| index 2e07114bd25b6b2d33220c40dd4372167f3918cd..d7c92cb7041e4cbb33bbd0b2b87908a4e2549a00 100644 |
| --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.h |
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.h |
| @@ -9,9 +9,13 @@ |
| #include "bindings/core/v8/ScriptValue.h" |
| #include "bindings/core/v8/ScriptWrappable.h" |
| #include "core/events/EventTarget.h" |
| +#include "modules/ModulesExport.h" |
| #include "modules/payments/PaymentDetails.h" |
| #include "modules/payments/PaymentOptions.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| #include "platform/heap/Handle.h" |
| +#include "public/platform/modules/payments/payment_request.mojom-wtf.h" |
| +#include "wtf/Compiler.h" |
| #include "wtf/Noncopyable.h" |
| #include "wtf/RefPtr.h" |
| #include "wtf/Vector.h" |
| @@ -20,10 +24,11 @@ |
| namespace blink { |
| class ExceptionState; |
| +class ScriptPromiseResolver; |
| class ScriptState; |
| class ShippingAddress; |
| -class PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest> { |
| +class MODULES_EXPORT PaymentRequest : public RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest> , WTF_NON_EXPORTED_BASE(public mojom::wtf::PaymentRequestClient) { |
|
esprehn
2016/03/25 23:40:11
why not final? I'm not a big fan of un-finaling fo
please use gerrit instead
2016/03/29 22:15:45
Extracted complete() into a pure virtual interface
|
| REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PaymentRequest); |
| DEFINE_WRAPPERTYPEINFO(); |
| WTF_MAKE_NONCOPYABLE(PaymentRequest); |
| @@ -36,7 +41,7 @@ public: |
| virtual ~PaymentRequest(); |
| ScriptPromise show(ScriptState*); |
| - void abort(); |
| + void abort(ExceptionState&); |
| ShippingAddress* getShippingAddress() const { return m_shippingAddress.get(); } |
| const String& shippingOption() const { return m_shippingOption; } |
| @@ -48,11 +53,23 @@ public: |
| const AtomicString& interfaceName() const override; |
| ExecutionContext* getExecutionContext() const override; |
| + // Overridden in tests. |
| + virtual ScriptPromise complete(ScriptState*, bool success); |
| + |
| DECLARE_TRACE(); |
| -private: |
| +protected: |
| + // Used by mock objects in tests. |
| PaymentRequest(ScriptState*, const Vector<String>& supportedMethods, const PaymentDetails&, const PaymentOptions&, const ScriptValue& data, ExceptionState&); |
| +private: |
| + // mojom::wtf::PaymentRequestClient: |
| + void OnShippingAddressChange(mojom::wtf::ShippingAddressPtr) override; |
| + void OnShippingOptionChange(const String& shippingOptionId) override; |
| + void OnPaymentResponse(mojom::wtf::PaymentResponsePtr) override; |
| + void OnError() override; |
| + void OnComplete() override; |
| + |
| RefPtr<ScriptState> m_scriptState; |
| Vector<String> m_supportedMethods; |
| PaymentDetails m_details; |
| @@ -60,6 +77,10 @@ private: |
| String m_stringifiedData; |
| Member<ShippingAddress> m_shippingAddress; |
| String m_shippingOption; |
| + Member<ScriptPromiseResolver> m_showResolver; |
| + Member<ScriptPromiseResolver> m_completeResolver; |
| + mojom::wtf::PaymentRequestPtr m_paymentProvider; |
| + mojo::Binding<mojom::wtf::PaymentRequestClient> m_clientBinding; |
| }; |
| } // namespace blink |