Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 201aeddc87164fa8660476af330d25bde350a633..004147658c5a9cdab4628befbe6d9ea8e9301f72 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -465,7 +465,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()); |
| @@ -486,10 +487,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) |
| @@ -2640,10 +2641,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_++; |
| @@ -3172,7 +3173,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; |
| @@ -4342,7 +4343,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; |
| @@ -4533,6 +4534,21 @@ void RenderFrameImpl::NavigateInternal( |
| // time to sanitize the navigationStart override set below. |
| base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); |
| + // PlzNavigate |
| + // If this was a client side redirect that should commit in the existing |
| + // page, explicitly tell Blink to load it as such. |
| + // TODO(clamy): see if this shoudl also be the case with subframes (and |
|
Avi (use Gerrit)
2015/07/15 14:39:28
s/shoudl/should/
|
| + // that it does not mess up the manual vs auto subframe classification). |
| + if (browser_side_navigation && |
| + common_params.should_replace_current_entry && !frame_->parent()) { |
| + load_type = blink::WebFrameLoadType::RedirectWithLockedBackForwardList; |
|
Charlie Reis
2015/07/15 22:36:56
This conflicts with https://codereview.chromium.or
|
| + } |
| + |
| + DCHECK_IMPLIES( |
| + load_type == |
| + blink::WebFrameLoadType::RedirectWithLockedBackForwardList, |
| + browser_side_navigation); |
| + |
| // Load the request. |
| frame_->toWebLocalFrame()->load(request, load_type, |
| item_for_history_navigation); |
| @@ -4732,14 +4748,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()) { |
| + should_replace_current_entry = data_source->replacesCurrentHistoryItem(); |
| + } |
| Send(new FrameHostMsg_DidStartLoading(routing_id_, true)); |
| 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, |