| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 void PaymentRequest::OnInvalidSpecProvided() { | 107 void PaymentRequest::OnInvalidSpecProvided() { |
| 107 OnConnectionTerminated(); | 108 OnConnectionTerminated(); |
| 108 } | 109 } |
| 109 | 110 |
| 110 void PaymentRequest::OnPaymentResponseAvailable( | 111 void PaymentRequest::OnPaymentResponseAvailable( |
| 111 mojom::PaymentResponsePtr response) { | 112 mojom::PaymentResponsePtr response) { |
| 112 client_->OnPaymentResponse(std::move(response)); | 113 client_->OnPaymentResponse(std::move(response)); |
| 113 } | 114 } |
| 114 | 115 |
| 116 PaymentRequestDelegate* PaymentRequest::GetPaymentRequestDelegate() { |
| 117 return delegate_.get(); |
| 118 } |
| 119 |
| 115 void PaymentRequest::UserCancelled() { | 120 void PaymentRequest::UserCancelled() { |
| 116 // If |client_| is not bound, then the object is already being destroyed as | 121 // If |client_| is not bound, then the object is already being destroyed as |
| 117 // a result of a renderer event. | 122 // a result of a renderer event. |
| 118 if (!client_.is_bound()) | 123 if (!client_.is_bound()) |
| 119 return; | 124 return; |
| 120 | 125 |
| 121 // This sends an error to the renderer, which informs the API user. | 126 // This sends an error to the renderer, which informs the API user. |
| 122 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); | 127 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); |
| 123 | 128 |
| 124 // We close all bindings and ask to be destroyed. | 129 // We close all bindings and ask to be destroyed. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 137 binding_.Close(); | 142 binding_.Close(); |
| 138 delegate_->CloseDialog(); | 143 delegate_->CloseDialog(); |
| 139 manager_->DestroyRequest(this); | 144 manager_->DestroyRequest(this); |
| 140 } | 145 } |
| 141 | 146 |
| 142 void PaymentRequest::Pay() { | 147 void PaymentRequest::Pay() { |
| 143 state_->GeneratePaymentResponse(); | 148 state_->GeneratePaymentResponse(); |
| 144 } | 149 } |
| 145 | 150 |
| 146 } // namespace payments | 151 } // namespace payments |
| OLD | NEW |