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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 frame_tree_node_->opener()->current_frame_host(); | 1421 frame_tree_node_->opener()->current_frame_host(); |
1422 if (IsCurrentlySameSite(opener_frame, dest_url)) | 1422 if (IsCurrentlySameSite(opener_frame, dest_url)) |
1423 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); | 1423 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); |
1424 } | 1424 } |
1425 } | 1425 } |
1426 | 1426 |
1427 if (!frame_tree_node_->IsMainFrame() && | 1427 if (!frame_tree_node_->IsMainFrame() && |
1428 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && | 1428 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && |
1429 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, | 1429 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, |
1430 dest_url)) { | 1430 dest_url)) { |
| 1431 RenderFrameHostImpl* main_frame = |
| 1432 frame_tree_node_->frame_tree()->root()->current_frame_host(); |
1431 if (GetContentClient() | 1433 if (GetContentClient() |
1432 ->browser() | 1434 ->browser() |
1433 ->ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( | 1435 ->ShouldIsolateFrameForTopDocumentIsolation( |
1434 dest_url, current_instance)) { | 1436 transfer_navigation_handle_.get(), |
1435 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); | 1437 main_frame->GetSiteInstance())) { |
| 1438 // This is a cross-site subframe of a non-isolated origin, so place this |
| 1439 // frame in the default subframe site instance. |
| 1440 return SiteInstanceDescriptor( |
| 1441 browser_context, dest_url, |
| 1442 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); |
1436 } | 1443 } |
1437 | 1444 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); |
1438 // This is a cross-site subframe of a non-isolated origin, so place this | |
1439 // frame in the default subframe site instance. | |
1440 return SiteInstanceDescriptor( | |
1441 browser_context, dest_url, | |
1442 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); | |
1443 } | 1445 } |
1444 | 1446 |
1445 // Keep subframes in the parent's SiteInstance unless a dedicated process is | 1447 // Keep subframes in the parent's SiteInstance unless a dedicated process is |
1446 // required for either the parent or the subframe's destination URL. This | 1448 // required for either the parent or the subframe's destination URL. This |
1447 // isn't a strict invariant but rather a heuristic to avoid unnecessary | 1449 // isn't a strict invariant but rather a heuristic to avoid unnecessary |
1448 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to | 1450 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to |
1449 // TopDocumentIsolation, so do this after TDI checks above. | 1451 // TopDocumentIsolation, so do this after TDI checks above. |
1450 if (!frame_tree_node_->IsMainFrame()) { | 1452 if (!frame_tree_node_->IsMainFrame()) { |
1451 RenderFrameHostImpl* parent = | 1453 RenderFrameHostImpl* parent = |
1452 frame_tree_node_->parent()->current_frame_host(); | 1454 frame_tree_node_->parent()->current_frame_host(); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2828 ->is_hidden() != delegate_->IsHidden()) { | 2830 ->is_hidden() != delegate_->IsHidden()) { |
2829 if (delegate_->IsHidden()) { | 2831 if (delegate_->IsHidden()) { |
2830 view->Hide(); | 2832 view->Hide(); |
2831 } else { | 2833 } else { |
2832 view->Show(); | 2834 view->Show(); |
2833 } | 2835 } |
2834 } | 2836 } |
2835 } | 2837 } |
2836 | 2838 |
2837 } // namespace content | 2839 } // namespace content |
OLD | NEW |