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

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

Issue 2870153002: [Payments] Record navigations that close the Payment Request as aborts. (Closed)
Patch Set: Fixed Windows error 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 1d186e1d6cc3bf19de761c4fbb3b43436f5758aa..315962fadc06dd09c3993120e1a75a1d2e5bd1be 100644
--- a/components/payments/content/payment_request_web_contents_manager.cc
+++ b/components/payments/content/payment_request_web_contents_manager.cc
@@ -10,6 +10,7 @@
#include "base/memory/ptr_util.h"
#include "components/payments/content/payment_request.h"
#include "components/payments/core/payment_request_delegate.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(payments::PaymentRequestWebContentsManager);
@@ -40,6 +41,16 @@ void PaymentRequestWebContentsManager::CreatePaymentRequest(
payment_requests_.insert(std::make_pair(request_ptr, std::move(new_request)));
}
+void PaymentRequestWebContentsManager::DidStartNavigation(
+ content::NavigationHandle* navigation_handle) {
+ for (auto& it : payment_requests_) {
+ // Since the PaymentRequest dialog blocks the content of the page, the user
+ // cannot click on a link to navigate away. Therefore, if the navigation
+ // is initiated in the renderer, it does not come from the user.
+ it.second->DidStartNavigation(!navigation_handle->IsRendererInitiated());
+ }
+}
+
void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) {
if (request == showing_)
showing_ = nullptr;
@@ -59,6 +70,6 @@ bool PaymentRequestWebContentsManager::CanShow(PaymentRequest* request) {
PaymentRequestWebContentsManager::PaymentRequestWebContentsManager(
content::WebContents* web_contents)
- : showing_(nullptr) {}
+ : content::WebContentsObserver(web_contents), showing_(nullptr) {}
} // namespace payments
« no previous file with comments | « components/payments/content/payment_request_web_contents_manager.h ('k') | components/payments/core/journey_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698