Chromium Code Reviews| 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 |