Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: components/payments/content/payment_request.cc

Issue 2766353004: [Payments] Support canMakePayment on Desktop (Closed)
Patch Set: only support valid instruments, added test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/BUILD.gn ('k') | components/payments/content/payment_request_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | components/payments/content/payment_request_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698