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 details_ = std::move(details); | |
please use gerrit instead
2017/01/04 15:55:27
Run |details| through validatePaymentDetails(detai
anthonyvd
2017/01/04 19:08:55
Done.
| |
65 } | 66 } |
66 | 67 |
67 void PaymentRequestImpl::Show() { | 68 void PaymentRequestImpl::Show() { |
68 chrome::ShowPaymentRequestDialog(this); | 69 chrome::ShowPaymentRequestDialog(this); |
69 } | 70 } |
70 | 71 |
71 void PaymentRequestImpl::Cancel() { | 72 void PaymentRequestImpl::Cancel() { |
72 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); | 73 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); |
73 } | 74 } |
74 | 75 |
75 void PaymentRequestImpl::OnError() { | 76 void PaymentRequestImpl::OnError() { |
76 binding_.Close(); | 77 binding_.Close(); |
77 // TODO(krb): Close the dialog here, but avoid double-free | 78 // TODO(krb): Close the dialog here, but avoid double-free |
78 payment_request_factory.Get().UnassignPaymentRequest(web_contents_); | 79 payment_request_factory.Get().UnassignPaymentRequest(web_contents_); |
79 } | 80 } |
80 | 81 |
81 } // namespace payments | 82 } // namespace payments |
82 | 83 |
83 void CreatePaymentRequestHandler( | 84 void CreatePaymentRequestHandler( |
84 content::WebContents* web_contents, | 85 content::WebContents* web_contents, |
85 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request) { | 86 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request) { |
86 payment_request_factory.Get().AssignPaymentRequest(web_contents, | 87 payment_request_factory.Get().AssignPaymentRequest(web_contents, |
87 std::move(request)); | 88 std::move(request)); |
88 } | 89 } |
OLD | NEW |