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