| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Called when the user clicks on the "Pay" button. | 93 // Called when the user clicks on the "Pay" button. |
| 94 void Pay(); | 94 void Pay(); |
| 95 | 95 |
| 96 content::WebContents* web_contents() { return web_contents_; } | 96 content::WebContents* web_contents() { return web_contents_; } |
| 97 | 97 |
| 98 PaymentRequestSpec* spec() { return spec_.get(); } | 98 PaymentRequestSpec* spec() { return spec_.get(); } |
| 99 PaymentRequestState* state() { return state_.get(); } | 99 PaymentRequestState* state() { return state_.get(); } |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 void RecordFirstCompletionStatus( | 102 // Only records the abort reason if it's the first completion for this Payment |
| 103 JourneyLogger::CompletionStatus completion_status); | 103 // Request. This is necessary since the aborts cascade into one another with |
| 104 // the first one being the most precise. |
| 105 void RecordFirstAbortReason(JourneyLogger::AbortReason completion_status); |
| 104 | 106 |
| 105 content::WebContents* web_contents_; | 107 content::WebContents* web_contents_; |
| 106 std::unique_ptr<PaymentRequestDelegate> delegate_; | 108 std::unique_ptr<PaymentRequestDelegate> delegate_; |
| 107 // |manager_| owns this PaymentRequest. | 109 // |manager_| owns this PaymentRequest. |
| 108 PaymentRequestWebContentsManager* manager_; | 110 PaymentRequestWebContentsManager* manager_; |
| 109 mojo::Binding<mojom::PaymentRequest> binding_; | 111 mojo::Binding<mojom::PaymentRequest> binding_; |
| 110 mojom::PaymentRequestClientPtr client_; | 112 mojom::PaymentRequestClientPtr client_; |
| 111 | 113 |
| 112 std::unique_ptr<PaymentRequestSpec> spec_; | 114 std::unique_ptr<PaymentRequestSpec> spec_; |
| 113 std::unique_ptr<PaymentRequestState> state_; | 115 std::unique_ptr<PaymentRequestState> state_; |
| 114 | 116 |
| 115 // The RFC 6454 origin of the frame that has invoked PaymentRequest API. This | 117 // The RFC 6454 origin of the frame that has invoked PaymentRequest API. This |
| 116 // can be either the main frame or an iframe. | 118 // can be either the main frame or an iframe. |
| 117 const GURL frame_origin_; | 119 const GURL frame_origin_; |
| 118 | 120 |
| 119 // May be null, must outlive this object. | 121 // May be null, must outlive this object. |
| 120 ObserverForTest* observer_for_testing_; | 122 ObserverForTest* observer_for_testing_; |
| 121 | 123 |
| 122 JourneyLogger journey_logger_; | 124 JourneyLogger journey_logger_; |
| 123 | 125 |
| 124 bool has_recorded_abort_reason_ = false; | 126 // Whether a completion was already recorded for this Payment Request. |
| 127 bool has_recorded_completion_ = false; |
| 125 | 128 |
| 126 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 129 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
| 127 }; | 130 }; |
| 128 | 131 |
| 129 } // namespace payments | 132 } // namespace payments |
| 130 | 133 |
| 131 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ | 134 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ |
| OLD | NEW |