Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index d9a9d022e72aec08145befd022df7035e747901a..45caf426cea18be0f1115f6fdc3079a8b718e745 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -330,13 +330,6 @@ static RenderViewImpl* (*g_create_render_view_impl)(const ViewMsg_New_Params&) = |
NULL; |
// static |
-bool RenderViewImpl::IsReload(FrameMsg_Navigate_Type::Value navigation_type) { |
- return navigation_type == FrameMsg_Navigate_Type::RELOAD || |
- navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || |
- navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
-} |
- |
-// static |
Referrer RenderViewImpl::GetReferrerFromRequest( |
WebFrame* frame, |
const WebURLRequest& request) { |
@@ -2081,161 +2074,6 @@ const std::string& RenderViewImpl::GetAcceptLanguages() const { |
return renderer_preferences_.accept_languages; |
} |
-void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame, |
- WebDataSource* ds) { |
- bool content_initiated = !pending_navigation_params_.get(); |
- |
- // Make sure any previous redirect URLs end up in our new data source. |
- if (pending_navigation_params_.get()) { |
- for (std::vector<GURL>::const_iterator i = |
- pending_navigation_params_->request_params.redirects.begin(); |
- i != pending_navigation_params_->request_params.redirects.end(); ++i) { |
- ds->appendRedirect(*i); |
- } |
- } |
- |
- DocumentState* document_state = DocumentState::FromDataSource(ds); |
- if (!document_state) { |
- document_state = new DocumentState; |
- ds->setExtraData(document_state); |
- if (!content_initiated) |
- PopulateDocumentStateFromPending(document_state); |
- } |
- |
- // Carry over the user agent override flag, if it exists. |
- if (content_initiated && webview() && webview()->mainFrame() && |
- webview()->mainFrame()->isWebLocalFrame() && |
- webview()->mainFrame()->dataSource()) { |
- DocumentState* old_document_state = |
- DocumentState::FromDataSource(webview()->mainFrame()->dataSource()); |
- if (old_document_state) { |
- InternalDocumentStateData* internal_data = |
- InternalDocumentStateData::FromDocumentState(document_state); |
- InternalDocumentStateData* old_internal_data = |
- InternalDocumentStateData::FromDocumentState(old_document_state); |
- internal_data->set_is_overriding_user_agent( |
- old_internal_data->is_overriding_user_agent()); |
- } |
- } |
- |
- // The rest of RenderView assumes that a WebDataSource will always have a |
- // non-null NavigationState. |
- if (content_initiated) { |
- document_state->set_navigation_state( |
- NavigationStateImpl::CreateContentInitiated()); |
- } else { |
- document_state->set_navigation_state(CreateNavigationStateFromPending()); |
- pending_navigation_params_.reset(); |
- } |
- |
- // DocumentState::referred_by_prefetcher_ is true if we are |
- // navigating from a page that used prefetching using a link on that |
- // page. We are early enough in the request process here that we |
- // can still see the DocumentState of the previous page and set |
- // this value appropriately. |
- // TODO(gavinp): catch the important case of navigation in a new |
- // renderer process. |
- if (webview()) { |
- if (WebFrame* old_frame = webview()->mainFrame()) { |
- const WebURLRequest& original_request = ds->originalRequest(); |
- const GURL referrer( |
- original_request.httpHeaderField(WebString::fromUTF8("Referer"))); |
- if (!referrer.is_empty() && old_frame->isWebLocalFrame() && |
- DocumentState::FromDataSource(old_frame->dataSource()) |
- ->was_prefetcher()) { |
- for (; old_frame; old_frame = old_frame->traverseNext(false)) { |
- WebDataSource* old_frame_ds = old_frame->dataSource(); |
- if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { |
- document_state->set_was_referred_by_prefetcher(true); |
- break; |
- } |
- } |
- } |
- } |
- } |
- |
- if (content_initiated) { |
- const WebURLRequest& request = ds->request(); |
- switch (request.cachePolicy()) { |
- case WebURLRequest::UseProtocolCachePolicy: // normal load. |
- document_state->set_load_type(DocumentState::LINK_LOAD_NORMAL); |
- break; |
- case WebURLRequest::ReloadIgnoringCacheData: // reload. |
- case WebURLRequest::ReloadBypassingCache: // end-to-end reload. |
- document_state->set_load_type(DocumentState::LINK_LOAD_RELOAD); |
- break; |
- case WebURLRequest::ReturnCacheDataElseLoad: // allow stale data. |
- document_state->set_load_type( |
- DocumentState::LINK_LOAD_CACHE_STALE_OK); |
- break; |
- case WebURLRequest::ReturnCacheDataDontLoad: // Don't re-post. |
- document_state->set_load_type(DocumentState::LINK_LOAD_CACHE_ONLY); |
- break; |
- default: |
- NOTREACHED(); |
- } |
- } |
- |
- FOR_EACH_OBSERVER( |
- RenderViewObserver, observers_, DidCreateDataSource(frame, ds)); |
-} |
- |
-void RenderViewImpl::PopulateDocumentStateFromPending( |
- DocumentState* document_state) { |
- document_state->set_request_time( |
- pending_navigation_params_->request_params.request_time); |
- |
- InternalDocumentStateData* internal_data = |
- InternalDocumentStateData::FromDocumentState(document_state); |
- |
- if (!pending_navigation_params_->common_params.url.SchemeIs( |
- url::kJavaScriptScheme) && |
- pending_navigation_params_->common_params.navigation_type == |
- FrameMsg_Navigate_Type::RESTORE) { |
- // We're doing a load of a page that was restored from the last session. By |
- // default this prefers the cache over loading (LOAD_PREFERRING_CACHE) which |
- // can result in stale data for pages that are set to expire. We explicitly |
- // override that by setting the policy here so that as necessary we load |
- // from the network. |
- // |
- // TODO(davidben): Remove this in favor of passing a cache policy to the |
- // loadHistoryItem call in OnNavigate. That requires not overloading |
- // UseProtocolCachePolicy to mean both "normal load" and "determine cache |
- // policy based on load type, etc". |
- internal_data->set_cache_policy_override( |
- WebURLRequest::UseProtocolCachePolicy); |
- } |
- |
- if (IsReload(pending_navigation_params_->common_params.navigation_type)) |
- document_state->set_load_type(DocumentState::RELOAD); |
- else if (pending_navigation_params_->request_params.page_state.IsValid()) |
- document_state->set_load_type(DocumentState::HISTORY_LOAD); |
- else |
- document_state->set_load_type(DocumentState::NORMAL_LOAD); |
- |
- internal_data->set_is_overriding_user_agent( |
- pending_navigation_params_->request_params.is_overriding_user_agent); |
- internal_data->set_must_reset_scroll_and_scale_state( |
- pending_navigation_params_->common_params.navigation_type == |
- FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
- document_state->set_can_load_local_resources( |
- pending_navigation_params_->request_params.can_load_local_resources); |
-} |
- |
-NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { |
- // A navigation resulting from loading a javascript URL should not be treated |
- // as a browser initiated event. Instead, we want it to look as if the page |
- // initiated any load resulting from JS execution. |
- if (!pending_navigation_params_->common_params.url.SchemeIs( |
- url::kJavaScriptScheme)) { |
- return NavigationStateImpl::CreateBrowserInitiated( |
- pending_navigation_params_->common_params, |
- pending_navigation_params_->start_params, |
- pending_navigation_params_->request_params); |
- } |
- return NavigationStateImpl::CreateContentInitiated(); |
-} |
- |
void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
WebIconURL::Type icon_type) { |
if (frame->parent()) |