Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/payments/payment_request_impl.h" | |
| 6 | |
| 7 #include "chrome/browser/payments/ui/payment_request_dialog.h" | |
| 8 #include "components/web_modal/web_contents_modal_dialog_host.h" | |
| 9 #include "components/web_modal/web_contents_modal_dialog_manager.h" | |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | |
| 11 | |
| 12 void CreatePaymentRequestHandler( | |
| 13 content::RenderFrameHost* render_frame_host, | |
| 14 content::WebContents* web_contents, | |
| 15 mojo::InterfaceRequest<blink::mojom::PaymentRequest> request) { | |
| 16 // TODO: The goal was that this delete itself, but it doesn't yet. | |
| 17 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
| |
| 18 } | |
| 19 | |
| 20 PaymentRequestImpl::PaymentRequestImpl( | |
| 21 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.
| |
| 22 content::WebContents* web_contents, | |
| 23 mojo::InterfaceRequest<blink::mojom::PaymentRequest> request) | |
| 24 // 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.
| |
| 25 : web_contents_(web_contents), | |
| 26 binding_(this, std::move(request)) { | |
| 27 } | |
| 28 | |
| 29 PaymentRequestImpl::~PaymentRequestImpl() {} | |
| 30 | |
| 31 void PaymentRequestImpl::Init( | |
| 32 blink::mojom::PaymentRequestClientPtr client, | |
| 33 std::vector<blink::mojom::PaymentMethodDataPtr> methodData, | |
| 34 blink::mojom::PaymentDetailsPtr details, | |
| 35 blink::mojom::PaymentOptionsPtr options) { | |
| 36 // TODO: Give the dialog |this| to delete it when done. | |
| 37 views::DialogDelegate::CreateDialogWidget(new PaymentRequestDialog, nullptr, | |
| 38 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_) | |
| 39 ->delegate() | |
| 40 ->GetWebContentsModalDialogHost() | |
| 41 ->GetHostView())->Show(); | |
| 42 } | |
| OLD | NEW |