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 <utility> | 10 #include <utility> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 FrameTreeNode::GloballyFindByID( | 192 FrameTreeNode::GloballyFindByID( |
193 delegate_->GetOuterDelegateFrameTreeNodeId()); | 193 delegate_->GetOuterDelegateFrameTreeNodeId()); |
194 DCHECK(outer_delegate_frame_tree_node->parent()); | 194 DCHECK(outer_delegate_frame_tree_node->parent()); |
195 outer_delegate_frame_tree_node->frame_tree()->RemoveFrame( | 195 outer_delegate_frame_tree_node->frame_tree()->RemoveFrame( |
196 outer_delegate_frame_tree_node); | 196 outer_delegate_frame_tree_node); |
197 } | 197 } |
198 | 198 |
199 RenderFrameHostImpl* RenderFrameHostManager::Navigate( | 199 RenderFrameHostImpl* RenderFrameHostManager::Navigate( |
200 const GURL& dest_url, | 200 const GURL& dest_url, |
201 const FrameNavigationEntry& frame_entry, | 201 const FrameNavigationEntry& frame_entry, |
202 const NavigationEntryImpl& entry) { | 202 const NavigationEntryImpl& entry, |
| 203 bool is_reload) { |
203 TRACE_EVENT1("navigation", "RenderFrameHostManager:Navigate", | 204 TRACE_EVENT1("navigation", "RenderFrameHostManager:Navigate", |
204 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); | 205 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); |
205 // Create a pending RenderFrameHost to use for the navigation. | 206 // Create a pending RenderFrameHost to use for the navigation. |
206 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( | 207 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( |
207 dest_url, frame_entry.source_site_instance(), frame_entry.site_instance(), | 208 dest_url, frame_entry.source_site_instance(), frame_entry.site_instance(), |
208 entry.GetTransitionType(), | 209 entry.GetTransitionType(), |
209 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, | 210 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, |
210 entry.IsViewSourceMode(), entry.transferred_global_request_id(), | 211 entry.IsViewSourceMode(), entry.transferred_global_request_id(), |
211 entry.bindings()); | 212 entry.bindings(), is_reload); |
212 if (!dest_render_frame_host) | 213 if (!dest_render_frame_host) |
213 return nullptr; // We weren't able to create a pending render frame host. | 214 return nullptr; // We weren't able to create a pending render frame host. |
214 | 215 |
215 // If the current render_frame_host_ isn't live, we should create it so | 216 // If the current render_frame_host_ isn't live, we should create it so |
216 // that we don't show a sad tab while the dest_render_frame_host fetches | 217 // that we don't show a sad tab while the dest_render_frame_host fetches |
217 // its first page. (Bug 1145340) | 218 // its first page. (Bug 1145340) |
218 if (dest_render_frame_host != render_frame_host_.get() && | 219 if (dest_render_frame_host != render_frame_host_.get() && |
219 !render_frame_host_->IsRenderFrameLive()) { | 220 !render_frame_host_->IsRenderFrameLive()) { |
220 // Note: we don't call InitRenderView here because we are navigating away | 221 // Note: we don't call InitRenderView here because we are navigating away |
221 // soon anyway, and we don't have the NavigationEntry for this host. | 222 // soon anyway, and we don't have the NavigationEntry for this host. |
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 } | 2107 } |
2107 | 2108 |
2108 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( | 2109 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( |
2109 const GURL& dest_url, | 2110 const GURL& dest_url, |
2110 SiteInstance* source_instance, | 2111 SiteInstance* source_instance, |
2111 SiteInstance* dest_instance, | 2112 SiteInstance* dest_instance, |
2112 ui::PageTransition transition, | 2113 ui::PageTransition transition, |
2113 bool dest_is_restore, | 2114 bool dest_is_restore, |
2114 bool dest_is_view_source_mode, | 2115 bool dest_is_view_source_mode, |
2115 const GlobalRequestID& transferred_request_id, | 2116 const GlobalRequestID& transferred_request_id, |
2116 int bindings) { | 2117 int bindings, |
| 2118 bool is_reload) { |
2117 if (!frame_tree_node_->IsMainFrame() && | 2119 if (!frame_tree_node_->IsMainFrame() && |
2118 !CanSubframeSwapProcess(dest_url, source_instance, dest_instance)) { | 2120 !CanSubframeSwapProcess(dest_url, source_instance, dest_instance)) { |
2119 // Note: Do not add code here to determine whether the subframe should swap | 2121 // Note: Do not add code here to determine whether the subframe should swap |
2120 // or not. Add it to CanSubframeSwapProcess instead. | 2122 // or not. Add it to CanSubframeSwapProcess instead. |
2121 return render_frame_host_.get(); | 2123 return render_frame_host_.get(); |
2122 } | 2124 } |
2123 | 2125 |
2124 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 2126 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
2125 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( | 2127 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( |
2126 dest_url, source_instance, dest_instance, nullptr, transition, | 2128 dest_url, source_instance, dest_instance, nullptr, transition, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2189 // a timeout). If the handler returns false, we'll have to cancel the | 2191 // a timeout). If the handler returns false, we'll have to cancel the |
2190 // request. | 2192 // request. |
2191 // | 2193 // |
2192 // Also make sure the old render view stops, in case a load is in | 2194 // Also make sure the old render view stops, in case a load is in |
2193 // progress. (We don't want to do this for transfers, since it will | 2195 // progress. (We don't want to do this for transfers, since it will |
2194 // interrupt the transfer with an unexpected DidStopLoading.) | 2196 // interrupt the transfer with an unexpected DidStopLoading.) |
2195 render_frame_host_->Send(new FrameMsg_Stop( | 2197 render_frame_host_->Send(new FrameMsg_Stop( |
2196 render_frame_host_->GetRoutingID())); | 2198 render_frame_host_->GetRoutingID())); |
2197 pending_render_frame_host_->SetNavigationsSuspended(true, | 2199 pending_render_frame_host_->SetNavigationsSuspended(true, |
2198 base::TimeTicks()); | 2200 base::TimeTicks()); |
2199 render_frame_host_->DispatchBeforeUnload(true); | 2201 render_frame_host_->DispatchBeforeUnload(true, is_reload); |
2200 } | 2202 } |
2201 | 2203 |
2202 return pending_render_frame_host_.get(); | 2204 return pending_render_frame_host_.get(); |
2203 } | 2205 } |
2204 | 2206 |
2205 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. | 2207 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. |
2206 | 2208 |
2207 // It's possible to swap out the current RFH and then decide to navigate in it | 2209 // It's possible to swap out the current RFH and then decide to navigate in it |
2208 // anyway (e.g., a cross-process navigation that redirects back to the | 2210 // anyway (e.g., a cross-process navigation that redirects back to the |
2209 // original site). In that case, we have a proxy for the current RFH but | 2211 // original site). In that case, we have a proxy for the current RFH but |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 resolved_url)) { | 2567 resolved_url)) { |
2566 DCHECK(!dest_instance || | 2568 DCHECK(!dest_instance || |
2567 dest_instance == render_frame_host_->GetSiteInstance()); | 2569 dest_instance == render_frame_host_->GetSiteInstance()); |
2568 return false; | 2570 return false; |
2569 } | 2571 } |
2570 | 2572 |
2571 return true; | 2573 return true; |
2572 } | 2574 } |
2573 | 2575 |
2574 } // namespace content | 2576 } // namespace content |
OLD | NEW |