| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/payments/content/payment_details_validation.h" | 10 #include "components/payments/content/payment_details_validation.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 // TODO(mathp): Validate |result|. | 79 // TODO(mathp): Validate |result|. |
| 80 | 80 |
| 81 // When the renderer closes the connection, | 81 // When the renderer closes the connection, |
| 82 // PaymentRequest::OnConnectionTerminated will be called. | 82 // PaymentRequest::OnConnectionTerminated will be called. |
| 83 client_->OnComplete(); | 83 client_->OnComplete(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void PaymentRequest::CanMakePayment() { | 86 void PaymentRequest::CanMakePayment() { |
| 87 // TODO(mathp): Return whether we can make payment. | 87 // TODO(crbug.com/704676): Implement a quota policy for this method. |
| 88 client_->OnCanMakePayment(mojom::CanMakePaymentQueryResult::CAN_MAKE_PAYMENT); | 88 client_->OnCanMakePayment( |
| 89 state()->CanMakePayment() |
| 90 ? mojom::CanMakePaymentQueryResult::CAN_MAKE_PAYMENT |
| 91 : mojom::CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT); |
| 89 } | 92 } |
| 90 | 93 |
| 91 void PaymentRequest::OnInvalidSpecProvided() { | 94 void PaymentRequest::OnInvalidSpecProvided() { |
| 92 OnConnectionTerminated(); | 95 OnConnectionTerminated(); |
| 93 } | 96 } |
| 94 | 97 |
| 95 void PaymentRequest::OnPaymentResponseAvailable( | 98 void PaymentRequest::OnPaymentResponseAvailable( |
| 96 mojom::PaymentResponsePtr response) { | 99 mojom::PaymentResponsePtr response) { |
| 97 client_->OnPaymentResponse(std::move(response)); | 100 client_->OnPaymentResponse(std::move(response)); |
| 98 } | 101 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 122 binding_.Close(); | 125 binding_.Close(); |
| 123 delegate_->CloseDialog(); | 126 delegate_->CloseDialog(); |
| 124 manager_->DestroyRequest(this); | 127 manager_->DestroyRequest(this); |
| 125 } | 128 } |
| 126 | 129 |
| 127 void PaymentRequest::Pay() { | 130 void PaymentRequest::Pay() { |
| 128 state_->GeneratePaymentResponse(); | 131 state_->GeneratePaymentResponse(); |
| 129 } | 132 } |
| 130 | 133 |
| 131 } // namespace payments | 134 } // namespace payments |
| OLD | NEW |