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

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: 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..ea9d9a77f5f5c33ae5cb59eaba2d1add5ad7a8ce 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);
@@ -39,11 +40,22 @@ 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_) {
Mathieu 2017/05/09 18:12:19 PaymentRequest& ?
sebsg 2017/05/10 14:58:48 the elements are std::pair<PaymentRequest*, std::u
+ // 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->NavigatedAway(!navigation_handle->IsRendererInitiated());
+ }
+}
+
void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) {
payment_requests_.erase(request);
}
PaymentRequestWebContentsManager::PaymentRequestWebContentsManager(
- content::WebContents* web_contents) {}
+ content::WebContents* web_contents)
+ : content::WebContentsObserver(web_contents) {}
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698