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..396f8f6a819696cd8df807a3579f718705bce07f 100644 |
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.h |
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.h |
@@ -9,9 +9,14 @@ |
#include "bindings/core/v8/ScriptValue.h" |
#include "bindings/core/v8/ScriptWrappable.h" |
#include "core/events/EventTarget.h" |
+#include "modules/ModulesExport.h" |
+#include "modules/payments/PaymentCompleter.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,12 +25,14 @@ |
namespace blink { |
class ExceptionState; |
+class ScriptPromiseResolver; |
class ScriptState; |
class ShippingAddress; |
-class PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest> { |
- REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PaymentRequest); |
+class MODULES_EXPORT PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest>, WTF_NON_EXPORTED_BASE(public mojom::wtf::PaymentRequestClient), public PaymentCompleter { |
DEFINE_WRAPPERTYPEINFO(); |
+ REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PaymentRequest); |
+ USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest) |
WTF_MAKE_NONCOPYABLE(PaymentRequest); |
public: |
@@ -36,7 +43,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 +55,21 @@ public: |
const AtomicString& interfaceName() const override; |
ExecutionContext* getExecutionContext() const override; |
+ // PaymentCompleter: |
+ ScriptPromise complete(ScriptState*, bool success) override; |
+ |
DECLARE_TRACE(); |
private: |
PaymentRequest(ScriptState*, const Vector<String>& supportedMethods, const PaymentDetails&, const PaymentOptions&, const ScriptValue& data, ExceptionState&); |
+ // 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 |