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

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

Issue 2864013002: Verify behavior of PaymentRequest.show() method, part 1. (Closed)
Patch Set: Address comments. Created 3 years, 7 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 | « no previous file | components/payments/content/payment_request_web_contents_manager.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 <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 delegate_->GetPersonalDataManager(), delegate_.get()); 92 delegate_->GetPersonalDataManager(), delegate_.get());
93 } 93 }
94 94
95 void PaymentRequest::Show() { 95 void PaymentRequest::Show() {
96 if (!client_.is_bound() || !binding_.is_bound()) { 96 if (!client_.is_bound() || !binding_.is_bound()) {
97 LOG(ERROR) << "Attempted Show(), but binding(s) missing."; 97 LOG(ERROR) << "Attempted Show(), but binding(s) missing.";
98 OnConnectionTerminated(); 98 OnConnectionTerminated();
99 return; 99 return;
100 } 100 }
101 101
102 // A tab can display only one PaymentRequest UI at a time.
103 if (!manager_->CanShow(this)) {
104 LOG(ERROR) << "A PaymentRequest UI is already showing";
105 client_->OnError(mojom::PaymentErrorReason::USER_CANCEL);
106 OnConnectionTerminated();
107 return;
108 }
109
102 if (!state_->AreRequestedMethodsSupported()) { 110 if (!state_->AreRequestedMethodsSupported()) {
103 client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED); 111 client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED);
104 if (observer_for_testing_) 112 if (observer_for_testing_)
105 observer_for_testing_->OnNotSupportedError(); 113 observer_for_testing_->OnNotSupportedError();
106 OnConnectionTerminated(); 114 OnConnectionTerminated();
107 return; 115 return;
108 } 116 }
109 117
110 journey_logger_.SetShowCalled(); 118 journey_logger_.SetShowCalled();
111 delegate_->ShowDialog(this); 119 delegate_->ShowDialog(this);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 binding_.Close(); 211 binding_.Close();
204 delegate_->CloseDialog(); 212 delegate_->CloseDialog();
205 manager_->DestroyRequest(this); 213 manager_->DestroyRequest(this);
206 } 214 }
207 215
208 void PaymentRequest::Pay() { 216 void PaymentRequest::Pay() {
209 state_->GeneratePaymentResponse(); 217 state_->GeneratePaymentResponse();
210 } 218 }
211 219
212 } // namespace payments 220 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | components/payments/content/payment_request_web_contents_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698