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

Unified Diff: components/payments/content/payment_request_web_contents_manager.cc

Issue 2864013002: Verify behavior of PaymentRequest.show() method, part 1. (Closed)
Patch Set: Promise test 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
Index: components/payments/content/payment_request_web_contents_manager.cc
diff --git a/components/payments/content/payment_request_web_contents_manager.cc b/components/payments/content/payment_request_web_contents_manager.cc
index 2f11a65ebdb6a5f7778791e63d4acc58897ab0ca..1c15003aed3828a49399491cc4d2a79526a1870f 100644
--- a/components/payments/content/payment_request_web_contents_manager.cc
+++ b/components/payments/content/payment_request_web_contents_manager.cc
@@ -40,10 +40,24 @@ void PaymentRequestWebContentsManager::CreatePaymentRequest(
}
void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) {
+ if (request == showing_)
+ showing_ = nullptr;
payment_requests_.erase(request);
}
+bool PaymentRequestWebContentsManager::CanShow(PaymentRequest* request) {
+ DCHECK(request);
+ DCHECK(payment_requests_.find(request) != payment_requests_.end());
+ if (!showing_) {
+ showing_ = request;
+ return true;
+ } else {
+ return false;
+ }
+}
+
PaymentRequestWebContentsManager::PaymentRequestWebContentsManager(
- content::WebContents* web_contents) {}
+ content::WebContents* web_contents)
+ : showing_(nullptr) {}
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698