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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: PlzNavigate: identify same-page browser-initiated navigation. Created 4 years 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/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index bf8c9444a5cb7d18aedb5713730a2206ede76713..3a566023cd1a3326df8abffdadd7f9cc47582299 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -201,16 +201,18 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
request_body = frame_entry.GetPostData();
std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
- frame_tree_node, entry.ConstructCommonNavigationParams(
- frame_entry, request_body, dest_url, dest_referrer,
- navigation_type, lofi_state, navigation_start),
+ frame_tree_node,
+ entry.ConstructCommonNavigationParams(frame_entry, request_body, dest_url,
+ dest_referrer, navigation_type,
+ lofi_state, navigation_start),
BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL,
false, // has_user_gestures
false, // skip_service_worker
REQUEST_CONTEXT_TYPE_LOCATION),
entry.ConstructRequestNavigationParams(
- frame_entry, is_same_document_history_load,
- is_history_navigation_in_new_child,
+ frame_entry, net::AreURLsInPageNavigation(
+ frame_tree_node->current_url(), dest_url),
+ is_same_document_history_load, is_history_navigation_in_new_child,
entry.GetSubframeUniqueNames(frame_tree_node),
frame_tree_node->has_committed_real_load(),
controller->GetPendingEntryIndex() == -1,
@@ -240,6 +242,7 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated(
false, // can_load_local_resources
PageState(), // page_state
0, // nav_entry_id
+ false, // is_same_document_navigation
false, // is_same_document_history_load
false, // is_history_navigation_in_new_child
std::map<std::string, bool>(), // subframe_unique_names
@@ -316,7 +319,8 @@ void NavigationRequest::BeginNavigation() {
state_ = STARTED;
RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get());
- if (ShouldMakeNetworkRequestForURL(common_params_.url)) {
+ if (ShouldMakeNetworkRequestForURL(common_params_.url) &&
+ !request_params_.is_same_document_navigation) {
// It's safe to use base::Unretained because this NavigationRequest owns
// the NavigationHandle where the callback will be stored.
// TODO(clamy): pass the real value for |is_external_protocol| if needed.
@@ -643,7 +647,8 @@ void NavigationRequest::OnWillProcessResponseChecksComplete(
}
void NavigationRequest::CommitNavigation() {
- DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url));
+ DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url) ||
+ request_params_.is_same_document_navigation);
DCHECK(!common_params_.url.SchemeIs(url::kJavaScriptScheme));
// Retrieve the RenderFrameHost that needs to commit the navigation.

Powered by Google App Engine
This is Rietveld 408576698