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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 1964863002: Persist prompt/block download limiter state on renderer-initiated loads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement DidFinishNavigation Created 4 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: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 6fcdb074b4a0f6badd1ea04256214a7e2223480d..9eb10a394a10b7e1983bed592ddcba821b5dcf1f 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -175,12 +175,19 @@ void NavigatorImpl::DidStartProvisionalLoad(
std::unique_ptr<NavigationHandleImpl>());
}
- NavigationEntry* pending_entry = controller_->GetPendingEntry();
+ bool is_renderer_initiated = false;
Charlie Reis 2016/05/11 21:50:03 Seems like we should default to true, with a comme
dominickn 2016/05/12 04:22:58 Makes sense, done. The test I added with subframe
+ int pending_nav_entry_id = 0;
+ NavigationEntryImpl* pending_entry = controller_->GetPendingEntry();
+ if (pending_entry) {
+ is_renderer_initiated = pending_entry->is_renderer_initiated();
+ pending_nav_entry_id = pending_entry->GetUniqueID();
+ }
render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create(
validated_url, render_frame_host->frame_tree_node(),
+ is_renderer_initiated,
false, // is_synchronous
is_iframe_srcdoc, // is_srcdoc
- navigation_start, pending_entry ? pending_entry->GetUniqueID() : 0));
+ navigation_start, pending_nav_entry_id));
}
void NavigatorImpl::DidFailProvisionalLoadWithError(
@@ -895,7 +902,7 @@ void NavigatorImpl::OnBeginNavigation(
// entry from the NavigationController.
NavigationEntry* pending_entry = controller_->GetPendingEntry();
navigation_request->CreateNavigationHandle(
- pending_entry ? pending_entry->GetUniqueID() : 0);
+ true, pending_entry ? pending_entry->GetUniqueID() : 0);
navigation_request->BeginNavigation();
}
@@ -995,7 +1002,8 @@ void NavigatorImpl::RequestNavigation(
if (!dest_url.SchemeIs(url::kJavaScriptScheme))
frame_tree_node->CreatedNavigationRequest(std::move(scoped_request));
- navigation_request->CreateNavigationHandle(entry.GetUniqueID());
+ navigation_request->CreateNavigationHandle(entry.is_renderer_initiated(),
+ entry.GetUniqueID());
// Have the current renderer execute its beforeunload event if needed. If it
// is not needed (when beforeunload dispatch is not needed or this navigation
@@ -1103,8 +1111,10 @@ void NavigatorImpl::DidStartMainFrameNavigation(
// If there's a current NavigationHandle, update its pending NavEntry ID.
// This is necessary for transfer navigations. The handle may be null in
// PlzNavigate.
- if (navigation_handle)
+ if (navigation_handle) {
+ navigation_handle->set_is_renderer_initiated(true);
navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
+ }
controller_->SetPendingEntry(std::move(entry));
if (delegate_)

Powered by Google App Engine
This is Rietveld 408576698