| 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/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); | 208 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); |
| 209 // Create a pending RenderFrameHost to use for the navigation. | 209 // Create a pending RenderFrameHost to use for the navigation. |
| 210 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( | 210 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( |
| 211 dest_url, frame_entry.source_site_instance(), frame_entry.site_instance(), | 211 dest_url, frame_entry.source_site_instance(), frame_entry.site_instance(), |
| 212 entry.GetTransitionType(), entry.restore_type() != RestoreType::NONE, | 212 entry.GetTransitionType(), entry.restore_type() != RestoreType::NONE, |
| 213 entry.IsViewSourceMode(), entry.transferred_global_request_id(), | 213 entry.IsViewSourceMode(), entry.transferred_global_request_id(), |
| 214 entry.bindings(), is_reload); | 214 entry.bindings(), is_reload); |
| 215 if (!dest_render_frame_host) | 215 if (!dest_render_frame_host) |
| 216 return nullptr; // We weren't able to create a pending render frame host. | 216 return nullptr; // We weren't able to create a pending render frame host. |
| 217 | 217 |
| 218 // If the current render_frame_host_ isn't live, we should create it so | |
| 219 // that we don't show a sad tab while the dest_render_frame_host fetches | |
| 220 // its first page. (Bug 1145340) | |
| 221 if (dest_render_frame_host != render_frame_host_.get() && | |
| 222 !render_frame_host_->IsRenderFrameLive()) { | |
| 223 // Note: we don't call InitRenderView here because we are navigating away | |
| 224 // soon anyway, and we don't have the NavigationEntry for this host. | |
| 225 delegate_->CreateRenderViewForRenderManager( | |
| 226 render_frame_host_->render_view_host(), MSG_ROUTING_NONE, | |
| 227 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state()); | |
| 228 } | |
| 229 | |
| 230 // If the renderer isn't live, then try to create a new one to satisfy this | 218 // If the renderer isn't live, then try to create a new one to satisfy this |
| 231 // navigation request. | 219 // navigation request. |
| 232 if (!dest_render_frame_host->IsRenderFrameLive()) { | 220 if (!dest_render_frame_host->IsRenderFrameLive()) { |
| 233 // Instruct the destination render frame host to set up a Mojo connection | 221 // Instruct the destination render frame host to set up a Mojo connection |
| 234 // with the new render frame if necessary. Note that this call needs to | 222 // with the new render frame if necessary. Note that this call needs to |
| 235 // occur before initializing the RenderView; the flow of creating the | 223 // occur before initializing the RenderView; the flow of creating the |
| 236 // RenderView can cause browser-side code to execute that expects the this | 224 // RenderView can cause browser-side code to execute that expects the this |
| 237 // RFH's service_manager::InterfaceRegistry to be initialized (e.g., if the | 225 // RFH's service_manager::InterfaceRegistry to be initialized (e.g., if the |
| 238 // site is a | 226 // site is a |
| 239 // WebUI site that is handled via Mojo, then Mojo WebUI code in //chrome | 227 // WebUI site that is handled via Mojo, then Mojo WebUI code in //chrome |
| (...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2751 resolved_url)) { | 2739 resolved_url)) { |
| 2752 DCHECK(!dest_instance || | 2740 DCHECK(!dest_instance || |
| 2753 dest_instance == render_frame_host_->GetSiteInstance()); | 2741 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2754 return false; | 2742 return false; |
| 2755 } | 2743 } |
| 2756 | 2744 |
| 2757 return true; | 2745 return true; |
| 2758 } | 2746 } |
| 2759 | 2747 |
| 2760 } // namespace content | 2748 } // namespace content |
| OLD | NEW |