OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/payments/payment_request_impl.h" | 5 #include "chrome/browser/payments/payment_request_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 PaymentRequestImpl::~PaymentRequestImpl() {} | 56 PaymentRequestImpl::~PaymentRequestImpl() {} |
57 | 57 |
58 void PaymentRequestImpl::Init( | 58 void PaymentRequestImpl::Init( |
59 payments::mojom::PaymentRequestClientPtr client, | 59 payments::mojom::PaymentRequestClientPtr client, |
60 std::vector<payments::mojom::PaymentMethodDataPtr> methodData, | 60 std::vector<payments::mojom::PaymentMethodDataPtr> methodData, |
61 payments::mojom::PaymentDetailsPtr details, | 61 payments::mojom::PaymentDetailsPtr details, |
62 payments::mojom::PaymentOptionsPtr options) { | 62 payments::mojom::PaymentOptionsPtr options) { |
63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
64 client_ = std::move(client); | 64 client_ = std::move(client); |
| 65 } |
| 66 |
| 67 void PaymentRequestImpl::Show() { |
65 chrome::ShowPaymentRequestDialog(this); | 68 chrome::ShowPaymentRequestDialog(this); |
66 } | 69 } |
67 | 70 |
68 void PaymentRequestImpl::Cancel() { | 71 void PaymentRequestImpl::Cancel() { |
69 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); | 72 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); |
70 } | 73 } |
71 | 74 |
72 void PaymentRequestImpl::OnError() { | 75 void PaymentRequestImpl::OnError() { |
73 binding_.Close(); | 76 binding_.Close(); |
74 // TODO(krb): Close the dialog here, but avoid double-free | 77 // TODO(krb): Close the dialog here, but avoid double-free |
75 payment_request_factory.Get().UnassignPaymentRequest(web_contents_); | 78 payment_request_factory.Get().UnassignPaymentRequest(web_contents_); |
76 } | 79 } |
77 | 80 |
78 } // namespace payments | 81 } // namespace payments |
79 | 82 |
80 void CreatePaymentRequestHandler( | 83 void CreatePaymentRequestHandler( |
81 content::WebContents* web_contents, | 84 content::WebContents* web_contents, |
82 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request) { | 85 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request) { |
83 payment_request_factory.Get().AssignPaymentRequest(web_contents, | 86 payment_request_factory.Get().AssignPaymentRequest(web_contents, |
84 std::move(request)); | 87 std::move(request)); |
85 } | 88 } |
OLD | NEW |