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

Unified Diff: third_party/WebKit/Source/platform/payments/PaymentRequestProxy.h

Issue 1753543002: PaymentRequest Mojo bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface
Patch Set: Rename WebStuff into PlatformStuff 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/platform/payments/PaymentRequestProxy.h
diff --git a/third_party/WebKit/Source/platform/payments/PaymentRequestProxy.h b/third_party/WebKit/Source/platform/payments/PaymentRequestProxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6e1edb655df528d01d89ad7e2ab8dd54b1f0cc8
--- /dev/null
+++ b/third_party/WebKit/Source/platform/payments/PaymentRequestProxy.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 PaymentRequestProxy_h
+#define PaymentRequestProxy_h
+
+#include "components/payments/payment_request.mojom.h"
+#include "platform/PlatformExport.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+struct PlatformPaymentDetails;
+struct PlatformPaymentOptions;
+struct PlatformPaymentResponse;
+struct PlatformShippingAddress;
+
+// This class connects a PaymentRequestProxy::Listener to the PaymentRequest
+// Mojo service. Note that currently the access to the Mojo service is limited
+// in platform/. In future, we'll let classes in core/ and modules/ directly
+// communicate with Mojo, and then, there will be no need to use this proxy
+// class.
+//
+// TODO(rouslan): Remove this directory once modules/ can use Mojo.
+class PLATFORM_EXPORT PaymentRequestProxy
+ : public payments::mojom::PaymentRequestClient {
+ WTF_MAKE_NONCOPYABLE(PaymentRequestProxy);
+
+public:
+ class Listener {
+ public:
+ virtual ~Listener() = default;
+
+ virtual void onShippingAddressChange(const PlatformShippingAddress&) = 0;
+ virtual void onShippingOptionChange(const String& shippingOptionId) = 0;
+ virtual void onPaymentResponse(const PlatformPaymentResponse&) = 0;
+ virtual void onError() = 0;
+ virtual void onComplete() = 0;
+ };
+
+ explicit PaymentRequestProxy(Listener*);
+ ~PaymentRequestProxy() override;
+
+ void show(const Vector<String>& supportedMethods,
+ const PlatformPaymentDetails&,
+ const PlatformPaymentOptions&,
+ const String& stringifiedData);
+ void abort();
+ void complete(bool success);
+
+private:
+ // payments::mojom::PaymentRequestClient
+ void OnShippingAddressChange(payments::mojom::ShippingAddressPtr) override;
+ void OnShippingOptionChange(const mojo::String& shippingOptionId) override;
+ void OnPaymentResponse(payments::mojom::PaymentResponsePtr) override;
+ void OnError() override;
+ void OnComplete() override;
+
+ payments::mojom::PaymentRequestPtr m_provider;
+ Listener* m_listener;
+};
+
+} // namespace blink
+
+#endif // PaymentRequestProxy_h

Powered by Google App Engine
This is Rietveld 408576698