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 6aca3d54347570876a7d072b6c1a53e381ab1740..4dfb19c04c68bddc65e632d0cca6c5616fc358da 100644 |
--- a/content/browser/frame_host/navigator_impl.cc |
+++ b/content/browser/frame_host/navigator_impl.cc |
@@ -36,96 +36,6 @@ namespace content { |
namespace { |
-FrameMsg_Navigate_Type::Value GetNavigationType( |
- BrowserContext* browser_context, const NavigationEntryImpl& entry, |
- NavigationController::ReloadType reload_type) { |
- switch (reload_type) { |
- case NavigationControllerImpl::RELOAD: |
- return FrameMsg_Navigate_Type::RELOAD; |
- case NavigationControllerImpl::RELOAD_IGNORING_CACHE: |
- return FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE; |
- case NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL: |
- return FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
- case NavigationControllerImpl::NO_RELOAD: |
- break; // Fall through to rest of function. |
- } |
- |
- // |RenderViewImpl::PopulateStateFromPendingNavigationParams| differentiates |
- // between |RESTORE_WITH_POST| and |RESTORE|. |
- if (entry.restore_type() == |
- NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) { |
- if (entry.GetHasPostData()) |
- return FrameMsg_Navigate_Type::RESTORE_WITH_POST; |
- return FrameMsg_Navigate_Type::RESTORE; |
- } |
- |
- return FrameMsg_Navigate_Type::NORMAL; |
-} |
- |
-void MakeNavigateParams(const NavigationEntryImpl& entry, |
- const NavigationControllerImpl& controller, |
- 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(); |
- if (!entry.GetBaseURLForDataURL().is_empty()) { |
- params->base_url_for_data_url = entry.GetBaseURLForDataURL(); |
- params->history_url_for_data_url = entry.GetVirtualURL(); |
- } |
- params->referrer = entry.GetReferrer(); |
- params->transition = entry.GetTransitionType(); |
- params->page_state = entry.GetPageState(); |
- params->navigation_type = |
- GetNavigationType(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. |
- params->request_time = base::Time::Now(); |
- params->extra_headers = entry.extra_headers(); |
- params->transferred_request_child_id = |
- entry.transferred_global_request_id().child_id; |
- params->transferred_request_request_id = |
- entry.transferred_global_request_id().request_id; |
- params->is_overriding_user_agent = entry.GetIsOverridingUserAgent(); |
- // Avoid downloading when in view-source mode. |
- params->allow_download = !entry.IsViewSourceMode(); |
- params->is_post = entry.GetHasPostData(); |
- if (entry.GetBrowserInitiatedPostData()) { |
- params->browser_initiated_post_data.assign( |
- entry.GetBrowserInitiatedPostData()->front(), |
- entry.GetBrowserInitiatedPostData()->front() + |
- entry.GetBrowserInitiatedPostData()->size()); |
- } |
- |
- // Set the redirect chain to the navigation's redirects, unless we are |
- // returning to a completed navigation (whose previous redirects don't apply). |
- if (PageTransitionIsNewNavigation(params->transition)) { |
- params->redirects = entry.GetRedirectChain(); |
- } else { |
- params->redirects.clear(); |
- } |
- |
- params->can_load_local_resources = entry.GetCanLoadLocalResources(); |
- params->frame_to_navigate = entry.GetFrameToNavigate(); |
- params->browser_navigation_start = navigation_start; |
-} |
- |
RenderFrameHostManager* GetRenderManager(RenderFrameHostImpl* rfh) { |
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) |
return rfh->frame_tree_node()->render_manager(); |
@@ -135,7 +45,6 @@ RenderFrameHostManager* GetRenderManager(RenderFrameHostImpl* rfh) { |
} // namespace |
- |
NavigatorImpl::NavigatorImpl( |
NavigationControllerImpl* navigation_controller, |
NavigatorDelegate* delegate) |
@@ -334,8 +243,29 @@ bool NavigatorImpl::NavigateToEntry( |
// capture the time needed for the RenderFrameHost initialization. |
base::TimeTicks navigation_start = base::TimeTicks::Now(); |
+ // WebContents uses this to fill LoadNotificationDetails when the load |
+ // completes, so that PerformanceMonitor that listens to the notification can |
+ // record the load time. PerformanceMonitor is no longer maintained. |
+ // TODO(ppi): make this go away. |
+ current_load_start_ = base::TimeTicks::Now(); |
+ |
+ // Create the navigation parameters that may be used directly by the |
+ // RenderFrameHostManager in browser initiated navigation (part of project |
+ // PlzNavigate navigation refactoring). |
+ FrameMsg_Navigate_Params navigate_params; |
+ entry.MakeNavigateParams( |
+ *controller_, reload_type, navigation_start, &navigate_params); |
+ |
RenderFrameHostManager* manager = |
render_frame_host->frame_tree_node()->render_manager(); |
+ |
+ // As part of the PlzNavigate project, the RenderFrameHosts are no longer |
+ // asked to navigate. Instead the RenderFrameHostManager handles the |
+ // navigation requests for that frame node. |
+#if defined(USE_PLZ_NAVIGATE) |
clamy
2014/07/16 12:13:49
Do you think it is better to use a runtime flag in
ppi
2014/07/16 14:28:09
I'm curious to hear Nasko's opinion, personally I
|
+ return manager->RequestNavigation(entry, navigaet_params); |
+#endif |
+ |
RenderFrameHostImpl* dest_render_frame_host = manager->Navigate(entry); |
if (!dest_render_frame_host) |
return false; // Unable to create the desired RenderFrameHost. |
@@ -361,16 +291,7 @@ bool NavigatorImpl::NavigateToEntry( |
if (delegate_) |
delegate_->AboutToNavigateRenderFrame(dest_render_frame_host); |
- // WebContents uses this to fill LoadNotificationDetails when the load |
- // completes, so that PerformanceMonitor that listens to the notification can |
- // record the load time. PerformanceMonitor is no longer maintained. |
- // TODO(ppi): make this go away. |
- current_load_start_ = base::TimeTicks::Now(); |
- |
// Navigate in the desired RenderFrameHost. |
- FrameMsg_Navigate_Params navigate_params; |
- MakeNavigateParams(entry, *controller_, reload_type, navigation_start, |
- &navigate_params); |
dest_render_frame_host->Navigate(navigate_params); |
// Make sure no code called via RFH::Navigate clears the pending entry. |