Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1413863006: Change BrowsingInstance when changing WebUI type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 } 1235 }
1236 1236
1237 // Check for reasons to swap processes even if we are in a process model that 1237 // Check for reasons to swap processes even if we are in a process model that
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))
Charlie Reis 2015/10/23 23:09:50 What if we also returned false for about:blank? T
nasko 2015/10/23 23:46:53 Agree!
1246 return false; 1246 return false;
1247 1247
1248 // For security, we should transition between processes when one is a Web UI 1248 // For security, we should transition between processes when one is a Web UI
1249 // page and one isn't. 1249 // page and one isn't.
Charlie Reis 2015/10/23 23:09:50 nit: , or if the Web UI types differ.
nasko 2015/10/23 23:46:53 Done.
1250 if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( 1250 if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
1251 render_frame_host_->GetProcess()->GetID()) || 1251 render_frame_host_->GetProcess()->GetID()) ||
1252 WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( 1252 WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL(
1253 browser_context, current_effective_url)) { 1253 browser_context, current_effective_url)) {
1254 // If so, force a swap if destination is not an acceptable URL for Web UI. 1254 // If so, force a swap if destination is not an acceptable URL for Web UI.
1255 // Here, data URLs are never allowed. 1255 // Here, data URLs are never allowed.
1256 if (!WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI( 1256 if (!WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI(
Charlie Reis 2015/10/23 23:09:50 I'm concerned about the about:blank case. Before,
nasko 2015/10/23 23:46:53 Acknowledged.
1257 browser_context, new_effective_url)) { 1257 browser_context, new_effective_url)) {
1258 return true; 1258 return true;
1259 } 1259 }
1260
1261 // Force swap if the current WebUI type differs from the one for the
1262 // destination.
1263 if (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType(
1264 browser_context, current_effective_url) !=
1265 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType(
1266 browser_context, new_effective_url)) {
1267 return true;
1268 }
1260 } else { 1269 } else {
1261 // Force a swap if it's a Web UI URL. 1270 // Force a swap if it's a Web UI URL.
1262 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( 1271 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL(
1263 browser_context, new_effective_url)) { 1272 browser_context, new_effective_url)) {
1264 return true; 1273 return true;
1265 } 1274 }
1266 } 1275 }
1267 1276
1268 // Check with the content client as well. Important to pass 1277 // Check with the content client as well. Important to pass
1269 // current_effective_url here, which uses the SiteInstance's site if there is 1278 // 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
2648 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2657 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2649 if (!frame_tree_node_->opener()) 2658 if (!frame_tree_node_->opener())
2650 return MSG_ROUTING_NONE; 2659 return MSG_ROUTING_NONE;
2651 2660
2652 return frame_tree_node_->opener() 2661 return frame_tree_node_->opener()
2653 ->render_manager() 2662 ->render_manager()
2654 ->GetRoutingIdForSiteInstance(instance); 2663 ->GetRoutingIdForSiteInstance(instance);
2655 } 2664 }
2656 2665
2657 } // namespace content 2666 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698