Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.h

Issue 1753543002: PaymentRequest Mojo bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface
Patch Set: haraken@'s + esprehn@'s comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3d6647d4334fe4ee138d9f4b8cc4454353f52dc6 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,24 @@ 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;
+
+ // Clears the promise resolvers and closes the Mojo connection.
+ void cleanUp();
+
RefPtr<ScriptState> m_scriptState;
Vector<String> m_supportedMethods;
PaymentDetails m_details;
@@ -60,6 +80,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

Powered by Google App Engine
This is Rietveld 408576698