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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Adding a DCHECK to probably make a lot of tests fail. Created 3 years, 11 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/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index c0adcb2e44282671bc7643c20a398454c1c9413c..2a13d1bf12a3b9023a21271f5441ec2227c28d93 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -554,7 +554,8 @@ bool IsTopLevelNavigation(WebFrame* frame) {
WebURLRequest CreateURLRequestForNavigation(
const CommonNavigationParams& common_params,
std::unique_ptr<StreamOverrideParameters> stream_override,
- bool is_view_source_mode_enabled) {
+ bool is_view_source_mode_enabled,
+ bool is_same_document_navigation) {
WebURLRequest request(common_params.url);
if (is_view_source_mode_enabled)
request.setCachePolicy(WebCachePolicy::ReturnCacheDataElseLoad);
@@ -572,8 +573,7 @@ WebURLRequest CreateURLRequestForNavigation(
}
}
- request.setPreviewsState(
- static_cast<WebURLRequest::PreviewsState>(common_params.previews_state));
nasko 2017/01/13 19:36:57 Hmm, removing this line seems incorrect. It is unr
arthursonzogni 2017/01/17 15:24:48 Oops sorry!
+ request.setIsSameDocumentNavigation(is_same_document_navigation);
RequestExtraData* extra_data = new RequestExtraData();
extra_data->set_stream_override(std::move(stream_override));
@@ -5214,7 +5214,8 @@ void RenderFrameImpl::OnFailedNavigation(
CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code);
WebURLRequest failed_request = CreateURLRequestForNavigation(
common_params, std::unique_ptr<StreamOverrideParameters>(),
- frame_->isViewSourceModeEnabled());
+ frame_->isViewSourceModeEnabled(),
+ false); // is_same_document_navigation
if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) {
// The browser expects this frame to be loading an error page. Inform it
@@ -5908,9 +5909,14 @@ void RenderFrameImpl::NavigateInternal(
blink::WebHistoryDifferentDocumentLoad;
bool should_load_request = false;
WebHistoryItem item_for_history_navigation;
- WebURLRequest request =
- CreateURLRequestForNavigation(common_params, std::move(stream_params),
- frame_->isViewSourceModeEnabled());
+
+ bool is_same_page = request_params.is_same_document_fragment_change ||
+ request_params.is_same_document_history_load;
+
+ WebURLRequest request = CreateURLRequestForNavigation(
+ common_params, std::move(stream_params),
+ frame_->isViewSourceModeEnabled(),
+ is_same_page);
request.setFrameType(IsTopLevelNavigation(frame_)
? blink::WebURLRequest::FrameTypeTopLevel
: blink::WebURLRequest::FrameTypeNested);

Powered by Google App Engine
This is Rietveld 408576698