| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // PaymentRequestState::Delegate: | 72 // PaymentRequestState::Delegate: |
| 73 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override; | 73 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override; |
| 74 void OnShippingOptionIdSelected(std::string shipping_option_id) override; | 74 void OnShippingOptionIdSelected(std::string shipping_option_id) override; |
| 75 void OnShippingAddressSelected(mojom::PaymentAddressPtr address) override; | 75 void OnShippingAddressSelected(mojom::PaymentAddressPtr address) override; |
| 76 | 76 |
| 77 // Called when the user explicitely cancelled the flow. Will send a message | 77 // Called when the user explicitely cancelled the flow. Will send a message |
| 78 // to the renderer which will indirectly destroy this object (through | 78 // to the renderer which will indirectly destroy this object (through |
| 79 // OnConnectionTerminated). | 79 // OnConnectionTerminated). |
| 80 void UserCancelled(); | 80 void UserCancelled(); |
| 81 | 81 |
| 82 // Called when the frame attached to this PaymentRequest is navigating away, |
| 83 // but before the PaymentRequest is destroyed. |
| 84 void DidStartNavigation(bool is_user_initiated); |
| 85 |
| 82 // As a result of a browser-side error or renderer-initiated mojo channel | 86 // As a result of a browser-side error or renderer-initiated mojo channel |
| 83 // closure (e.g. there was an error on the renderer side, or payment was | 87 // closure (e.g. there was an error on the renderer side, or payment was |
| 84 // successful), this method is called. It is responsible for cleaning up, | 88 // successful), this method is called. It is responsible for cleaning up, |
| 85 // such as possibly closing the dialog. | 89 // such as possibly closing the dialog. |
| 86 void OnConnectionTerminated(); | 90 void OnConnectionTerminated(); |
| 87 | 91 |
| 88 // Called when the user clicks on the "Pay" button. | 92 // Called when the user clicks on the "Pay" button. |
| 89 void Pay(); | 93 void Pay(); |
| 90 | 94 |
| 91 content::WebContents* web_contents() { return web_contents_; } | 95 content::WebContents* web_contents() { return web_contents_; } |
| 92 | 96 |
| 93 PaymentRequestSpec* spec() { return spec_.get(); } | 97 PaymentRequestSpec* spec() { return spec_.get(); } |
| 94 PaymentRequestState* state() { return state_.get(); } | 98 PaymentRequestState* state() { return state_.get(); } |
| 95 | 99 |
| 96 private: | 100 private: |
| 101 void RecordFirstCompletionStatus( |
| 102 JourneyLogger::CompletionStatus completion_status); |
| 103 |
| 97 content::WebContents* web_contents_; | 104 content::WebContents* web_contents_; |
| 98 std::unique_ptr<PaymentRequestDelegate> delegate_; | 105 std::unique_ptr<PaymentRequestDelegate> delegate_; |
| 99 // |manager_| owns this PaymentRequest. | 106 // |manager_| owns this PaymentRequest. |
| 100 PaymentRequestWebContentsManager* manager_; | 107 PaymentRequestWebContentsManager* manager_; |
| 101 mojo::Binding<mojom::PaymentRequest> binding_; | 108 mojo::Binding<mojom::PaymentRequest> binding_; |
| 102 mojom::PaymentRequestClientPtr client_; | 109 mojom::PaymentRequestClientPtr client_; |
| 103 | 110 |
| 104 std::unique_ptr<PaymentRequestSpec> spec_; | 111 std::unique_ptr<PaymentRequestSpec> spec_; |
| 105 std::unique_ptr<PaymentRequestState> state_; | 112 std::unique_ptr<PaymentRequestState> state_; |
| 106 | 113 |
| 107 // The RFC 6454 origin of the frame that has invoked PaymentRequest API. This | 114 // The RFC 6454 origin of the frame that has invoked PaymentRequest API. This |
| 108 // can be either the main frame or an iframe. | 115 // can be either the main frame or an iframe. |
| 109 const GURL frame_origin_; | 116 const GURL frame_origin_; |
| 110 | 117 |
| 111 // May be null, must outlive this object. | 118 // May be null, must outlive this object. |
| 112 ObserverForTest* observer_for_testing_; | 119 ObserverForTest* observer_for_testing_; |
| 113 | 120 |
| 114 JourneyLogger journey_logger_; | 121 JourneyLogger journey_logger_; |
| 115 | 122 |
| 123 bool has_recorded_abort_reason_ = false; |
| 124 |
| 116 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 125 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
| 117 }; | 126 }; |
| 118 | 127 |
| 119 } // namespace payments | 128 } // namespace payments |
| 120 | 129 |
| 121 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ | 130 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ |
| OLD | NEW |