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

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

Issue 2772103002: [Payments] Desktop: never return false in incognito mode for canMakePayment (Closed)
Patch Set: Created 3 years, 9 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
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(crbug.com/704676): Implement a quota policy for this method. 87 // TODO(crbug.com/704676): Implement a quota policy for this method.
88 // PaymentRequest.canMakePayments() never returns false in incognito mode.
88 client_->OnCanMakePayment( 89 client_->OnCanMakePayment(
89 state()->CanMakePayment() 90 delegate_->IsIncognito() || state()->CanMakePayment()
90 ? mojom::CanMakePaymentQueryResult::CAN_MAKE_PAYMENT 91 ? mojom::CanMakePaymentQueryResult::CAN_MAKE_PAYMENT
91 : mojom::CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT); 92 : mojom::CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT);
92 } 93 }
93 94
94 void PaymentRequest::OnInvalidSpecProvided() { 95 void PaymentRequest::OnInvalidSpecProvided() {
95 OnConnectionTerminated(); 96 OnConnectionTerminated();
96 } 97 }
97 98
98 void PaymentRequest::OnPaymentResponseAvailable( 99 void PaymentRequest::OnPaymentResponseAvailable(
99 mojom::PaymentResponsePtr response) { 100 mojom::PaymentResponsePtr response) {
(...skipping 25 matching lines...) Expand all
125 binding_.Close(); 126 binding_.Close();
126 delegate_->CloseDialog(); 127 delegate_->CloseDialog();
127 manager_->DestroyRequest(this); 128 manager_->DestroyRequest(this);
128 } 129 }
129 130
130 void PaymentRequest::Pay() { 131 void PaymentRequest::Pay() {
131 state_->GeneratePaymentResponse(); 132 state_->GeneratePaymentResponse();
132 } 133 }
133 134
134 } // namespace payments 135 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698