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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Very minor fix. 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 ebf13c251ca71bf82bfca0d72a099c1a0b7a8200..ae4d7871bba2a267adc8e6c1e9b04b00d7d663f7 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,6 +573,8 @@ WebURLRequest CreateURLRequestForNavigation(
}
}
+ request.setIsSameDocumentNavigation(is_same_document_navigation);
+
request.setLoFiState(
static_cast<WebURLRequest::LoFiState>(common_params.lofi_state));
@@ -5201,7 +5204,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
@@ -5895,9 +5899,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);
@@ -5968,6 +5977,7 @@ void RenderFrameImpl::NavigateInternal(
history_load_type = request_params.is_same_document_history_load
? blink::WebHistorySameDocumentLoad
: blink::WebHistoryDifferentDocumentLoad;
+
nasko 2017/01/13 02:51:10 nit: Why just an empty line here?
arthursonzogni 2017/01/13 15:18:37 Done.
load_type = request_params.is_history_navigation_in_new_child
? blink::WebFrameLoadType::InitialHistoryLoad
: blink::WebFrameLoadType::BackForward;

Powered by Google App Engine
This is Rietveld 408576698