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 #ifndef CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_IMPL_H_ | 5 #ifndef CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_IMPL_H_ |
6 #define CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_IMPL_H_ | 6 #define CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_IMPL_H_ |
7 | 7 |
8 #include "components/payments/payment_request.mojom.h" | 8 #include "components/payments/payment_request.mojom.h" |
9 #include "mojo/public/cpp/bindings/binding.h" | 9 #include "mojo/public/cpp/bindings/binding.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 class WebContents; | 12 class WebContents; |
13 } | 13 } |
14 | 14 |
15 namespace payments { | 15 namespace payments { |
16 | 16 |
17 class PaymentRequestDialog; | |
18 | |
19 class PaymentRequestImpl : payments::mojom::PaymentRequest, | 17 class PaymentRequestImpl : payments::mojom::PaymentRequest, |
20 public base::RefCounted<PaymentRequestImpl> { | 18 public base::RefCounted<PaymentRequestImpl> { |
21 public: | 19 public: |
22 PaymentRequestImpl( | 20 PaymentRequestImpl( |
23 content::WebContents* web_contents, | 21 content::WebContents* web_contents, |
24 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); | 22 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); |
25 | 23 |
26 // payments::mojom::PaymentRequest "stub" | 24 // payments::mojom::PaymentRequest "stub" |
27 void Init(payments::mojom::PaymentRequestClientPtr client, | 25 void Init(payments::mojom::PaymentRequestClientPtr client, |
28 std::vector<payments::mojom::PaymentMethodDataPtr> methodData, | 26 std::vector<payments::mojom::PaymentMethodDataPtr> methodData, |
29 payments::mojom::PaymentDetailsPtr details, | 27 payments::mojom::PaymentDetailsPtr details, |
30 payments::mojom::PaymentOptionsPtr options) override; | 28 payments::mojom::PaymentOptionsPtr options) override; |
31 void Show() override {} | 29 void Show() override {} |
32 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {} | 30 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {} |
33 void Abort() override {} | 31 void Abort() override {} |
34 void Complete(payments::mojom::PaymentComplete result) override {} | 32 void Complete(payments::mojom::PaymentComplete result) override {} |
35 void CanMakePayment() override {} | 33 void CanMakePayment() override {} |
36 | 34 |
| 35 void Cancel(); |
37 void OnError(); | 36 void OnError(); |
38 | 37 |
| 38 content::WebContents* web_contents() { return web_contents_; } |
| 39 |
39 private: | 40 private: |
40 friend class base::RefCounted<PaymentRequestImpl>; | 41 friend class base::RefCounted<PaymentRequestImpl>; |
41 ~PaymentRequestImpl() override; | 42 ~PaymentRequestImpl() override; |
42 | 43 |
43 content::WebContents* web_contents_; | 44 content::WebContents* web_contents_; |
44 mojo::Binding<payments::mojom::PaymentRequest> binding_; | 45 mojo::Binding<payments::mojom::PaymentRequest> binding_; |
45 PaymentRequestDialog* dialog_; | 46 payments::mojom::PaymentRequestClientPtr client_; |
| 47 |
46 DISALLOW_COPY_AND_ASSIGN(PaymentRequestImpl); | 48 DISALLOW_COPY_AND_ASSIGN(PaymentRequestImpl); |
47 }; | 49 }; |
48 | 50 |
49 } // namespace payments | 51 } // namespace payments |
50 | 52 |
51 void CreatePaymentRequestHandler( | 53 void CreatePaymentRequestHandler( |
52 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
53 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); | 55 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); |
54 | 56 |
55 #endif // CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_IMPL_H_ | 57 #endif // CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_IMPL_H_ |
OLD | NEW |