| 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 "components/payments/content/payment_request.h" | 5 #include "components/payments/content/payment_request.h" |
| 6 | 6 |
| 7 #include <string> |
| 7 #include <utility> | 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 10 #include "components/payments/content/payment_details_validation.h" | 11 #include "components/payments/content/payment_details_validation.h" |
| 11 #include "components/payments/content/payment_request_web_contents_manager.h" | 12 #include "components/payments/content/payment_request_web_contents_manager.h" |
| 12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 | 15 |
| 15 namespace payments { | 16 namespace payments { |
| 16 | 17 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void PaymentRequest::OnShippingOptionIdSelected( | 126 void PaymentRequest::OnShippingOptionIdSelected( |
| 126 std::string shipping_option_id) { | 127 std::string shipping_option_id) { |
| 127 client_->OnShippingOptionChange(shipping_option_id); | 128 client_->OnShippingOptionChange(shipping_option_id); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void PaymentRequest::OnShippingAddressSelected( | 131 void PaymentRequest::OnShippingAddressSelected( |
| 131 mojom::PaymentAddressPtr address) { | 132 mojom::PaymentAddressPtr address) { |
| 132 client_->OnShippingAddressChange(std::move(address)); | 133 client_->OnShippingAddressChange(std::move(address)); |
| 133 } | 134 } |
| 134 | 135 |
| 136 PaymentRequestDelegate* PaymentRequest::GetPaymentRequestDelegate() { |
| 137 return delegate_.get(); |
| 138 } |
| 139 |
| 135 void PaymentRequest::UserCancelled() { | 140 void PaymentRequest::UserCancelled() { |
| 136 // If |client_| is not bound, then the object is already being destroyed as | 141 // If |client_| is not bound, then the object is already being destroyed as |
| 137 // a result of a renderer event. | 142 // a result of a renderer event. |
| 138 if (!client_.is_bound()) | 143 if (!client_.is_bound()) |
| 139 return; | 144 return; |
| 140 | 145 |
| 141 // This sends an error to the renderer, which informs the API user. | 146 // This sends an error to the renderer, which informs the API user. |
| 142 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); | 147 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); |
| 143 | 148 |
| 144 // We close all bindings and ask to be destroyed. | 149 // We close all bindings and ask to be destroyed. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 157 binding_.Close(); | 162 binding_.Close(); |
| 158 delegate_->CloseDialog(); | 163 delegate_->CloseDialog(); |
| 159 manager_->DestroyRequest(this); | 164 manager_->DestroyRequest(this); |
| 160 } | 165 } |
| 161 | 166 |
| 162 void PaymentRequest::Pay() { | 167 void PaymentRequest::Pay() { |
| 163 state_->GeneratePaymentResponse(); | 168 state_->GeneratePaymentResponse(); |
| 164 } | 169 } |
| 165 | 170 |
| 166 } // namespace payments | 171 } // namespace payments |
| OLD | NEW |