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

Unified Diff: chrome/browser/payments/payment_request_impl.cc

Issue 2446093004: [Web Payments] Initial plumb of Payment Request dialog (Closed)
Patch Set: Replaced my flag with existing one Created 4 years, 2 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: chrome/browser/payments/payment_request_impl.cc
diff --git a/chrome/browser/payments/payment_request_impl.cc b/chrome/browser/payments/payment_request_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7ddaa29e41672ed399cbde89ab198b6ead687cd3
--- /dev/null
+++ b/chrome/browser/payments/payment_request_impl.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
please use gerrit instead 2016/11/04 21:58:12 Ditto
Kevin Bailey 2016/11/09 16:25:20 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/payments/payment_request_impl.h"
+
+#include "chrome/browser/payments/ui/payment_request_dialog.h"
+#include "components/web_modal/web_contents_modal_dialog_host.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
+
+void CreatePaymentRequestHandler(
+ content::RenderFrameHost* render_frame_host,
+ content::WebContents* web_contents,
+ mojo::InterfaceRequest<blink::mojom::PaymentRequest> request) {
+ // TODO: The goal was that this delete itself, but it doesn't yet.
+ new PaymentRequestImpl(render_frame_host, web_contents, std::move(request));
+}
+
+PaymentRequestImpl::PaymentRequestImpl(
+ content::RenderFrameHost* unused_render_frame_host,
+ content::WebContents* web_contents,
+ mojo::InterfaceRequest<blink::mojom::PaymentRequest> request)
+ // TODO: consider a weak ptr too
+ : web_contents_(web_contents),
+ binding_(this, std::move(request)) {
+}
+
+void PaymentRequestImpl::Init(
+ blink::mojom::PaymentRequestClientPtr client,
+ std::vector<blink::mojom::PaymentMethodDataPtr> methodData,
+ blink::mojom::PaymentDetailsPtr details,
+ blink::mojom::PaymentOptionsPtr options) {
+ // TODO: Give the dialog |this| to delete it when done.
please use gerrit instead 2016/11/04 21:58:13 Did you plan to address these TODOs in this CL?
Kevin Bailey 2016/11/09 16:25:20 No, not yet.
+ views::DialogDelegate::CreateDialogWidget(new PaymentRequestDialog, nullptr,
+ web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_)
+ ->delegate()
+ ->GetWebContentsModalDialogHost()
+ ->GetHostView())->Show();
+}
+
+PaymentRequestImpl::~PaymentRequestImpl() {}

Powered by Google App Engine
This is Rietveld 408576698