| 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));
|
| +}
|
| +
|
| +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)) {
|
| +}
|
| +
|
| +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();
|
| +}
|
|
|