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

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

Issue 1495993002: Enforce all subframes to be in the same BrowsingInstance as the parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on Charlie's review. Created 5 years 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
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 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 !base::CommandLine::ForCurrentProcess()->HasSwitch( 1262 !base::CommandLine::ForCurrentProcess()->HasSwitch(
1263 switches::kProcessPerTab); 1263 switches::kProcessPerTab);
1264 } 1264 }
1265 1265
1266 bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation( 1266 bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation(
1267 const GURL& current_effective_url, 1267 const GURL& current_effective_url,
1268 bool current_is_view_source_mode, 1268 bool current_is_view_source_mode,
1269 SiteInstance* new_site_instance, 1269 SiteInstance* new_site_instance,
1270 const GURL& new_effective_url, 1270 const GURL& new_effective_url,
1271 bool new_is_view_source_mode) const { 1271 bool new_is_view_source_mode) const {
1272 // A subframe must stay in the same BrowsingInstance as its parent.
1273 // TODO(nasko): Ensure that SiteInstance swap is still triggered for subframes
1274 // in the cases covered by the rest of the checks in this method.
1275 if (!frame_tree_node_->IsMainFrame())
1276 return false;
1277
1272 // If new_entry already has a SiteInstance, assume it is correct. We only 1278 // If new_entry already has a SiteInstance, assume it is correct. We only
1273 // need to force a swap if it is in a different BrowsingInstance. 1279 // need to force a swap if it is in a different BrowsingInstance.
1274 if (new_site_instance) { 1280 if (new_site_instance) {
1275 return !new_site_instance->IsRelatedSiteInstance( 1281 return !new_site_instance->IsRelatedSiteInstance(
1276 render_frame_host_->GetSiteInstance()); 1282 render_frame_host_->GetSiteInstance());
1277 } 1283 }
1278 1284
1279 // Check for reasons to swap processes even if we are in a process model that 1285 // Check for reasons to swap processes even if we are in a process model that
1280 // doesn't usually swap (e.g., process-per-tab). Any time we return true, 1286 // doesn't usually swap (e.g., process-per-tab). Any time we return true,
1281 // the new_entry will be rendered in a new SiteInstance AND BrowsingInstance. 1287 // the new_entry will be rendered in a new SiteInstance AND BrowsingInstance.
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2661 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2656 if (!frame_tree_node_->opener()) 2662 if (!frame_tree_node_->opener())
2657 return MSG_ROUTING_NONE; 2663 return MSG_ROUTING_NONE;
2658 2664
2659 return frame_tree_node_->opener() 2665 return frame_tree_node_->opener()
2660 ->render_manager() 2666 ->render_manager()
2661 ->GetRoutingIdForSiteInstance(instance); 2667 ->GetRoutingIdForSiteInstance(instance);
2662 } 2668 }
2663 2669
2664 } // namespace content 2670 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/site_details_browsertest.cc ('k') | content/test/web_contents_observer_sanity_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698