OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 1060 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
1061 #endif | 1061 #endif |
1062 IPC_END_MESSAGE_MAP() | 1062 IPC_END_MESSAGE_MAP() |
1063 | 1063 |
1064 return handled; | 1064 return handled; |
1065 } | 1065 } |
1066 | 1066 |
1067 void RenderFrameImpl::OnNavigate( | 1067 void RenderFrameImpl::OnNavigate( |
1068 const CommonNavigationParams& common_params, | 1068 const CommonNavigationParams& common_params, |
1069 const StartNavigationParams& start_params, | 1069 const StartNavigationParams& start_params, |
1070 const CommitNavigationParams& commit_params, | 1070 const RequestNavigationParams& request_params) { |
1071 const HistoryNavigationParams& history_params) { | |
1072 TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_, | 1071 TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_, |
1073 "url", common_params.url.possibly_invalid_spec()); | 1072 "url", common_params.url.possibly_invalid_spec()); |
1074 | 1073 |
1075 bool is_reload = RenderViewImpl::IsReload(common_params.navigation_type); | 1074 bool is_reload = RenderViewImpl::IsReload(common_params.navigation_type); |
1076 bool is_history_navigation = history_params.page_state.IsValid(); | 1075 bool is_history_navigation = request_params.page_state.IsValid(); |
1077 WebURLRequest::CachePolicy cache_policy = | 1076 WebURLRequest::CachePolicy cache_policy = |
1078 WebURLRequest::UseProtocolCachePolicy; | 1077 WebURLRequest::UseProtocolCachePolicy; |
1079 if (!RenderFrameImpl::PrepareRenderViewForNavigation( | 1078 if (!RenderFrameImpl::PrepareRenderViewForNavigation( |
1080 common_params.url, is_history_navigation, history_params, &is_reload, | 1079 common_params.url, is_history_navigation, request_params, &is_reload, |
1081 &cache_policy)) { | 1080 &cache_policy)) { |
1082 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); | 1081 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); |
1083 return; | 1082 return; |
1084 } | 1083 } |
1085 | 1084 |
1086 GetContentClient()->SetActiveURL(common_params.url); | 1085 GetContentClient()->SetActiveURL(common_params.url); |
1087 | 1086 |
1088 WebFrame* frame = frame_; | 1087 WebFrame* frame = frame_; |
1089 if (!commit_params.frame_to_navigate.empty()) { | 1088 if (!request_params.frame_to_navigate.empty()) { |
1090 // TODO(nasko): Move this lookup to the browser process. | 1089 // TODO(nasko): Move this lookup to the browser process. |
1091 frame = render_view_->webview()->findFrameByName( | 1090 frame = render_view_->webview()->findFrameByName( |
1092 WebString::fromUTF8(commit_params.frame_to_navigate)); | 1091 WebString::fromUTF8(request_params.frame_to_navigate)); |
1093 CHECK(frame) << "Invalid frame name passed: " | 1092 CHECK(frame) << "Invalid frame name passed: " |
1094 << commit_params.frame_to_navigate; | 1093 << request_params.frame_to_navigate; |
1095 } | 1094 } |
1096 | 1095 |
1097 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { | 1096 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { |
1098 // We cannot reload if we do not have any history state. This happens, for | 1097 // We cannot reload if we do not have any history state. This happens, for |
1099 // example, when recovering from a crash. | 1098 // example, when recovering from a crash. |
1100 is_reload = false; | 1099 is_reload = false; |
1101 cache_policy = WebURLRequest::ReloadIgnoringCacheData; | 1100 cache_policy = WebURLRequest::ReloadIgnoringCacheData; |
1102 } | 1101 } |
1103 | 1102 |
1104 render_view_->pending_navigation_params_.reset(new NavigationParams( | 1103 render_view_->pending_navigation_params_.reset( |
1105 common_params, start_params, commit_params, history_params)); | 1104 new NavigationParams(common_params, start_params, request_params)); |
1106 | 1105 |
1107 // If we are reloading, then WebKit will use the history state of the current | 1106 // If we are reloading, then WebKit will use the history state of the current |
1108 // page, so we should just ignore any given history state. Otherwise, if we | 1107 // page, so we should just ignore any given history state. Otherwise, if we |
1109 // have history state, then we need to navigate to it, which corresponds to a | 1108 // have history state, then we need to navigate to it, which corresponds to a |
1110 // back/forward navigation event. | 1109 // back/forward navigation event. |
1111 if (is_reload) { | 1110 if (is_reload) { |
1112 bool reload_original_url = | 1111 bool reload_original_url = |
1113 (common_params.navigation_type == | 1112 (common_params.navigation_type == |
1114 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); | 1113 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
1115 bool ignore_cache = (common_params.navigation_type == | 1114 bool ignore_cache = (common_params.navigation_type == |
1116 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); | 1115 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
1117 | 1116 |
1118 if (reload_original_url) | 1117 if (reload_original_url) |
1119 frame->reloadWithOverrideURL(common_params.url, true); | 1118 frame->reloadWithOverrideURL(common_params.url, true); |
1120 else | 1119 else |
1121 frame->reload(ignore_cache); | 1120 frame->reload(ignore_cache); |
1122 } else if (is_history_navigation) { | 1121 } else if (is_history_navigation) { |
1123 // We must know the page ID of the page we are navigating back to. | 1122 // We must know the page ID of the page we are navigating back to. |
1124 DCHECK_NE(history_params.page_id, -1); | 1123 DCHECK_NE(request_params.page_id, -1); |
1125 scoped_ptr<HistoryEntry> entry = | 1124 scoped_ptr<HistoryEntry> entry = |
1126 PageStateToHistoryEntry(history_params.page_state); | 1125 PageStateToHistoryEntry(request_params.page_state); |
1127 if (entry) { | 1126 if (entry) { |
1128 // Ensure we didn't save the swapped out URL in UpdateState, since the | 1127 // Ensure we didn't save the swapped out URL in UpdateState, since the |
1129 // browser should never be telling us to navigate to swappedout://. | 1128 // browser should never be telling us to navigate to swappedout://. |
1130 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); | 1129 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
1131 render_view_->history_controller()->GoToEntry(entry.Pass(), cache_policy); | 1130 render_view_->history_controller()->GoToEntry(entry.Pass(), cache_policy); |
1132 } | 1131 } |
1133 } else if (!common_params.base_url_for_data_url.is_empty()) { | 1132 } else if (!common_params.base_url_for_data_url.is_empty()) { |
1134 LoadDataURL(common_params, frame); | 1133 LoadDataURL(common_params, frame); |
1135 } else { | 1134 } else { |
1136 // Navigate to the given URL. | 1135 // Navigate to the given URL. |
(...skipping 21 matching lines...) Expand all Loading... |
1158 if (start_params.browser_initiated_post_data.size()) { | 1157 if (start_params.browser_initiated_post_data.size()) { |
1159 data = reinterpret_cast<const char*>( | 1158 data = reinterpret_cast<const char*>( |
1160 &start_params.browser_initiated_post_data.front()); | 1159 &start_params.browser_initiated_post_data.front()); |
1161 } | 1160 } |
1162 http_body.appendData( | 1161 http_body.appendData( |
1163 WebData(data, start_params.browser_initiated_post_data.size())); | 1162 WebData(data, start_params.browser_initiated_post_data.size())); |
1164 request.setHTTPBody(http_body); | 1163 request.setHTTPBody(http_body); |
1165 } | 1164 } |
1166 | 1165 |
1167 // A session history navigation should have been accompanied by state. | 1166 // A session history navigation should have been accompanied by state. |
1168 CHECK_EQ(history_params.page_id, -1); | 1167 CHECK_EQ(request_params.page_id, -1); |
1169 | 1168 |
1170 // Record this before starting the load, we need a lower bound of this time | 1169 // Record this before starting the load, we need a lower bound of this time |
1171 // to sanitize the navigationStart override set below. | 1170 // to sanitize the navigationStart override set below. |
1172 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); | 1171 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); |
1173 frame->loadRequest(request); | 1172 frame->loadRequest(request); |
1174 | 1173 |
1175 UpdateFrameNavigationTiming(frame, commit_params.browser_navigation_start, | 1174 UpdateFrameNavigationTiming(frame, request_params.browser_navigation_start, |
1176 renderer_navigation_start); | 1175 renderer_navigation_start); |
1177 } | 1176 } |
1178 | 1177 |
1179 // In case LoadRequest failed before DidCreateDataSource was called. | 1178 // In case LoadRequest failed before DidCreateDataSource was called. |
1180 render_view_->pending_navigation_params_.reset(); | 1179 render_view_->pending_navigation_params_.reset(); |
1181 } | 1180 } |
1182 | 1181 |
1183 void RenderFrameImpl::NavigateToSwappedOutURL() { | 1182 void RenderFrameImpl::NavigateToSwappedOutURL() { |
1184 // We use loadRequest instead of loadHTMLString because the former commits | 1183 // We use loadRequest instead of loadHTMLString because the former commits |
1185 // synchronously. Otherwise a new navigation can interrupt the navigation | 1184 // synchronously. Otherwise a new navigation can interrupt the navigation |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 // 'replace' load. This is necessary to avoid messing up session history. | 2464 // 'replace' load. This is necessary to avoid messing up session history. |
2466 // Otherwise, we do a normal load, which simulates a 'go' navigation as far | 2465 // Otherwise, we do a normal load, which simulates a 'go' navigation as far |
2467 // as session history is concerned. | 2466 // as session history is concerned. |
2468 // | 2467 // |
2469 // AUTO_SUBFRAME loads should always be treated as loads that do not advance | 2468 // AUTO_SUBFRAME loads should always be treated as loads that do not advance |
2470 // the page id. | 2469 // the page id. |
2471 // | 2470 // |
2472 // TODO(davidben): This should also take the failed navigation's replacement | 2471 // TODO(davidben): This should also take the failed navigation's replacement |
2473 // state into account, if a location.replace() failed. | 2472 // state into account, if a location.replace() failed. |
2474 bool replace = | 2473 bool replace = |
2475 navigation_state->history_params().page_id != -1 || | 2474 navigation_state->request_params().page_id != -1 || |
2476 ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), | 2475 ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), |
2477 ui::PAGE_TRANSITION_AUTO_SUBFRAME); | 2476 ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
2478 | 2477 |
2479 // If we failed on a browser initiated request, then make sure that our error | 2478 // If we failed on a browser initiated request, then make sure that our error |
2480 // page load is regarded as the same browser initiated request. | 2479 // page load is regarded as the same browser initiated request. |
2481 if (!navigation_state->IsContentInitiated()) { | 2480 if (!navigation_state->IsContentInitiated()) { |
2482 render_view_->pending_navigation_params_.reset(new NavigationParams( | 2481 render_view_->pending_navigation_params_.reset(new NavigationParams( |
2483 navigation_state->common_params(), navigation_state->start_params(), | 2482 navigation_state->common_params(), navigation_state->start_params(), |
2484 CommitNavigationParams(false, base::TimeTicks(), std::vector<GURL>(), | 2483 navigation_state->request_params())); |
2485 false, std::string(), | 2484 render_view_->pending_navigation_params_->request_params.request_time = |
2486 document_state->request_time()), | 2485 document_state->request_time(); |
2487 navigation_state->history_params())); | |
2488 } | 2486 } |
2489 | 2487 |
2490 // Load an error page. | 2488 // Load an error page. |
2491 LoadNavigationErrorPage(failed_request, error, replace); | 2489 LoadNavigationErrorPage(failed_request, error, replace); |
2492 } | 2490 } |
2493 | 2491 |
2494 void RenderFrameImpl::didCommitProvisionalLoad( | 2492 void RenderFrameImpl::didCommitProvisionalLoad( |
2495 blink::WebLocalFrame* frame, | 2493 blink::WebLocalFrame* frame, |
2496 const blink::WebHistoryItem& item, | 2494 const blink::WebHistoryItem& item, |
2497 blink::WebHistoryCommitType commit_type) { | 2495 blink::WebHistoryCommitType commit_type) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2560 // Inspect the navigation_state on this frame to see if the navigation | 2558 // Inspect the navigation_state on this frame to see if the navigation |
2561 // corresponds to a session history navigation... Note: |frame| may or | 2559 // corresponds to a session history navigation... Note: |frame| may or |
2562 // may not be the toplevel frame, but for the case of capturing session | 2560 // may not be the toplevel frame, but for the case of capturing session |
2563 // history, the first committed frame suffices. We keep track of whether | 2561 // history, the first committed frame suffices. We keep track of whether |
2564 // we've seen this commit before so that only capture session history once | 2562 // we've seen this commit before so that only capture session history once |
2565 // per navigation. | 2563 // per navigation. |
2566 // | 2564 // |
2567 // Note that we need to check if the page ID changed. In the case of a | 2565 // Note that we need to check if the page ID changed. In the case of a |
2568 // reload, the page ID doesn't change, and UpdateSessionHistory gets the | 2566 // reload, the page ID doesn't change, and UpdateSessionHistory gets the |
2569 // previous URL and the current page ID, which would be wrong. | 2567 // previous URL and the current page ID, which would be wrong. |
2570 if (navigation_state->history_params().page_id != -1 && | 2568 if (navigation_state->request_params().page_id != -1 && |
2571 navigation_state->history_params().page_id != render_view_->page_id_ && | 2569 navigation_state->request_params().page_id != render_view_->page_id_ && |
2572 !navigation_state->request_committed()) { | 2570 !navigation_state->request_committed()) { |
2573 // This is a successful session history navigation! | 2571 // This is a successful session history navigation! |
2574 render_view_->page_id_ = navigation_state->history_params().page_id; | 2572 render_view_->page_id_ = navigation_state->request_params().page_id; |
2575 | 2573 |
2576 render_view_->history_list_offset_ = | 2574 render_view_->history_list_offset_ = |
2577 navigation_state->history_params().pending_history_list_offset; | 2575 navigation_state->request_params().pending_history_list_offset; |
2578 } | 2576 } |
2579 } | 2577 } |
2580 | 2578 |
2581 bool sent = Send( | 2579 bool sent = Send( |
2582 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); | 2580 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); |
2583 CHECK(sent); // http://crbug.com/407376 | 2581 CHECK(sent); // http://crbug.com/407376 |
2584 | 2582 |
2585 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, | 2583 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, |
2586 DidCommitProvisionalLoad(frame, is_new_navigation)); | 2584 DidCommitProvisionalLoad(frame, is_new_navigation)); |
2587 FOR_EACH_OBSERVER( | 2585 FOR_EACH_OBSERVER( |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3865 | 3863 |
3866 // Send the user agent override back. | 3864 // Send the user agent override back. |
3867 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); | 3865 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); |
3868 | 3866 |
3869 // Track the URL of the original request. We use the first entry of the | 3867 // Track the URL of the original request. We use the first entry of the |
3870 // redirect chain if it exists because the chain may have started in another | 3868 // redirect chain if it exists because the chain may have started in another |
3871 // process. | 3869 // process. |
3872 params.original_request_url = GetOriginalRequestURL(ds); | 3870 params.original_request_url = GetOriginalRequestURL(ds); |
3873 | 3871 |
3874 params.history_list_was_cleared = | 3872 params.history_list_was_cleared = |
3875 navigation_state->history_params().should_clear_history_list; | 3873 navigation_state->request_params().should_clear_history_list; |
3876 | 3874 |
3877 params.report_type = static_cast<FrameMsg_UILoadMetricsReportType::Value>( | 3875 params.report_type = static_cast<FrameMsg_UILoadMetricsReportType::Value>( |
3878 frame->dataSource()->request().inputPerfMetricReportPolicy()); | 3876 frame->dataSource()->request().inputPerfMetricReportPolicy()); |
3879 params.ui_timestamp = base::TimeTicks() + base::TimeDelta::FromSecondsD( | 3877 params.ui_timestamp = base::TimeTicks() + base::TimeDelta::FromSecondsD( |
3880 frame->dataSource()->request().uiStartTime()); | 3878 frame->dataSource()->request().uiStartTime()); |
3881 | 3879 |
3882 // Save some histogram data so we can compute the average memory used per | 3880 // Save some histogram data so we can compute the average memory used per |
3883 // page load of the glyphs. | 3881 // page load of the glyphs. |
3884 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 3882 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
3885 blink::WebGlyphCache::pageCount()); | 3883 blink::WebGlyphCache::pageCount()); |
3886 | 3884 |
3887 // This message needs to be sent before any of allowScripts(), | 3885 // This message needs to be sent before any of allowScripts(), |
3888 // allowImages(), allowPlugins() is called for the new page, so that when | 3886 // allowImages(), allowPlugins() is called for the new page, so that when |
3889 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 3887 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
3890 // after the FrameHostMsg_DidCommitProvisionalLoad message. | 3888 // after the FrameHostMsg_DidCommitProvisionalLoad message. |
3891 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); | 3889 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); |
3892 } else { | 3890 } else { |
3893 // Subframe navigation: the type depends on whether this navigation | 3891 // Subframe navigation: the type depends on whether this navigation |
3894 // generated a new session history entry. When they do generate a session | 3892 // generated a new session history entry. When they do generate a session |
3895 // history entry, it means the user initiated the navigation and we should | 3893 // history entry, it means the user initiated the navigation and we should |
3896 // mark it as such. | 3894 // mark it as such. |
3897 if (commit_type == blink::WebStandardCommit) | 3895 if (commit_type == blink::WebStandardCommit) |
3898 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; | 3896 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; |
3899 else | 3897 else |
3900 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 3898 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
3901 | 3899 |
3902 DCHECK(!navigation_state->history_params().should_clear_history_list); | 3900 DCHECK(!navigation_state->request_params().should_clear_history_list); |
3903 params.history_list_was_cleared = false; | 3901 params.history_list_was_cleared = false; |
3904 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT; | 3902 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT; |
3905 | 3903 |
3906 // Don't send this message while the subframe is swapped out. | 3904 // Don't send this message while the subframe is swapped out. |
3907 if (!is_swapped_out()) | 3905 if (!is_swapped_out()) |
3908 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); | 3906 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); |
3909 } | 3907 } |
3910 | 3908 |
3911 // If we end up reusing this WebRequest (for example, due to a #ref click), | 3909 // If we end up reusing this WebRequest (for example, due to a #ref click), |
3912 // we don't want the transition type to persist. Just clear it. | 3910 // we don't want the transition type to persist. Just clear it. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3944 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 3942 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
3945 if (renderer_accessibility()) | 3943 if (renderer_accessibility()) |
3946 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); | 3944 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); |
3947 } | 3945 } |
3948 | 3946 |
3949 // PlzNavigate | 3947 // PlzNavigate |
3950 void RenderFrameImpl::OnCommitNavigation( | 3948 void RenderFrameImpl::OnCommitNavigation( |
3951 const ResourceResponseHead& response, | 3949 const ResourceResponseHead& response, |
3952 const GURL& stream_url, | 3950 const GURL& stream_url, |
3953 const CommonNavigationParams& common_params, | 3951 const CommonNavigationParams& common_params, |
3954 const CommitNavigationParams& commit_params, | 3952 const RequestNavigationParams& request_params) { |
3955 const HistoryNavigationParams& history_params) { | |
3956 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 3953 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
3957 switches::kEnableBrowserSideNavigation)); | 3954 switches::kEnableBrowserSideNavigation)); |
3958 bool is_reload = false; | 3955 bool is_reload = false; |
3959 bool is_history_navigation = history_params.page_state.IsValid(); | 3956 bool is_history_navigation = request_params.page_state.IsValid(); |
3960 WebURLRequest::CachePolicy cache_policy = | 3957 WebURLRequest::CachePolicy cache_policy = |
3961 WebURLRequest::UseProtocolCachePolicy; | 3958 WebURLRequest::UseProtocolCachePolicy; |
3962 if (!RenderFrameImpl::PrepareRenderViewForNavigation( | 3959 if (!RenderFrameImpl::PrepareRenderViewForNavigation( |
3963 common_params.url, is_history_navigation, history_params, &is_reload, | 3960 common_params.url, is_history_navigation, request_params, &is_reload, |
3964 &cache_policy)) { | 3961 &cache_policy)) { |
3965 return; | 3962 return; |
3966 } | 3963 } |
3967 | 3964 |
3968 GetContentClient()->SetActiveURL(common_params.url); | 3965 GetContentClient()->SetActiveURL(common_params.url); |
3969 | 3966 |
3970 render_view_->pending_navigation_params_.reset(new NavigationParams( | 3967 render_view_->pending_navigation_params_.reset(new NavigationParams( |
3971 common_params, StartNavigationParams(), commit_params, history_params)); | 3968 common_params, StartNavigationParams(), request_params)); |
3972 | 3969 |
3973 if (!common_params.base_url_for_data_url.is_empty() || | 3970 if (!common_params.base_url_for_data_url.is_empty() || |
3974 common_params.url.SchemeIs(url::kDataScheme)) { | 3971 common_params.url.SchemeIs(url::kDataScheme)) { |
3975 LoadDataURL(common_params, frame_); | 3972 LoadDataURL(common_params, frame_); |
3976 return; | 3973 return; |
3977 } | 3974 } |
3978 | 3975 |
3979 // Create a WebURLRequest that blink can use to get access to the body of the | 3976 // Create a WebURLRequest that blink can use to get access to the body of the |
3980 // response through a stream in the browser. Blink will then commit the | 3977 // response through a stream in the browser. Blink will then commit the |
3981 // navigation. | 3978 // navigation. |
3982 // TODO(clamy): Have the navigation commit directly, without going through | 3979 // TODO(clamy): Have the navigation commit directly, without going through |
3983 // loading a WebURLRequest. | 3980 // loading a WebURLRequest. |
3984 scoped_ptr<StreamOverrideParameters> stream_override( | 3981 scoped_ptr<StreamOverrideParameters> stream_override( |
3985 new StreamOverrideParameters()); | 3982 new StreamOverrideParameters()); |
3986 stream_override->stream_url = stream_url; | 3983 stream_override->stream_url = stream_url; |
3987 stream_override->response = response; | 3984 stream_override->response = response; |
3988 WebURLRequest request = | 3985 WebURLRequest request = |
3989 CreateURLRequestForNavigation(common_params, | 3986 CreateURLRequestForNavigation(common_params, |
3990 stream_override.Pass(), | 3987 stream_override.Pass(), |
3991 frame_->isViewSourceModeEnabled()); | 3988 frame_->isViewSourceModeEnabled()); |
3992 | 3989 |
3993 // Make sure that blink loader will not try to use browser side navigation for | 3990 // Make sure that blink loader will not try to use browser side navigation for |
3994 // this request (since it already went to the browser). | 3991 // this request (since it already went to the browser). |
3995 request.setCheckForBrowserSideNavigation(false); | 3992 request.setCheckForBrowserSideNavigation(false); |
3996 | 3993 |
3997 // Record this before starting the load. A lower bound of this time is needed | 3994 // Record this before starting the load. A lower bound of this time is needed |
3998 // to sanitize the navigationStart override set below. | 3995 // to sanitize the navigationStart override set below. |
3999 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); | 3996 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); |
4000 frame_->loadRequest(request); | 3997 frame_->loadRequest(request); |
4001 UpdateFrameNavigationTiming( | 3998 UpdateFrameNavigationTiming(frame_, request_params.browser_navigation_start, |
4002 frame_, commit_params.browser_navigation_start, | 3999 renderer_navigation_start); |
4003 renderer_navigation_start); | |
4004 } | 4000 } |
4005 | 4001 |
4006 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 4002 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
4007 RenderFrame* render_frame, | 4003 RenderFrame* render_frame, |
4008 const NavigationPolicyInfo& info) { | 4004 const NavigationPolicyInfo& info) { |
4009 #ifdef OS_ANDROID | 4005 #ifdef OS_ANDROID |
4010 // The handlenavigation API is deprecated and will be removed once | 4006 // The handlenavigation API is deprecated and will be removed once |
4011 // crbug.com/325351 is resolved. | 4007 // crbug.com/325351 is resolved. |
4012 if (info.urlRequest.url() != GURL(kSwappedOutURL) && | 4008 if (info.urlRequest.url() != GURL(kSwappedOutURL) && |
4013 GetContentClient()->renderer()->HandleNavigation( | 4009 GetContentClient()->renderer()->HandleNavigation( |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4388 new MediaStreamRendererFactory()); | 4384 new MediaStreamRendererFactory()); |
4389 #else | 4385 #else |
4390 return scoped_ptr<MediaStreamRendererFactory>( | 4386 return scoped_ptr<MediaStreamRendererFactory>( |
4391 static_cast<MediaStreamRendererFactory*>(NULL)); | 4387 static_cast<MediaStreamRendererFactory*>(NULL)); |
4392 #endif | 4388 #endif |
4393 } | 4389 } |
4394 | 4390 |
4395 bool RenderFrameImpl::PrepareRenderViewForNavigation( | 4391 bool RenderFrameImpl::PrepareRenderViewForNavigation( |
4396 const GURL& url, | 4392 const GURL& url, |
4397 bool is_history_navigation, | 4393 bool is_history_navigation, |
4398 const HistoryNavigationParams& history_params, | 4394 const RequestNavigationParams& request_params, |
4399 bool* is_reload, | 4395 bool* is_reload, |
4400 WebURLRequest::CachePolicy* cache_policy) { | 4396 WebURLRequest::CachePolicy* cache_policy) { |
4401 MaybeHandleDebugURL(url); | 4397 MaybeHandleDebugURL(url); |
4402 if (!render_view_->webview()) | 4398 if (!render_view_->webview()) |
4403 return false; | 4399 return false; |
4404 | 4400 |
4405 FOR_EACH_OBSERVER( | 4401 FOR_EACH_OBSERVER( |
4406 RenderViewObserver, render_view_->observers_, Navigate(url)); | 4402 RenderViewObserver, render_view_->observers_, Navigate(url)); |
4407 | 4403 |
4408 // If this is a stale back/forward (due to a recent navigation the browser | 4404 // If this is a stale back/forward (due to a recent navigation the browser |
4409 // didn't know about), ignore it. Only check if swapped in because if the | 4405 // didn't know about), ignore it. Only check if swapped in because if the |
4410 // frame is swapped out, it won't commit before asking the browser. | 4406 // frame is swapped out, it won't commit before asking the browser. |
4411 if (!render_view_->is_swapped_out() && is_history_navigation && | 4407 if (!render_view_->is_swapped_out() && is_history_navigation && |
4412 render_view_->history_list_offset_ != | 4408 render_view_->history_list_offset_ != |
4413 history_params.current_history_list_offset) { | 4409 request_params.current_history_list_offset) { |
4414 return false; | 4410 return false; |
4415 } | 4411 } |
4416 | 4412 |
4417 render_view_->history_list_offset_ = | 4413 render_view_->history_list_offset_ = |
4418 history_params.current_history_list_offset; | 4414 request_params.current_history_list_offset; |
4419 render_view_->history_list_length_ = | 4415 render_view_->history_list_length_ = |
4420 history_params.current_history_list_length; | 4416 request_params.current_history_list_length; |
4421 if (history_params.should_clear_history_list) { | 4417 if (request_params.should_clear_history_list) { |
4422 CHECK_EQ(-1, render_view_->history_list_offset_); | 4418 CHECK_EQ(-1, render_view_->history_list_offset_); |
4423 CHECK_EQ(0, render_view_->history_list_length_); | 4419 CHECK_EQ(0, render_view_->history_list_length_); |
4424 } | 4420 } |
4425 | 4421 |
4426 if (!is_swapped_out_ || frame_->parent()) | 4422 if (!is_swapped_out_ || frame_->parent()) |
4427 return true; | 4423 return true; |
4428 | 4424 |
4429 // This is a swapped out main frame, so swap the renderer back in. | 4425 // This is a swapped out main frame, so swap the renderer back in. |
4430 // We marked the view as hidden when swapping the view out, so be sure to | 4426 // We marked the view as hidden when swapping the view out, so be sure to |
4431 // reset the visibility state before navigating to the new URL. | 4427 // reset the visibility state before navigating to the new URL. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4564 | 4560 |
4565 #if defined(ENABLE_BROWSER_CDMS) | 4561 #if defined(ENABLE_BROWSER_CDMS) |
4566 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 4562 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
4567 if (!cdm_manager_) | 4563 if (!cdm_manager_) |
4568 cdm_manager_ = new RendererCdmManager(this); | 4564 cdm_manager_ = new RendererCdmManager(this); |
4569 return cdm_manager_; | 4565 return cdm_manager_; |
4570 } | 4566 } |
4571 #endif // defined(ENABLE_BROWSER_CDMS) | 4567 #endif // defined(ENABLE_BROWSER_CDMS) |
4572 | 4568 |
4573 } // namespace content | 4569 } // namespace content |
OLD | NEW |