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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1057 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1058 #elif defined(OS_MACOSX) | 1058 #elif defined(OS_MACOSX) |
1059 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1059 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
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(const CommonNavigationParams& common_params, |
1068 const CommonNavigationParams& common_params, | 1068 const StartNavigationParams& start_params, |
1069 const StartNavigationParams& start_params, | 1069 const CommitNavigationParams& commit_params) { |
1070 const CommitNavigationParams& commit_params, | |
1071 const HistoryNavigationParams& history_params) { | |
1072 TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_, | 1070 TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_, |
1073 "url", common_params.url.possibly_invalid_spec()); | 1071 "url", common_params.url.possibly_invalid_spec()); |
1074 | 1072 |
1075 bool is_reload = RenderViewImpl::IsReload(common_params.navigation_type); | 1073 bool is_reload = RenderViewImpl::IsReload(common_params.navigation_type); |
1076 bool is_history_navigation = history_params.page_state.IsValid(); | 1074 bool is_history_navigation = commit_params.page_state.IsValid(); |
1077 WebURLRequest::CachePolicy cache_policy = | 1075 WebURLRequest::CachePolicy cache_policy = |
1078 WebURLRequest::UseProtocolCachePolicy; | 1076 WebURLRequest::UseProtocolCachePolicy; |
1079 if (!RenderFrameImpl::PrepareRenderViewForNavigation( | 1077 if (!RenderFrameImpl::PrepareRenderViewForNavigation( |
1080 common_params.url, is_history_navigation, history_params, &is_reload, | 1078 common_params.url, is_history_navigation, commit_params, &is_reload, |
1081 &cache_policy)) { | 1079 &cache_policy)) { |
1082 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); | 1080 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); |
1083 return; | 1081 return; |
1084 } | 1082 } |
1085 | 1083 |
1086 GetContentClient()->SetActiveURL(common_params.url); | 1084 GetContentClient()->SetActiveURL(common_params.url); |
1087 | 1085 |
1088 WebFrame* frame = frame_; | 1086 WebFrame* frame = frame_; |
1089 if (!commit_params.frame_to_navigate.empty()) { | 1087 if (!commit_params.frame_to_navigate.empty()) { |
1090 // TODO(nasko): Move this lookup to the browser process. | 1088 // TODO(nasko): Move this lookup to the browser process. |
1091 frame = render_view_->webview()->findFrameByName( | 1089 frame = render_view_->webview()->findFrameByName( |
1092 WebString::fromUTF8(commit_params.frame_to_navigate)); | 1090 WebString::fromUTF8(commit_params.frame_to_navigate)); |
1093 CHECK(frame) << "Invalid frame name passed: " | 1091 CHECK(frame) << "Invalid frame name passed: " |
1094 << commit_params.frame_to_navigate; | 1092 << commit_params.frame_to_navigate; |
1095 } | 1093 } |
1096 | 1094 |
1097 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { | 1095 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { |
1098 // We cannot reload if we do not have any history state. This happens, for | 1096 // We cannot reload if we do not have any history state. This happens, for |
1099 // example, when recovering from a crash. | 1097 // example, when recovering from a crash. |
1100 is_reload = false; | 1098 is_reload = false; |
1101 cache_policy = WebURLRequest::ReloadIgnoringCacheData; | 1099 cache_policy = WebURLRequest::ReloadIgnoringCacheData; |
1102 } | 1100 } |
1103 | 1101 |
1104 render_view_->pending_navigation_params_.reset(new NavigationParams( | 1102 render_view_->pending_navigation_params_.reset( |
1105 common_params, start_params, commit_params, history_params)); | 1103 new NavigationParams(common_params, start_params, commit_params)); |
1106 | 1104 |
1107 // If we are reloading, then WebKit will use the history state of the current | 1105 // 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 | 1106 // 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 | 1107 // have history state, then we need to navigate to it, which corresponds to a |
1110 // back/forward navigation event. | 1108 // back/forward navigation event. |
1111 if (is_reload) { | 1109 if (is_reload) { |
1112 bool reload_original_url = | 1110 bool reload_original_url = |
1113 (common_params.navigation_type == | 1111 (common_params.navigation_type == |
1114 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); | 1112 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
1115 bool ignore_cache = (common_params.navigation_type == | 1113 bool ignore_cache = (common_params.navigation_type == |
1116 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); | 1114 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
1117 | 1115 |
1118 if (reload_original_url) | 1116 if (reload_original_url) |
1119 frame->reloadWithOverrideURL(common_params.url, true); | 1117 frame->reloadWithOverrideURL(common_params.url, true); |
1120 else | 1118 else |
1121 frame->reload(ignore_cache); | 1119 frame->reload(ignore_cache); |
1122 } else if (is_history_navigation) { | 1120 } else if (is_history_navigation) { |
1123 // We must know the page ID of the page we are navigating back to. | 1121 // We must know the page ID of the page we are navigating back to. |
1124 DCHECK_NE(history_params.page_id, -1); | 1122 DCHECK_NE(commit_params.page_id, -1); |
1125 scoped_ptr<HistoryEntry> entry = | 1123 scoped_ptr<HistoryEntry> entry = |
1126 PageStateToHistoryEntry(history_params.page_state); | 1124 PageStateToHistoryEntry(commit_params.page_state); |
1127 if (entry) { | 1125 if (entry) { |
1128 // Ensure we didn't save the swapped out URL in UpdateState, since the | 1126 // Ensure we didn't save the swapped out URL in UpdateState, since the |
1129 // browser should never be telling us to navigate to swappedout://. | 1127 // browser should never be telling us to navigate to swappedout://. |
1130 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); | 1128 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
1131 render_view_->history_controller()->GoToEntry(entry.Pass(), cache_policy); | 1129 render_view_->history_controller()->GoToEntry(entry.Pass(), cache_policy); |
1132 } | 1130 } |
1133 } else if (!common_params.base_url_for_data_url.is_empty()) { | 1131 } else if (!common_params.base_url_for_data_url.is_empty()) { |
1134 LoadDataURL(common_params, frame); | 1132 LoadDataURL(common_params, frame); |
1135 } else { | 1133 } else { |
1136 // Navigate to the given URL. | 1134 // Navigate to the given URL. |
(...skipping 21 matching lines...) Expand all Loading... |
1158 if (start_params.browser_initiated_post_data.size()) { | 1156 if (start_params.browser_initiated_post_data.size()) { |
1159 data = reinterpret_cast<const char*>( | 1157 data = reinterpret_cast<const char*>( |
1160 &start_params.browser_initiated_post_data.front()); | 1158 &start_params.browser_initiated_post_data.front()); |
1161 } | 1159 } |
1162 http_body.appendData( | 1160 http_body.appendData( |
1163 WebData(data, start_params.browser_initiated_post_data.size())); | 1161 WebData(data, start_params.browser_initiated_post_data.size())); |
1164 request.setHTTPBody(http_body); | 1162 request.setHTTPBody(http_body); |
1165 } | 1163 } |
1166 | 1164 |
1167 // A session history navigation should have been accompanied by state. | 1165 // A session history navigation should have been accompanied by state. |
1168 CHECK_EQ(history_params.page_id, -1); | 1166 CHECK_EQ(commit_params.page_id, -1); |
1169 | 1167 |
1170 // Record this before starting the load, we need a lower bound of this time | 1168 // Record this before starting the load, we need a lower bound of this time |
1171 // to sanitize the navigationStart override set below. | 1169 // to sanitize the navigationStart override set below. |
1172 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); | 1170 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); |
1173 frame->loadRequest(request); | 1171 frame->loadRequest(request); |
1174 | 1172 |
1175 UpdateFrameNavigationTiming(frame, commit_params.browser_navigation_start, | 1173 UpdateFrameNavigationTiming(frame, commit_params.browser_navigation_start, |
1176 renderer_navigation_start); | 1174 renderer_navigation_start); |
1177 } | 1175 } |
1178 | 1176 |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 // 'replace' load. This is necessary to avoid messing up session history. | 2463 // '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 | 2464 // Otherwise, we do a normal load, which simulates a 'go' navigation as far |
2467 // as session history is concerned. | 2465 // as session history is concerned. |
2468 // | 2466 // |
2469 // AUTO_SUBFRAME loads should always be treated as loads that do not advance | 2467 // AUTO_SUBFRAME loads should always be treated as loads that do not advance |
2470 // the page id. | 2468 // the page id. |
2471 // | 2469 // |
2472 // TODO(davidben): This should also take the failed navigation's replacement | 2470 // TODO(davidben): This should also take the failed navigation's replacement |
2473 // state into account, if a location.replace() failed. | 2471 // state into account, if a location.replace() failed. |
2474 bool replace = | 2472 bool replace = |
2475 navigation_state->history_params().page_id != -1 || | 2473 navigation_state->commit_params().page_id != -1 || |
2476 ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), | 2474 ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), |
2477 ui::PAGE_TRANSITION_AUTO_SUBFRAME); | 2475 ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
2478 | 2476 |
2479 // If we failed on a browser initiated request, then make sure that our error | 2477 // 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. | 2478 // page load is regarded as the same browser initiated request. |
2481 if (!navigation_state->IsContentInitiated()) { | 2479 if (!navigation_state->IsContentInitiated()) { |
2482 render_view_->pending_navigation_params_.reset(new NavigationParams( | 2480 render_view_->pending_navigation_params_.reset(new NavigationParams( |
2483 navigation_state->common_params(), navigation_state->start_params(), | 2481 navigation_state->common_params(), navigation_state->start_params(), |
2484 CommitNavigationParams(false, base::TimeTicks(), std::vector<GURL>(), | 2482 navigation_state->commit_params())); |
2485 false, std::string(), | 2483 render_view_->pending_navigation_params_->commit_params.request_time = |
2486 document_state->request_time()), | 2484 document_state->request_time(); |
2487 navigation_state->history_params())); | |
2488 } | 2485 } |
2489 | 2486 |
2490 // Load an error page. | 2487 // Load an error page. |
2491 LoadNavigationErrorPage(failed_request, error, replace); | 2488 LoadNavigationErrorPage(failed_request, error, replace); |
2492 } | 2489 } |
2493 | 2490 |
2494 void RenderFrameImpl::didCommitProvisionalLoad( | 2491 void RenderFrameImpl::didCommitProvisionalLoad( |
2495 blink::WebLocalFrame* frame, | 2492 blink::WebLocalFrame* frame, |
2496 const blink::WebHistoryItem& item, | 2493 const blink::WebHistoryItem& item, |
2497 blink::WebHistoryCommitType commit_type) { | 2494 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 | 2557 // Inspect the navigation_state on this frame to see if the navigation |
2561 // corresponds to a session history navigation... Note: |frame| may or | 2558 // corresponds to a session history navigation... Note: |frame| may or |
2562 // may not be the toplevel frame, but for the case of capturing session | 2559 // 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 | 2560 // 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 | 2561 // we've seen this commit before so that only capture session history once |
2565 // per navigation. | 2562 // per navigation. |
2566 // | 2563 // |
2567 // Note that we need to check if the page ID changed. In the case of a | 2564 // 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 | 2565 // reload, the page ID doesn't change, and UpdateSessionHistory gets the |
2569 // previous URL and the current page ID, which would be wrong. | 2566 // previous URL and the current page ID, which would be wrong. |
2570 if (navigation_state->history_params().page_id != -1 && | 2567 if (navigation_state->commit_params().page_id != -1 && |
2571 navigation_state->history_params().page_id != render_view_->page_id_ && | 2568 navigation_state->commit_params().page_id != render_view_->page_id_ && |
2572 !navigation_state->request_committed()) { | 2569 !navigation_state->request_committed()) { |
2573 // This is a successful session history navigation! | 2570 // This is a successful session history navigation! |
2574 render_view_->page_id_ = navigation_state->history_params().page_id; | 2571 render_view_->page_id_ = navigation_state->commit_params().page_id; |
2575 | 2572 |
2576 render_view_->history_list_offset_ = | 2573 render_view_->history_list_offset_ = |
2577 navigation_state->history_params().pending_history_list_offset; | 2574 navigation_state->commit_params().pending_history_list_offset; |
2578 } | 2575 } |
2579 } | 2576 } |
2580 | 2577 |
2581 bool sent = Send( | 2578 bool sent = Send( |
2582 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); | 2579 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); |
2583 CHECK(sent); // http://crbug.com/407376 | 2580 CHECK(sent); // http://crbug.com/407376 |
2584 | 2581 |
2585 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, | 2582 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, |
2586 DidCommitProvisionalLoad(frame, is_new_navigation)); | 2583 DidCommitProvisionalLoad(frame, is_new_navigation)); |
2587 FOR_EACH_OBSERVER( | 2584 FOR_EACH_OBSERVER( |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3865 | 3862 |
3866 // Send the user agent override back. | 3863 // Send the user agent override back. |
3867 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); | 3864 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); |
3868 | 3865 |
3869 // Track the URL of the original request. We use the first entry of the | 3866 // 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 | 3867 // redirect chain if it exists because the chain may have started in another |
3871 // process. | 3868 // process. |
3872 params.original_request_url = GetOriginalRequestURL(ds); | 3869 params.original_request_url = GetOriginalRequestURL(ds); |
3873 | 3870 |
3874 params.history_list_was_cleared = | 3871 params.history_list_was_cleared = |
3875 navigation_state->history_params().should_clear_history_list; | 3872 navigation_state->commit_params().should_clear_history_list; |
3876 | 3873 |
3877 params.report_type = static_cast<FrameMsg_UILoadMetricsReportType::Value>( | 3874 params.report_type = static_cast<FrameMsg_UILoadMetricsReportType::Value>( |
3878 frame->dataSource()->request().inputPerfMetricReportPolicy()); | 3875 frame->dataSource()->request().inputPerfMetricReportPolicy()); |
3879 params.ui_timestamp = base::TimeTicks() + base::TimeDelta::FromSecondsD( | 3876 params.ui_timestamp = base::TimeTicks() + base::TimeDelta::FromSecondsD( |
3880 frame->dataSource()->request().uiStartTime()); | 3877 frame->dataSource()->request().uiStartTime()); |
3881 | 3878 |
3882 // Save some histogram data so we can compute the average memory used per | 3879 // Save some histogram data so we can compute the average memory used per |
3883 // page load of the glyphs. | 3880 // page load of the glyphs. |
3884 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 3881 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
3885 blink::WebGlyphCache::pageCount()); | 3882 blink::WebGlyphCache::pageCount()); |
3886 | 3883 |
3887 // This message needs to be sent before any of allowScripts(), | 3884 // This message needs to be sent before any of allowScripts(), |
3888 // allowImages(), allowPlugins() is called for the new page, so that when | 3885 // allowImages(), allowPlugins() is called for the new page, so that when |
3889 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 3886 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
3890 // after the FrameHostMsg_DidCommitProvisionalLoad message. | 3887 // after the FrameHostMsg_DidCommitProvisionalLoad message. |
3891 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); | 3888 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); |
3892 } else { | 3889 } else { |
3893 // Subframe navigation: the type depends on whether this navigation | 3890 // Subframe navigation: the type depends on whether this navigation |
3894 // generated a new session history entry. When they do generate a session | 3891 // 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 | 3892 // history entry, it means the user initiated the navigation and we should |
3896 // mark it as such. | 3893 // mark it as such. |
3897 if (commit_type == blink::WebStandardCommit) | 3894 if (commit_type == blink::WebStandardCommit) |
3898 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; | 3895 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; |
3899 else | 3896 else |
3900 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 3897 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
3901 | 3898 |
3902 DCHECK(!navigation_state->history_params().should_clear_history_list); | 3899 DCHECK(!navigation_state->commit_params().should_clear_history_list); |
3903 params.history_list_was_cleared = false; | 3900 params.history_list_was_cleared = false; |
3904 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT; | 3901 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT; |
3905 | 3902 |
3906 // Don't send this message while the subframe is swapped out. | 3903 // Don't send this message while the subframe is swapped out. |
3907 if (!is_swapped_out()) | 3904 if (!is_swapped_out()) |
3908 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); | 3905 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); |
3909 } | 3906 } |
3910 | 3907 |
3911 // If we end up reusing this WebRequest (for example, due to a #ref click), | 3908 // 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. | 3909 // 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) { | 3941 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
3945 if (renderer_accessibility()) | 3942 if (renderer_accessibility()) |
3946 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); | 3943 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); |
3947 } | 3944 } |
3948 | 3945 |
3949 // PlzNavigate | 3946 // PlzNavigate |
3950 void RenderFrameImpl::OnCommitNavigation( | 3947 void RenderFrameImpl::OnCommitNavigation( |
3951 const ResourceResponseHead& response, | 3948 const ResourceResponseHead& response, |
3952 const GURL& stream_url, | 3949 const GURL& stream_url, |
3953 const CommonNavigationParams& common_params, | 3950 const CommonNavigationParams& common_params, |
3954 const CommitNavigationParams& commit_params, | 3951 const CommitNavigationParams& commit_params) { |
3955 const HistoryNavigationParams& history_params) { | |
3956 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 3952 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
3957 switches::kEnableBrowserSideNavigation)); | 3953 switches::kEnableBrowserSideNavigation)); |
3958 bool is_reload = false; | 3954 bool is_reload = false; |
3959 bool is_history_navigation = history_params.page_state.IsValid(); | 3955 bool is_history_navigation = commit_params.page_state.IsValid(); |
3960 WebURLRequest::CachePolicy cache_policy = | 3956 WebURLRequest::CachePolicy cache_policy = |
3961 WebURLRequest::UseProtocolCachePolicy; | 3957 WebURLRequest::UseProtocolCachePolicy; |
3962 if (!RenderFrameImpl::PrepareRenderViewForNavigation( | 3958 if (!RenderFrameImpl::PrepareRenderViewForNavigation( |
3963 common_params.url, is_history_navigation, history_params, &is_reload, | 3959 common_params.url, is_history_navigation, commit_params, &is_reload, |
3964 &cache_policy)) { | 3960 &cache_policy)) { |
3965 return; | 3961 return; |
3966 } | 3962 } |
3967 | 3963 |
3968 GetContentClient()->SetActiveURL(common_params.url); | 3964 GetContentClient()->SetActiveURL(common_params.url); |
3969 | 3965 |
3970 render_view_->pending_navigation_params_.reset(new NavigationParams( | 3966 render_view_->pending_navigation_params_.reset(new NavigationParams( |
3971 common_params, StartNavigationParams(), commit_params, history_params)); | 3967 common_params, StartNavigationParams(), commit_params)); |
3972 | 3968 |
3973 if (!common_params.base_url_for_data_url.is_empty() || | 3969 if (!common_params.base_url_for_data_url.is_empty() || |
3974 common_params.url.SchemeIs(url::kDataScheme)) { | 3970 common_params.url.SchemeIs(url::kDataScheme)) { |
3975 LoadDataURL(common_params, frame_); | 3971 LoadDataURL(common_params, frame_); |
3976 return; | 3972 return; |
3977 } | 3973 } |
3978 | 3974 |
3979 // Create a WebURLRequest that blink can use to get access to the body of the | 3975 // 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 | 3976 // response through a stream in the browser. Blink will then commit the |
3981 // navigation. | 3977 // navigation. |
(...skipping 406 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 CommitNavigationParams& commit_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 commit_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 commit_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 commit_params.current_history_list_length; |
4421 if (history_params.should_clear_history_list) { | 4417 if (commit_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 |