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 55ee71666f00cdd1408e0c9456c7ec97d3c619a4..6a5ce4c1c66a2d21a0245e3b85de03b1081a0277 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -797,6 +797,7 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
| IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| OnSetAccessibilityMode) |
| IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) |
| + IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) |
| #if defined(OS_ANDROID) |
| IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
| #elif defined(OS_MACOSX) |
| @@ -809,22 +810,27 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
| } |
| void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| - TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", |
| - "id", routing_id_, "url", params.url.possibly_invalid_spec()); |
| - MaybeHandleDebugURL(params.url); |
| + TRACE_EVENT2("navigation", |
| + "RenderFrameImpl::OnNavigate", |
| + "id", |
| + routing_id_, |
| + "url", |
|
Charlie Reis
2014/09/19 23:12:32
nit: These don't need to be wrapped one-per-line.
clamy
2014/09/23 21:13:26
Done.
|
| + params.core_params.url.possibly_invalid_spec()); |
| + MaybeHandleDebugURL(params.core_params.url); |
| if (!render_view_->webview()) |
| return; |
| - FOR_EACH_OBSERVER( |
| - RenderViewObserver, render_view_->observers_, Navigate(params.url)); |
| + FOR_EACH_OBSERVER(RenderViewObserver, |
| + render_view_->observers_, |
| + Navigate(params.core_params.url)); |
| - bool is_reload = RenderViewImpl::IsReload(params); |
| + bool is_reload = RenderViewImpl::IsReload(params.core_params.navigation_type); |
| WebURLRequest::CachePolicy cache_policy = |
| WebURLRequest::UseProtocolCachePolicy; |
| // If this is a stale back/forward (due to a recent navigation the browser |
| // didn't know about), ignore it. |
| - if (render_view_->IsBackForwardToStaleEntry(params, is_reload)) |
| + if (render_view_->IsBackForwardToStaleEntry(params.commit_params, is_reload)) |
| return; |
| // Swap this renderer back in if necessary. |
| @@ -851,24 +857,30 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| is_swapped_out_ = false; |
| } |
| - if (params.should_clear_history_list) { |
| - CHECK_EQ(params.pending_history_list_offset, -1); |
| - CHECK_EQ(params.current_history_list_offset, -1); |
| - CHECK_EQ(params.current_history_list_length, 0); |
| + int pending_history_list_offset = |
| + params.commit_params.pending_history_list_offset; |
|
nasko
2014/09/22 23:13:04
This method is starting a browser initiated naviga
clamy
2014/09/23 21:13:26
History params are no longer part of CommitParams.
|
| + int current_history_list_offset = |
| + params.commit_params.current_history_list_offset; |
| + int current_history_list_length = |
| + params.commit_params.current_history_list_length; |
| + if (params.commit_params.should_clear_history_list) { |
| + CHECK_EQ(pending_history_list_offset, -1); |
| + CHECK_EQ(current_history_list_offset, -1); |
| + CHECK_EQ(current_history_list_length, 0); |
| } |
| - render_view_->history_list_offset_ = params.current_history_list_offset; |
| - render_view_->history_list_length_ = params.current_history_list_length; |
| + render_view_->history_list_offset_ = current_history_list_offset; |
| + render_view_->history_list_length_ = current_history_list_length; |
| if (render_view_->history_list_length_ >= 0) { |
| render_view_->history_page_ids_.resize( |
| render_view_->history_list_length_, -1); |
| } |
| - if (params.pending_history_list_offset >= 0 && |
| - params.pending_history_list_offset < render_view_->history_list_length_) { |
| - render_view_->history_page_ids_[params.pending_history_list_offset] = |
| - params.page_id; |
| + if (pending_history_list_offset >= 0 && |
| + pending_history_list_offset < render_view_->history_list_length_) { |
| + render_view_->history_page_ids_[pending_history_list_offset] = |
| + params.commit_params.page_id; |
| } |
| - GetContentClient()->SetActiveURL(params.url); |
| + GetContentClient()->SetActiveURL(params.core_params.url); |
| WebFrame* frame = frame_; |
| if (!params.frame_to_navigate.empty()) { |
| @@ -894,20 +906,20 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| // back/forward navigation event. |
| if (is_reload) { |
| bool reload_original_url = |
| - (params.navigation_type == |
| - FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
| - bool ignore_cache = (params.navigation_type == |
| - FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
| + (params.core_params.navigation_type == |
| + FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
| + bool ignore_cache = (params.core_params.navigation_type == |
| + FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
| if (reload_original_url) |
| - frame->reloadWithOverrideURL(params.url, true); |
| + frame->reloadWithOverrideURL(params.core_params.url, true); |
| else |
| frame->reload(ignore_cache); |
| - } else if (params.page_state.IsValid()) { |
| + } else if (params.commit_params.page_state.IsValid()) { |
| // We must know the page ID of the page we are navigating back to. |
| - DCHECK_NE(params.page_id, -1); |
| + DCHECK_NE(params.commit_params.page_id, -1); |
| scoped_ptr<HistoryEntry> entry = |
| - PageStateToHistoryEntry(params.page_state); |
| + PageStateToHistoryEntry(params.commit_params.page_state); |
| if (entry) { |
| // Ensure we didn't save the swapped out URL in UpdateState, since the |
| // browser should never be telling us to navigate to swappedout://. |
| @@ -917,7 +929,8 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| } else if (!params.base_url_for_data_url.is_empty()) { |
| // A loadData request with a specified base URL. |
| std::string mime_type, charset, data; |
| - if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { |
| + if (net::DataURL::Parse( |
| + params.core_params.url, &mime_type, &charset, &data)) { |
| frame->loadData( |
| WebData(data.c_str(), data.length()), |
| WebString::fromUTF8(mime_type), |
| @@ -926,50 +939,52 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| params.history_url_for_data_url, |
| false); |
| } else { |
| - CHECK(false) << |
| - "Invalid URL passed: " << params.url.possibly_invalid_spec(); |
| + CHECK(false) << "Invalid URL passed: " |
| + << params.core_params.url.possibly_invalid_spec(); |
| } |
| } else { |
| // Navigate to the given URL. |
| - WebURLRequest request(params.url); |
| + WebURLRequest request(params.core_params.url); |
| // A session history navigation should have been accompanied by state. |
| - CHECK_EQ(params.page_id, -1); |
| + CHECK_EQ(params.commit_params.page_id, -1); |
| if (frame->isViewSourceModeEnabled()) |
| request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); |
| - if (params.referrer.url.is_valid()) { |
| + if (params.core_params.referrer.url.is_valid()) { |
| WebString referrer = WebSecurityPolicy::generateReferrerHeader( |
| - params.referrer.policy, |
| - params.url, |
| - WebString::fromUTF8(params.referrer.url.spec())); |
| + params.core_params.referrer.policy, |
| + params.core_params.url, |
| + WebString::fromUTF8(params.core_params.referrer.url.spec())); |
| if (!referrer.isEmpty()) |
| - request.setHTTPReferrer(referrer, params.referrer.policy); |
| + request.setHTTPReferrer(referrer, params.core_params.referrer.policy); |
| } |
| - if (!params.extra_headers.empty()) { |
| - for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), |
| - params.extra_headers.end(), "\n"); |
| - i.GetNext(); ) { |
| + if (!params.request_params.extra_headers.empty()) { |
| + for (net::HttpUtil::HeadersIterator i( |
| + params.request_params.extra_headers.begin(), |
| + params.request_params.extra_headers.end(), |
| + "\n"); |
| + i.GetNext();) { |
| request.addHTTPHeaderField(WebString::fromUTF8(i.name()), |
| WebString::fromUTF8(i.values())); |
| } |
| } |
| - if (params.is_post) { |
| + if (params.request_params.is_post) { |
| request.setHTTPMethod(WebString::fromUTF8("POST")); |
| // Set post data. |
| WebHTTPBody http_body; |
| http_body.initialize(); |
| const char* data = NULL; |
| - if (params.browser_initiated_post_data.size()) { |
| + if (params.request_params.browser_initiated_post_data.size()) { |
| data = reinterpret_cast<const char*>( |
| - ¶ms.browser_initiated_post_data.front()); |
| + ¶ms.request_params.browser_initiated_post_data.front()); |
| } |
| - http_body.appendData( |
| - WebData(data, params.browser_initiated_post_data.size())); |
| + http_body.appendData(WebData( |
| + data, params.request_params.browser_initiated_post_data.size())); |
| request.setHTTPBody(http_body); |
| } |
| @@ -982,14 +997,15 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| // Navigation Timing information for the browser-initiated navigations. In |
| // case of cross-process navigations, this carries over the time of |
| // finishing the onbeforeunload handler of the previous page. |
| - DCHECK(!params.browser_navigation_start.is_null()); |
| + DCHECK(!params.commit_params.browser_navigation_start.is_null()); |
| if (frame->provisionalDataSource()) { |
| // |browser_navigation_start| is likely before this process existed, so we |
| // can't use InterProcessTimeTicksConverter. We need at least to ensure |
| // that the browser-side navigation start we set is not later than the one |
| // on the renderer side. |
| - base::TimeTicks navigation_start = std::min( |
| - params.browser_navigation_start, renderer_navigation_start); |
| + base::TimeTicks navigation_start = |
| + std::min(params.commit_params.browser_navigation_start, |
| + renderer_navigation_start); |
| double navigation_start_seconds = |
| (navigation_start - base::TimeTicks()).InSecondsF(); |
| frame->provisionalDataSource()->setNavigationStartTime( |
| @@ -1333,6 +1349,14 @@ void RenderFrameImpl::OnDisownOpener() { |
| frame_->setOpener(NULL); |
| } |
| +// PlzNavigate |
| +void RenderFrameImpl::OnCommitNavigation( |
| + const GURL& stream_url, |
| + const CoreNavigationParams& core_params, |
| + const CommitNavigationParams& commit_params) { |
| + NOTREACHED(); |
| +} |
| + |
| #if defined(OS_ANDROID) |
| void RenderFrameImpl::OnSelectPopupMenuItems( |
| bool canceled, |
| @@ -2136,13 +2160,15 @@ void RenderFrameImpl::didFailProvisionalLoad(blink::WebLocalFrame* frame, |
| if (!navigation_state->is_content_initiated()) { |
| render_view_->pending_navigation_params_.reset( |
| new FrameMsg_Navigate_Params); |
| - render_view_->pending_navigation_params_->page_id = |
| + render_view_->pending_navigation_params_->commit_params.page_id = |
| navigation_state->pending_page_id(); |
| - render_view_->pending_navigation_params_->pending_history_list_offset = |
| + render_view_->pending_navigation_params_->commit_params |
| + .pending_history_list_offset = |
| navigation_state->pending_history_list_offset(); |
| - render_view_->pending_navigation_params_->should_clear_history_list = |
| + render_view_->pending_navigation_params_->commit_params |
| + .should_clear_history_list = |
| navigation_state->history_list_was_cleared(); |
| - render_view_->pending_navigation_params_->transition = |
| + render_view_->pending_navigation_params_->core_params.transition = |
| navigation_state->transition_type(); |
| render_view_->pending_navigation_params_->request_time = |
| document_state->request_time(); |