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

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: Disable WTF-Mojo string serialization for now. 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..3a69e8a05ae22a23ec8aef8d006dade442285a78 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.h
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.h
@@ -11,7 +11,9 @@
#include "core/events/EventTarget.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-blink.h"
#include "wtf/Noncopyable.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
@@ -20,10 +22,11 @@
namespace blink {
class ExceptionState;
+class ScriptPromiseResolver;
class ScriptState;
class ShippingAddress;
-class PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest> {
+class PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest>, mojom::blink::PaymentRequestClient {
REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PaymentRequest);
DEFINE_WRAPPERTYPEINFO();
WTF_MAKE_NONCOPYABLE(PaymentRequest);
@@ -36,7 +39,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 +51,20 @@ public:
const AtomicString& interfaceName() const override;
ExecutionContext* getExecutionContext() const override;
+ ScriptPromise complete(ScriptState*, bool success);
+
DECLARE_TRACE();
private:
PaymentRequest(ScriptState*, const Vector<String>& supportedMethods, const PaymentDetails&, const PaymentOptions&, const ScriptValue& data, ExceptionState&);
+ // mojom::blink::PaymentRequestClient
+ void OnShippingAddressChange(mojom::blink::ShippingAddressPtr) override;
+ void OnShippingOptionChange(const String& shippingOptionId) override;
+ void OnPaymentResponse(mojom::blink::PaymentResponsePtr) override;
+ void OnError() override;
+ void OnComplete() override;
+
RefPtr<ScriptState> m_scriptState;
Vector<String> m_supportedMethods;
PaymentDetails m_details;
@@ -60,6 +72,10 @@ private:
String m_stringifiedData;
Member<ShippingAddress> m_shippingAddress;
String m_shippingOption;
+ Member<ScriptPromiseResolver> m_showResolver;
+ Member<ScriptPromiseResolver> m_completeResolver;
+ mojom::blink::PaymentRequestPtr m_paymentProvider;
+ mojo::Binding<mojom::blink::PaymentRequestClient> m_clientBinding;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698