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 <string> | 10 #include <string> |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 : existing_site_instance(nullptr), relation(relation_to_current) { | 980 : existing_site_instance(nullptr), relation(relation_to_current) { |
981 new_site_url = SiteInstance::GetSiteForURL(browser_context, dest_url); | 981 new_site_url = SiteInstance::GetSiteForURL(browser_context, dest_url); |
982 } | 982 } |
983 | 983 |
984 void RenderFrameHostManager::RenderProcessGone(SiteInstanceImpl* instance) { | 984 void RenderFrameHostManager::RenderProcessGone(SiteInstanceImpl* instance) { |
985 GetRenderFrameProxyHost(instance)->set_render_frame_proxy_created(false); | 985 GetRenderFrameProxyHost(instance)->set_render_frame_proxy_created(false); |
986 } | 986 } |
987 | 987 |
988 void RenderFrameHostManager::CancelPendingIfNecessary( | 988 void RenderFrameHostManager::CancelPendingIfNecessary( |
989 RenderFrameHostImpl* render_frame_host) { | 989 RenderFrameHostImpl* render_frame_host) { |
990 if (render_frame_host == pending_render_frame_host_.get()) | 990 if (render_frame_host == pending_render_frame_host_.get()) { |
991 CancelPending(); | 991 CancelPending(); |
992 else if (render_frame_host == speculative_render_frame_host_.get()) { | 992 } else if (render_frame_host == speculative_render_frame_host_.get()) { |
993 // TODO(nasko, clamy): This should just clean up the speculative RFH | 993 // TODO(nasko, clamy): This should just clean up the speculative RFH |
994 // without canceling the request. See https://crbug.com/636119. | 994 // without canceling the request. See https://crbug.com/636119. |
995 if (frame_tree_node_->navigation_request() && | 995 if (frame_tree_node_->navigation_request() && |
996 frame_tree_node_->navigation_request()->navigation_handle()) { | 996 frame_tree_node_->navigation_request()->navigation_handle()) { |
997 frame_tree_node_->navigation_request() | 997 frame_tree_node_->navigation_request() |
998 ->navigation_handle() | 998 ->navigation_handle() |
999 ->set_net_error_code(net::ERR_ABORTED); | 999 ->set_net_error_code(net::ERR_ABORTED); |
1000 } | 1000 } |
1001 frame_tree_node_->ResetNavigationRequest(false, true); | 1001 frame_tree_node_->ResetNavigationRequest(false, true); |
1002 } | 1002 } |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 frame_tree_node_->opener()->current_frame_host(); | 1427 frame_tree_node_->opener()->current_frame_host(); |
1428 if (IsCurrentlySameSite(opener_frame, dest_url)) | 1428 if (IsCurrentlySameSite(opener_frame, dest_url)) |
1429 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); | 1429 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); |
1430 } | 1430 } |
1431 } | 1431 } |
1432 | 1432 |
1433 if (!frame_tree_node_->IsMainFrame() && | 1433 if (!frame_tree_node_->IsMainFrame() && |
1434 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && | 1434 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && |
1435 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, | 1435 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, |
1436 dest_url)) { | 1436 dest_url)) { |
| 1437 RenderFrameHostImpl* main_frame = |
| 1438 frame_tree_node_->frame_tree()->root()->current_frame_host(); |
1437 if (GetContentClient() | 1439 if (GetContentClient() |
1438 ->browser() | 1440 ->browser() |
1439 ->ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( | 1441 ->ShouldIsolateFrameForTopDocumentIsolation( |
1440 dest_url, current_instance)) { | 1442 transfer_navigation_handle_.get(), |
1441 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); | 1443 main_frame->GetSiteInstance())) { |
| 1444 // This is a cross-site subframe of a non-isolated origin, so place this |
| 1445 // frame in the default subframe site instance. |
| 1446 return SiteInstanceDescriptor( |
| 1447 browser_context, dest_url, |
| 1448 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); |
1442 } | 1449 } |
1443 | 1450 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); |
1444 // This is a cross-site subframe of a non-isolated origin, so place this | |
1445 // frame in the default subframe site instance. | |
1446 return SiteInstanceDescriptor( | |
1447 browser_context, dest_url, | |
1448 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); | |
1449 } | 1451 } |
1450 | 1452 |
1451 // Keep subframes in the parent's SiteInstance unless a dedicated process is | 1453 // Keep subframes in the parent's SiteInstance unless a dedicated process is |
1452 // required for either the parent or the subframe's destination URL. This | 1454 // required for either the parent or the subframe's destination URL. This |
1453 // isn't a strict invariant but rather a heuristic to avoid unnecessary | 1455 // isn't a strict invariant but rather a heuristic to avoid unnecessary |
1454 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to | 1456 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to |
1455 // TopDocumentIsolation, so do this after TDI checks above. | 1457 // TopDocumentIsolation, so do this after TDI checks above. |
1456 if (!frame_tree_node_->IsMainFrame()) { | 1458 if (!frame_tree_node_->IsMainFrame()) { |
1457 RenderFrameHostImpl* parent = | 1459 RenderFrameHostImpl* parent = |
1458 frame_tree_node_->parent()->current_frame_host(); | 1460 frame_tree_node_->parent()->current_frame_host(); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 ->is_hidden() != delegate_->IsHidden()) { | 2836 ->is_hidden() != delegate_->IsHidden()) { |
2835 if (delegate_->IsHidden()) { | 2837 if (delegate_->IsHidden()) { |
2836 view->Hide(); | 2838 view->Hide(); |
2837 } else { | 2839 } else { |
2838 view->Show(); | 2840 view->Show(); |
2839 } | 2841 } |
2840 } | 2842 } |
2841 } | 2843 } |
2842 | 2844 |
2843 } // namespace content | 2845 } // namespace content |
OLD | NEW |