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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 frame_tree_node_->opener()->current_frame_host(); | 1441 frame_tree_node_->opener()->current_frame_host(); |
1442 if (IsCurrentlySameSite(opener_frame, dest_url)) | 1442 if (IsCurrentlySameSite(opener_frame, dest_url)) |
1443 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); | 1443 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); |
1444 } | 1444 } |
1445 } | 1445 } |
1446 | 1446 |
1447 if (!frame_tree_node_->IsMainFrame() && | 1447 if (!frame_tree_node_->IsMainFrame() && |
1448 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && | 1448 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && |
1449 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, | 1449 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, |
1450 dest_url)) { | 1450 dest_url)) { |
| 1451 RenderFrameHostImpl* main_frame = |
| 1452 frame_tree_node_->frame_tree()->root()->current_frame_host(); |
1451 if (GetContentClient() | 1453 if (GetContentClient() |
1452 ->browser() | 1454 ->browser() |
1453 ->ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( | 1455 ->ShouldIsolateFrameForTopDocumentIsolation( |
1454 dest_url, current_instance)) { | 1456 frame_tree_node_->current_frame_host(), dest_url, |
| 1457 main_frame->GetSiteInstance())) { |
| 1458 // This is a cross-site subframe of a non-isolated origin, so place this |
| 1459 // frame in the default subframe site instance. |
| 1460 return SiteInstanceDescriptor( |
| 1461 browser_context, dest_url, |
| 1462 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); |
| 1463 } else { |
1455 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); | 1464 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); |
1456 } | 1465 } |
1457 | |
1458 // This is a cross-site subframe of a non-isolated origin, so place this | |
1459 // frame in the default subframe site instance. | |
1460 return SiteInstanceDescriptor( | |
1461 browser_context, dest_url, | |
1462 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); | |
1463 } | 1466 } |
1464 | 1467 |
1465 // Keep subframes in the parent's SiteInstance unless a dedicated process is | 1468 // Keep subframes in the parent's SiteInstance unless a dedicated process is |
1466 // required for either the parent or the subframe's destination URL. This | 1469 // required for either the parent or the subframe's destination URL. This |
1467 // isn't a strict invariant but rather a heuristic to avoid unnecessary | 1470 // isn't a strict invariant but rather a heuristic to avoid unnecessary |
1468 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to | 1471 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to |
1469 // TopDocumentIsolation, so do this after TDI checks above. | 1472 // TopDocumentIsolation, so do this after TDI checks above. |
1470 if (!frame_tree_node_->IsMainFrame()) { | 1473 if (!frame_tree_node_->IsMainFrame()) { |
1471 RenderFrameHostImpl* parent = | 1474 RenderFrameHostImpl* parent = |
1472 frame_tree_node_->parent()->current_frame_host(); | 1475 frame_tree_node_->parent()->current_frame_host(); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2848 ->is_hidden() != delegate_->IsHidden()) { | 2851 ->is_hidden() != delegate_->IsHidden()) { |
2849 if (delegate_->IsHidden()) { | 2852 if (delegate_->IsHidden()) { |
2850 view->Hide(); | 2853 view->Hide(); |
2851 } else { | 2854 } else { |
2852 view->Show(); | 2855 view->Show(); |
2853 } | 2856 } |
2854 } | 2857 } |
2855 } | 2858 } |
2856 | 2859 |
2857 } // namespace content | 2860 } // namespace content |
OLD | NEW |