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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/content/payment_request.cc
diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc
index 68da7ff714a86963414c53c99fe4d04bb5fcbb54..9dbe1c5bdba9fb27e3e64c85d65b36830c113d9e 100644
--- a/components/payments/content/payment_request.cc
+++ b/components/payments/content/payment_request.cc
@@ -99,6 +99,14 @@ void PaymentRequest::Show() {
return;
}
+ // A tab can display only one PaymentRequest UI at a time.
+ if (!manager_->CanShow(this)) {
+ LOG(ERROR) << "A PaymentRequest UI is already showing";
+ client_->OnError(mojom::PaymentErrorReason::USER_CANCEL);
+ OnConnectionTerminated();
+ return;
+ }
+
if (!state_->AreRequestedMethodsSupported()) {
client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED);
if (observer_for_testing_)
« 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