Chromium Code Reviews| 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 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1413 // Use the current SiteInstance for same site navigations. | 1413 // Use the current SiteInstance for same site navigations. |
| 1414 if (IsCurrentlySameSite(render_frame_host_.get(), dest_url)) | 1414 if (IsCurrentlySameSite(render_frame_host_.get(), dest_url)) |
| 1415 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); | 1415 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); |
| 1416 | 1416 |
| 1417 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled()) { | 1417 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled()) { |
| 1418 // TODO(nick): Looking at the main frame and openers is required for TDI | 1418 // TODO(nick): Looking at the main frame and openers is required for TDI |
| 1419 // mode, but should be safe to enable unconditionally. | 1419 // mode, but should be safe to enable unconditionally. |
| 1420 if (!frame_tree_node_->IsMainFrame()) { | 1420 if (!frame_tree_node_->IsMainFrame()) { |
| 1421 RenderFrameHostImpl* main_frame = | 1421 RenderFrameHostImpl* main_frame = |
| 1422 frame_tree_node_->frame_tree()->root()->current_frame_host(); | 1422 frame_tree_node_->frame_tree()->root()->current_frame_host(); |
| 1423 if (IsCurrentlySameSite(main_frame, dest_url)) | 1423 if (IsCurrentlySameSite(main_frame, dest_url)) |
|
ncarter (slow)
2016/11/15 21:42:35
I think you've done the right thing here, but doub
Avi (use Gerrit)
2016/11/16 20:12:11
Um, yes, this is exactly why I did it.
Really, th
| |
| 1424 return SiteInstanceDescriptor(main_frame->GetSiteInstance()); | 1424 return SiteInstanceDescriptor(main_frame->GetSiteInstance()); |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 if (frame_tree_node_->opener()) { | 1427 if (frame_tree_node_->opener()) { |
| 1428 RenderFrameHostImpl* opener_frame = | 1428 RenderFrameHostImpl* opener_frame = |
| 1429 frame_tree_node_->opener()->current_frame_host(); | 1429 frame_tree_node_->opener()->current_frame_host(); |
| 1430 if (IsCurrentlySameSite(opener_frame, dest_url)) | 1430 if (IsCurrentlySameSite(opener_frame, dest_url)) |
| 1431 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); | 1431 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); |
| 1432 } | 1432 } |
| 1433 } | 1433 } |
| 1434 | 1434 |
| 1435 if (!frame_tree_node_->IsMainFrame() && | 1435 if (!frame_tree_node_->IsMainFrame() && |
| 1436 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && | 1436 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && |
| 1437 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, | 1437 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, |
| 1438 dest_url)) { | 1438 dest_url)) { |
| 1439 if (GetContentClient() | |
| 1440 ->browser() | |
| 1441 ->ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( | |
| 1442 dest_url, current_instance)) { | |
| 1443 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); | |
| 1444 } | |
| 1445 | |
| 1439 // This is a cross-site subframe of a non-isolated origin, so place this | 1446 // This is a cross-site subframe of a non-isolated origin, so place this |
| 1440 // frame in the default subframe site instance. | 1447 // frame in the default subframe site instance. |
| 1441 return SiteInstanceDescriptor( | 1448 return SiteInstanceDescriptor( |
| 1442 browser_context, dest_url, | 1449 browser_context, dest_url, |
| 1443 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); | 1450 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); |
| 1444 } | 1451 } |
| 1445 | 1452 |
| 1446 // Start the new renderer in a new SiteInstance, but in the current | 1453 // Start the new renderer in a new SiteInstance, but in the current |
| 1447 // BrowsingInstance. | 1454 // BrowsingInstance. |
| 1448 return SiteInstanceDescriptor(browser_context, dest_url, | 1455 return SiteInstanceDescriptor(browser_context, dest_url, |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2722 resolved_url)) { | 2729 resolved_url)) { |
| 2723 DCHECK(!dest_instance || | 2730 DCHECK(!dest_instance || |
| 2724 dest_instance == render_frame_host_->GetSiteInstance()); | 2731 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2725 return false; | 2732 return false; |
| 2726 } | 2733 } |
| 2727 | 2734 |
| 2728 return true; | 2735 return true; |
| 2729 } | 2736 } |
| 2730 | 2737 |
| 2731 } // namespace content | 2738 } // namespace content |
| OLD | NEW |