Index: content/browser/frame_host/navigator_impl.cc |
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc |
index b64af9abe8acce4fd5dfc61a78a21e329e54b82d..b7e7450a72758dd9026ed7cde6cf8b770e448c40 100644 |
--- a/content/browser/frame_host/navigator_impl.cc |
+++ b/content/browser/frame_host/navigator_impl.cc |
@@ -82,29 +82,47 @@ NavigatorImpl::NavigatorImpl( |
} |
// static. |
+scoped_ptr<FrameMsg_CommitNavigation_Params> |
+NavigatorImpl::MakeCommitNavigationParams( |
+ const NavigationEntryImpl& entry, |
+ const NavigatorImpl* navigator, |
+ NavigationController::ReloadType reload_type) { |
+ scoped_ptr<FrameMsg_CommitNavigation_Params> commit_navigation_params( |
+ new FrameMsg_CommitNavigation_Params()); |
+ commit_navigation_params->page_id = entry.GetPageID(); |
+ navigator->controller_->FillHistoryParametersForNavigationEntry( |
(Do not use) nasko
2014/08/28 16:39:08
Do we need navigator for anything else than the co
clamy
2014/09/02 18:25:19
Done.
|
+ entry, |
+ &commit_navigation_params->pending_history_list_offset, |
+ &commit_navigation_params->current_history_list_offset, |
+ &commit_navigation_params->current_history_list_length); |
+ commit_navigation_params->should_clear_history_list = |
+ entry.should_clear_history_list(); |
+ commit_navigation_params->referrer = entry.GetReferrer(); |
+ commit_navigation_params->transition = entry.GetTransitionType(); |
+ commit_navigation_params->page_state = entry.GetPageState(); |
+ commit_navigation_params->navigation_type = GetNavigationType( |
+ navigator->controller_->GetBrowserContext(), entry, reload_type); |
+ commit_navigation_params->is_overriding_user_agent = |
+ entry.GetIsOverridingUserAgent(); |
+ return commit_navigation_params.Pass(); |
+} |
+ |
+// static. |
void NavigatorImpl::MakeNavigateParams( |
const NavigationEntryImpl& entry, |
- const NavigationControllerImpl& controller, |
+ const NavigatorImpl* navigator, |
NavigationController::ReloadType reload_type, |
base::TimeTicks navigation_start, |
FrameMsg_Navigate_Params* params) { |
params->page_id = entry.GetPageID(); |
params->should_clear_history_list = entry.should_clear_history_list(); |
params->should_replace_current_entry = entry.should_replace_entry(); |
- if (entry.should_clear_history_list()) { |
- // Set the history list related parameters to the same values a |
- // NavigationController would return before its first navigation. This will |
- // fully clear the RenderView's view of the session history. |
- params->pending_history_list_offset = -1; |
- params->current_history_list_offset = -1; |
- params->current_history_list_length = 0; |
- } else { |
- params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); |
- params->current_history_list_offset = |
- controller.GetLastCommittedEntryIndex(); |
- params->current_history_list_length = controller.GetEntryCount(); |
- } |
params->url = entry.GetURL(); |
+ navigator->controller_->FillHistoryParametersForNavigationEntry( |
+ entry, |
+ ¶ms->pending_history_list_offset, |
+ ¶ms->current_history_list_offset, |
+ ¶ms->current_history_list_length); |
if (!entry.GetBaseURLForDataURL().is_empty()) { |
params->base_url_for_data_url = entry.GetBaseURLForDataURL(); |
params->history_url_for_data_url = entry.GetVirtualURL(); |
@@ -112,8 +130,8 @@ void NavigatorImpl::MakeNavigateParams( |
params->referrer = entry.GetReferrer(); |
params->transition = entry.GetTransitionType(); |
params->page_state = entry.GetPageState(); |
- params->navigation_type = |
- GetNavigationType(controller.GetBrowserContext(), entry, reload_type); |
+ params->navigation_type = GetNavigationType( |
+ navigator->controller_->GetBrowserContext(), entry, reload_type); |
// This is used by the old performance infrastructure to set up DocumentState |
// associated with the RenderView. |
// TODO(ppi): make it go away. |
@@ -351,7 +369,7 @@ bool NavigatorImpl::NavigateToEntry( |
// Create the navigation parameters. |
FrameMsg_Navigate_Params navigate_params; |
MakeNavigateParams( |
- entry, *controller_, reload_type, navigation_start, &navigate_params); |
+ entry, this, reload_type, navigation_start, &navigate_params); |
RenderFrameHostManager* manager = |
render_frame_host->frame_tree_node()->render_manager(); |
@@ -361,7 +379,9 @@ bool NavigatorImpl::NavigateToEntry( |
// node. |
if (CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableBrowserSideNavigation)) { |
- return manager->RequestNavigation(entry, navigate_params); |
+ return manager->RequestNavigation( |
+ MakeCommitNavigationParams(entry, this, reload_type), |
+ navigate_params); |
} |
RenderFrameHostImpl* dest_render_frame_host = manager->Navigate(entry); |
@@ -664,11 +684,10 @@ void NavigatorImpl::RequestTransferURL( |
void NavigatorImpl::CommitNavigation( |
RenderFrameHostImpl* render_frame_host, |
- const NavigationBeforeCommitInfo& info) { |
+ scoped_ptr<FrameMsg_CommitNavigation_Params> commit_navigation_params) { |
CheckWebUIRendererDoesNotDisplayNormalURL( |
- render_frame_host, info.navigation_url); |
- // TODO(clamy): the render_frame_host should now send a commit IPC to the |
- // renderer. |
+ render_frame_host, commit_navigation_params->url); |
+ render_frame_host->CommitNavigation(*commit_navigation_params.get()); |
} |
void NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( |