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 COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ |
6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ | 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // payment methods, required information, order details) is stored in | 30 // payment methods, required information, order details) is stored in |
31 // PaymentRequestSpec, and the current user selection state (and related data) | 31 // PaymentRequestSpec, and the current user selection state (and related data) |
32 // is stored in PaymentRequestSpec. | 32 // is stored in PaymentRequestSpec. |
33 class PaymentRequest : public mojom::PaymentRequest, | 33 class PaymentRequest : public mojom::PaymentRequest, |
34 public PaymentRequestSpec::Observer, | 34 public PaymentRequestSpec::Observer, |
35 public PaymentRequestState::Delegate { | 35 public PaymentRequestState::Delegate { |
36 public: | 36 public: |
37 class ObserverForTest { | 37 class ObserverForTest { |
38 public: | 38 public: |
39 virtual void OnCanMakePaymentCalled() = 0; | 39 virtual void OnCanMakePaymentCalled() = 0; |
| 40 virtual void OnNotSupportedError() = 0; |
40 | 41 |
41 protected: | 42 protected: |
42 virtual ~ObserverForTest() {} | 43 virtual ~ObserverForTest() {} |
43 }; | 44 }; |
44 | 45 |
45 PaymentRequest(content::WebContents* web_contents, | 46 PaymentRequest(content::WebContents* web_contents, |
46 std::unique_ptr<PaymentRequestDelegate> delegate, | 47 std::unique_ptr<PaymentRequestDelegate> delegate, |
47 PaymentRequestWebContentsManager* manager, | 48 PaymentRequestWebContentsManager* manager, |
48 mojo::InterfaceRequest<mojom::PaymentRequest> request, | 49 mojo::InterfaceRequest<mojom::PaymentRequest> request, |
49 ObserverForTest* observer_for_testing); | 50 ObserverForTest* observer_for_testing); |
50 ~PaymentRequest() override; | 51 ~PaymentRequest() override; |
51 | 52 |
52 // mojom::PaymentRequest | 53 // mojom::PaymentRequest |
53 void Init(mojom::PaymentRequestClientPtr client, | 54 void Init(mojom::PaymentRequestClientPtr client, |
54 std::vector<mojom::PaymentMethodDataPtr> method_data, | 55 std::vector<mojom::PaymentMethodDataPtr> method_data, |
55 mojom::PaymentDetailsPtr details, | 56 mojom::PaymentDetailsPtr details, |
56 mojom::PaymentOptionsPtr options) override; | 57 mojom::PaymentOptionsPtr options) override; |
57 void Show() override; | 58 void Show() override; |
58 void UpdateWith(mojom::PaymentDetailsPtr details) override; | 59 void UpdateWith(mojom::PaymentDetailsPtr details) override; |
59 void Abort() override; | 60 void Abort() override; |
60 void Complete(mojom::PaymentComplete result) override; | 61 void Complete(mojom::PaymentComplete result) override; |
61 void CanMakePayment() override; | 62 void CanMakePayment() override; |
62 | 63 |
63 // PaymentRequestSpec::Observer: | 64 // PaymentRequestSpec::Observer: |
64 void OnSpecUpdated() override {} | 65 void OnSpecUpdated() override {} |
65 void OnInvalidSpecProvided() override; | |
66 | 66 |
67 // PaymentRequestState::Delegate: | 67 // PaymentRequestState::Delegate: |
68 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override; | 68 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override; |
69 void OnShippingOptionIdSelected(std::string shipping_option_id) override; | 69 void OnShippingOptionIdSelected(std::string shipping_option_id) override; |
70 void OnShippingAddressSelected(mojom::PaymentAddressPtr address) override; | 70 void OnShippingAddressSelected(mojom::PaymentAddressPtr address) override; |
71 | 71 |
72 // Called when the user explicitely cancelled the flow. Will send a message | 72 // Called when the user explicitely cancelled the flow. Will send a message |
73 // to the renderer which will indirectly destroy this object (through | 73 // to the renderer which will indirectly destroy this object (through |
74 // OnConnectionTerminated). | 74 // OnConnectionTerminated). |
75 void UserCancelled(); | 75 void UserCancelled(); |
(...skipping 25 matching lines...) Expand all Loading... |
101 | 101 |
102 // May be null, must outlive this object. | 102 // May be null, must outlive this object. |
103 ObserverForTest* observer_for_testing_; | 103 ObserverForTest* observer_for_testing_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 105 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace payments | 108 } // namespace payments |
109 | 109 |
110 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ | 110 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ |
OLD | NEW |