| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "content/browser/child_process_security_policy_impl.h" | 13 #include "content/browser/child_process_security_policy_impl.h" |
| 14 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 14 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 15 #include "content/browser/frame_host/cross_site_transferring_request.h" | 15 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 16 #include "content/browser/frame_host/debug_urls.h" | 16 #include "content/browser/frame_host/debug_urls.h" |
| 17 #include "content/browser/frame_host/frame_navigation_entry.h" |
| 17 #include "content/browser/frame_host/interstitial_page_impl.h" | 18 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 18 #include "content/browser/frame_host/navigation_controller_impl.h" | 19 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 19 #include "content/browser/frame_host/navigation_entry_impl.h" | 20 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 20 #include "content/browser/frame_host/navigation_request.h" | 21 #include "content/browser/frame_host/navigation_request.h" |
| 21 #include "content/browser/frame_host/navigator.h" | 22 #include "content/browser/frame_host/navigator.h" |
| 22 #include "content/browser/frame_host/render_frame_host_factory.h" | 23 #include "content/browser/frame_host/render_frame_host_factory.h" |
| 23 #include "content/browser/frame_host/render_frame_host_impl.h" | 24 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 24 #include "content/browser/frame_host/render_frame_proxy_host.h" | 25 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 25 #include "content/browser/renderer_host/render_process_host_impl.h" | 26 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 26 #include "content/browser/renderer_host/render_view_host_factory.h" | 27 #include "content/browser/renderer_host/render_view_host_factory.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // potential privilege escalation. | 177 // potential privilege escalation. |
| 177 if (new_web_ui && bindings != NavigationEntryImpl::kInvalidBindings && | 178 if (new_web_ui && bindings != NavigationEntryImpl::kInvalidBindings && |
| 178 new_web_ui->GetBindings() != bindings) { | 179 new_web_ui->GetBindings() != bindings) { |
| 179 RecordAction(base::UserMetricsAction("ProcessSwapBindingsMismatch_RVHM")); | 180 RecordAction(base::UserMetricsAction("ProcessSwapBindingsMismatch_RVHM")); |
| 180 return nullptr; | 181 return nullptr; |
| 181 } | 182 } |
| 182 return new_web_ui.Pass(); | 183 return new_web_ui.Pass(); |
| 183 } | 184 } |
| 184 | 185 |
| 185 RenderFrameHostImpl* RenderFrameHostManager::Navigate( | 186 RenderFrameHostImpl* RenderFrameHostManager::Navigate( |
| 187 const FrameNavigationEntry& frame_entry, |
| 186 const NavigationEntryImpl& entry) { | 188 const NavigationEntryImpl& entry) { |
| 187 TRACE_EVENT1("navigation", "RenderFrameHostManager:Navigate", | 189 TRACE_EVENT1("navigation", "RenderFrameHostManager:Navigate", |
| 188 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); | 190 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); |
| 189 // Create a pending RenderFrameHost to use for the navigation. | 191 // Create a pending RenderFrameHost to use for the navigation. |
| 190 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( | 192 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( |
| 191 entry.GetURL(), entry.source_site_instance(), entry.site_instance(), | 193 frame_entry.url(), |
| 194 // TODO(creis): Move source_site_instance to FNE. |
| 195 entry.source_site_instance(), |
| 196 frame_entry.site_instance(), |
| 192 entry.GetTransitionType(), | 197 entry.GetTransitionType(), |
| 193 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, | 198 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, |
| 194 entry.IsViewSourceMode(), entry.transferred_global_request_id(), | 199 entry.IsViewSourceMode(), entry.transferred_global_request_id(), |
| 195 entry.bindings()); | 200 entry.bindings()); |
| 196 if (!dest_render_frame_host) | 201 if (!dest_render_frame_host) |
| 197 return NULL; // We weren't able to create a pending render frame host. | 202 return NULL; // We weren't able to create a pending render frame host. |
| 198 | 203 |
| 199 // If the current render_frame_host_ isn't live, we should create it so | 204 // If the current render_frame_host_ isn't live, we should create it so |
| 200 // that we don't show a sad tab while the dest_render_frame_host fetches | 205 // that we don't show a sad tab while the dest_render_frame_host fetches |
| 201 // its first page. (Bug 1145340) | 206 // its first page. (Bug 1145340) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // the request. | 257 // the request. |
| 253 if (cross_site_transferring_request_.get() && | 258 if (cross_site_transferring_request_.get() && |
| 254 cross_site_transferring_request_->request_id() == | 259 cross_site_transferring_request_->request_id() == |
| 255 entry.transferred_global_request_id()) { | 260 entry.transferred_global_request_id()) { |
| 256 cross_site_transferring_request_->ReleaseRequest(); | 261 cross_site_transferring_request_->ReleaseRequest(); |
| 257 } | 262 } |
| 258 | 263 |
| 259 return dest_render_frame_host; | 264 return dest_render_frame_host; |
| 260 } | 265 } |
| 261 | 266 |
| 267 RenderFrameHostImpl* RenderFrameHostManager::NavigateMainFrame( |
| 268 const NavigationEntryImpl& entry) { |
| 269 return Navigate(*entry.root_node()->frame_entry, entry); |
| 270 } |
| 271 |
| 262 void RenderFrameHostManager::Stop() { | 272 void RenderFrameHostManager::Stop() { |
| 263 render_frame_host_->Stop(); | 273 render_frame_host_->Stop(); |
| 264 | 274 |
| 265 // If we are cross-navigating, we should stop the pending renderers. This | 275 // If we are cross-navigating, we should stop the pending renderers. This |
| 266 // will lead to a DidFailProvisionalLoad, which will properly destroy them. | 276 // will lead to a DidFailProvisionalLoad, which will properly destroy them. |
| 267 if (cross_navigation_pending_) { | 277 if (cross_navigation_pending_) { |
| 268 pending_render_frame_host_->Send(new FrameMsg_Stop( | 278 pending_render_frame_host_->Send(new FrameMsg_Stop( |
| 269 pending_render_frame_host_->GetRoutingID())); | 279 pending_render_frame_host_->GetRoutingID())); |
| 270 } | 280 } |
| 271 } | 281 } |
| (...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2029 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 2020 SiteInstance* instance) { | 2030 SiteInstance* instance) { |
| 2021 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2031 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 2022 if (iter != proxy_hosts_.end()) { | 2032 if (iter != proxy_hosts_.end()) { |
| 2023 delete iter->second; | 2033 delete iter->second; |
| 2024 proxy_hosts_.erase(iter); | 2034 proxy_hosts_.erase(iter); |
| 2025 } | 2035 } |
| 2026 } | 2036 } |
| 2027 | 2037 |
| 2028 } // namespace content | 2038 } // namespace content |
| OLD | NEW |