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..a5e534edf7d1597231ba9655ed88ed7d6faf5469 100644 |
--- a/content/browser/frame_host/navigator_impl.cc |
+++ b/content/browser/frame_host/navigator_impl.cc |
@@ -62,11 +62,30 @@ FrameMsg_Navigate_Type::Value GetNavigationType( |
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) { |
+RenderFrameHostManager* GetRenderManager(RenderFrameHostImpl* rfh) { |
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) |
+ return rfh->frame_tree_node()->render_manager(); |
+ |
+ return rfh->frame_tree_node()->frame_tree()->root()->render_manager(); |
+} |
+ |
+} // namespace |
+ |
+ |
+NavigatorImpl::NavigatorImpl( |
+ NavigationControllerImpl* navigation_controller, |
+ NavigatorDelegate* delegate) |
+ : controller_(navigation_controller), |
+ delegate_(delegate) { |
+} |
+ |
+// static. |
+void NavigatorImpl::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(); |
@@ -126,23 +145,6 @@ void MakeNavigateParams(const NavigationEntryImpl& entry, |
params->browser_navigation_start = navigation_start; |
} |
-RenderFrameHostManager* GetRenderManager(RenderFrameHostImpl* rfh) { |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) |
- return rfh->frame_tree_node()->render_manager(); |
- |
- return rfh->frame_tree_node()->frame_tree()->root()->render_manager(); |
-} |
- |
-} // namespace |
- |
- |
-NavigatorImpl::NavigatorImpl( |
- NavigationControllerImpl* navigation_controller, |
- NavigatorDelegate* delegate) |
- : controller_(navigation_controller), |
- delegate_(delegate) { |
-} |
- |
NavigationController* NavigatorImpl::GetController() { |
return controller_; |
} |
@@ -334,8 +336,30 @@ 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 refactoring). |
+ FrameMsg_Navigate_Params navigate_params; |
+ MakeNavigateParams( |
+ entry, *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 (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableBrowserSideNavigation)) { |
+ return manager->RequestNavigation(entry, navigate_params); |
+ } |
+ |
RenderFrameHostImpl* dest_render_frame_host = manager->Navigate(entry); |
if (!dest_render_frame_host) |
return false; // Unable to create the desired RenderFrameHost. |
@@ -345,32 +369,14 @@ bool NavigatorImpl::NavigateToEntry( |
// For security, we should never send non-Web-UI URLs to a Web UI renderer. |
// Double check that here. |
- int enabled_bindings = |
- dest_render_frame_host->render_view_host()->GetEnabledBindings(); |
- bool is_allowed_in_web_ui_renderer = |
- WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI( |
- controller_->GetBrowserContext(), entry.GetURL()); |
- if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && |
- !is_allowed_in_web_ui_renderer) { |
- // Log the URL to help us diagnose any future failures of this CHECK. |
- GetContentClient()->SetActiveURL(entry.GetURL()); |
- CHECK(0); |
- } |
+ CheckWebUIRendererDoesNotDisplayNormalURL( |
+ dest_render_frame_host, entry.GetURL()); |
// Notify observers that we will navigate in this RenderFrame. |
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. |
@@ -648,4 +654,20 @@ void NavigatorImpl::RequestTransferURL( |
delegate_->RequestOpenURL(render_frame_host, params); |
} |
+void NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( |
+ RenderFrameHostImpl* render_frame_host, |
+ const GURL& url) { |
+ int enabled_bindings = |
+ render_frame_host->render_view_host()->GetEnabledBindings(); |
+ bool is_allowed_in_web_ui_renderer = |
+ WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI( |
+ controller_->GetBrowserContext(), url); |
+ if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && |
+ !is_allowed_in_web_ui_renderer) { |
+ // Log the URL to help us diagnose any future failures of this CHECK. |
+ GetContentClient()->SetActiveURL(url); |
+ CHECK(0); |
+ } |
+} |
+ |
} // namespace content |