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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 // doesn't usually swap (e.g., process-per-tab). Any time we return true, | 1238 // doesn't usually swap (e.g., process-per-tab). Any time we return true, |
1239 // the new_entry will be rendered in a new SiteInstance AND BrowsingInstance. | 1239 // the new_entry will be rendered in a new SiteInstance AND BrowsingInstance. |
1240 BrowserContext* browser_context = | 1240 BrowserContext* browser_context = |
1241 delegate_->GetControllerForRenderManager().GetBrowserContext(); | 1241 delegate_->GetControllerForRenderManager().GetBrowserContext(); |
1242 | 1242 |
1243 // Don't force a new BrowsingInstance for debug URLs that are handled in the | 1243 // Don't force a new BrowsingInstance for debug URLs that are handled in the |
1244 // renderer process, like javascript: or chrome://crash. | 1244 // renderer process, like javascript: or chrome://crash. |
1245 if (IsRendererDebugURL(new_effective_url)) | 1245 if (IsRendererDebugURL(new_effective_url)) |
1246 return false; | 1246 return false; |
1247 | 1247 |
| 1248 // about:blank should be safe to load in any BrowsingInstance. |
| 1249 if (new_effective_url == GURL(url::kAboutBlankURL)) |
| 1250 return false; |
| 1251 |
1248 // For security, we should transition between processes when one is a Web UI | 1252 // For security, we should transition between processes when one is a Web UI |
1249 // page and one isn't. | 1253 // page and one isn't, or if the WebUI types differ. |
1250 if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( | 1254 if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( |
1251 render_frame_host_->GetProcess()->GetID()) || | 1255 render_frame_host_->GetProcess()->GetID()) || |
1252 WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( | 1256 WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( |
1253 browser_context, current_effective_url)) { | 1257 browser_context, current_effective_url)) { |
1254 // If so, force a swap if destination is not an acceptable URL for Web UI. | 1258 // If so, force a swap if destination is not an acceptable URL for Web UI. |
1255 // Here, data URLs are never allowed. | 1259 // Here, data URLs are never allowed. |
1256 if (!WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI( | 1260 if (!WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI( |
1257 browser_context, new_effective_url)) { | 1261 browser_context, new_effective_url)) { |
1258 return true; | 1262 return true; |
1259 } | 1263 } |
| 1264 |
| 1265 // Force swap if the current WebUI type differs from the one for the |
| 1266 // destination. |
| 1267 if (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
| 1268 browser_context, current_effective_url) != |
| 1269 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
| 1270 browser_context, new_effective_url)) { |
| 1271 return true; |
| 1272 } |
1260 } else { | 1273 } else { |
1261 // Force a swap if it's a Web UI URL. | 1274 // Force a swap if it's a Web UI URL. |
1262 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( | 1275 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( |
1263 browser_context, new_effective_url)) { | 1276 browser_context, new_effective_url)) { |
1264 return true; | 1277 return true; |
1265 } | 1278 } |
1266 } | 1279 } |
1267 | 1280 |
1268 // Check with the content client as well. Important to pass | 1281 // Check with the content client as well. Important to pass |
1269 // current_effective_url here, which uses the SiteInstance's site if there is | 1282 // current_effective_url here, which uses the SiteInstance's site if there is |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2661 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2649 if (!frame_tree_node_->opener()) | 2662 if (!frame_tree_node_->opener()) |
2650 return MSG_ROUTING_NONE; | 2663 return MSG_ROUTING_NONE; |
2651 | 2664 |
2652 return frame_tree_node_->opener() | 2665 return frame_tree_node_->opener() |
2653 ->render_manager() | 2666 ->render_manager() |
2654 ->GetRoutingIdForSiteInstance(instance); | 2667 ->GetRoutingIdForSiteInstance(instance); |
2655 } | 2668 } |
2656 | 2669 |
2657 } // namespace content | 2670 } // namespace content |
OLD | NEW |