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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1182453002: PlzNavigate: support for should_replace_current_entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dropped the settint of the load type Created 5 years, 5 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
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 796bd0439b6ae96106f847bf29bb1c5a946cd6c3..77ea0b3fa5d817dcb7aaf7c05a432caf9c73a11f 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -470,7 +470,8 @@ void UpdateFrameNavigationTiming(WebFrame* frame,
// PlzNavigate
CommonNavigationParams MakeCommonNavigationParams(
- blink::WebURLRequest* request) {
+ blink::WebURLRequest* request,
+ bool should_replace_current_entry) {
const RequestExtraData kEmptyData;
const RequestExtraData* extra_data =
static_cast<RequestExtraData*>(request->extraData());
@@ -491,10 +492,10 @@ CommonNavigationParams MakeCommonNavigationParams(
FrameMsg_UILoadMetricsReportType::Value report_type =
static_cast<FrameMsg_UILoadMetricsReportType::Value>(
request->inputPerfMetricReportPolicy());
- return CommonNavigationParams(request->url(), referrer,
- extra_data->transition_type(),
- FrameMsg_Navigate_Type::NORMAL, true,
- ui_timestamp, report_type, GURL(), GURL());
+ return CommonNavigationParams(
+ request->url(), referrer, extra_data->transition_type(),
+ FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry,
+ ui_timestamp, report_type, GURL(), GURL());
}
#if !defined(OS_ANDROID) || defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
@@ -2687,10 +2688,10 @@ void RenderFrameImpl::didCommitProvisionalLoad(
// the current entry gets a state update and so that we don't send a
// state update to the wrong entry when we swap back in.
DCHECK_IMPLIES(
- navigation_state->start_params().should_replace_current_entry,
+ navigation_state->common_params().should_replace_current_entry,
render_view_->history_list_length_ > 0);
if (GetLoadingUrl() != GURL(kSwappedOutURL) &&
- !navigation_state->start_params().should_replace_current_entry) {
+ !navigation_state->common_params().should_replace_current_entry) {
// Advance our offset in session history, applying the length limit.
// There is now no forward history.
render_view_->history_list_offset_++;
@@ -3243,7 +3244,7 @@ void RenderFrameImpl::willSendRequest(
// TODO(davidben): Avoid this awkward duplication of state. See comment on
// NavigationState::should_replace_current_entry().
should_replace_current_entry =
- navigation_state->start_params().should_replace_current_entry;
+ navigation_state->common_params().should_replace_current_entry;
}
int provider_id = kInvalidServiceWorkerProviderId;
@@ -4390,7 +4391,7 @@ void RenderFrameImpl::OpenURL(WebFrame* frame,
// TODO(davidben): Avoid this awkward duplication of state. See comment on
// NavigationState::should_replace_current_entry().
params.should_replace_current_entry =
- navigation_state->start_params().should_replace_current_entry;
+ navigation_state->common_params().should_replace_current_entry;
}
} else {
params.should_replace_current_entry = false;
@@ -4779,13 +4780,26 @@ void RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request) {
// TODO(clamy): Same-document navigations should not be sent back to the
// browser.
+ // TODO(clamy): Data urls should not be sent back to the browser either.
+ bool should_replace_current_entry = false;
+ WebDataSource* provisional_data_source = frame_->provisionalDataSource();
+ WebDataSource* current_data_source = frame_->dataSource();
+ WebDataSource* data_source =
+ provisional_data_source ? provisional_data_source : current_data_source;
+
+ // The current entry can only be replaced if there already is an entry in the
+ // history list.
+ if (data_source && render_view_->history_list_length_ > 0 &&
+ !frame_->parent()) {
Charlie Reis 2015/07/24 18:25:41 Why is !frame_->parent() here? You can do locatio
clamy 2015/07/27 11:39:40 We were initially worried with Nasko that this wou
+ should_replace_current_entry = data_source->replacesCurrentHistoryItem();
+ }
Send(new FrameHostMsg_BeginNavigation(
- routing_id_, MakeCommonNavigationParams(request),
- BeginNavigationParams(request->httpMethod().latin1(),
- GetWebURLRequestHeaders(*request),
- GetLoadFlagsForWebURLRequest(*request),
- request->hasUserGesture()),
- GetRequestBodyForWebURLRequest(*request)));
+ routing_id_,
+ MakeCommonNavigationParams(request, should_replace_current_entry),
+ BeginNavigationParams(
+ request->httpMethod().latin1(), GetWebURLRequestHeaders(*request),
+ GetLoadFlagsForWebURLRequest(*request), request->hasUserGesture()),
+ GetRequestBodyForWebURLRequest(*request)));
}
void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params,
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698