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

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

Issue 2446093004: [Web Payments] Initial plumb of Payment Request dialog (Closed)
Patch Set: Remove mystery strings Created 4 years, 1 month 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..65e6339acbb71466d4adacff5515de16a89fb97e
--- /dev/null
+++ b/chrome/browser/payments/payment_request_impl.cc
@@ -0,0 +1,42 @@
+// 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.
+
+#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));
Lei Zhang 2016/11/09 18:08:55 Does anything run this code yet? LSAN may complain
Kevin Bailey 2016/11/15 14:36:32 It's behind a flag, but nevertheless I tried impro
+}
+
+PaymentRequestImpl::PaymentRequestImpl(
+ content::RenderFrameHost* unused_render_frame_host,
Lei Zhang 2016/11/09 18:08:55 Is that because the RFH is used on Android?
Kevin Bailey 2016/11/15 14:36:32 I removed it. It's based on WebContents now.
+ content::WebContents* web_contents,
+ mojo::InterfaceRequest<blink::mojom::PaymentRequest> request)
+ // TODO: consider a weak ptr too
Lei Zhang 2016/11/09 18:08:55 Well, when is this going to delete itself?
Kevin Bailey 2016/11/15 14:36:32 At this point, when the Mojo connection goes away.
+ : web_contents_(web_contents),
+ binding_(this, std::move(request)) {
+}
+
+PaymentRequestImpl::~PaymentRequestImpl() {}
+
+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.
+ views::DialogDelegate::CreateDialogWidget(new PaymentRequestDialog, nullptr,
+ web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_)
+ ->delegate()
+ ->GetWebContentsModalDialogHost()
+ ->GetHostView())->Show();
+}

Powered by Google App Engine
This is Rietveld 408576698