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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 : existing_site_instance(nullptr), relation(relation_to_current) { | 1017 : existing_site_instance(nullptr), relation(relation_to_current) { |
1018 new_site_url = SiteInstance::GetSiteForURL(browser_context, dest_url); | 1018 new_site_url = SiteInstance::GetSiteForURL(browser_context, dest_url); |
1019 } | 1019 } |
1020 | 1020 |
1021 void RenderFrameHostManager::RenderProcessGone(SiteInstanceImpl* instance) { | 1021 void RenderFrameHostManager::RenderProcessGone(SiteInstanceImpl* instance) { |
1022 GetRenderFrameProxyHost(instance)->set_render_frame_proxy_created(false); | 1022 GetRenderFrameProxyHost(instance)->set_render_frame_proxy_created(false); |
1023 } | 1023 } |
1024 | 1024 |
1025 void RenderFrameHostManager::CancelPendingIfNecessary( | 1025 void RenderFrameHostManager::CancelPendingIfNecessary( |
1026 RenderFrameHostImpl* render_frame_host) { | 1026 RenderFrameHostImpl* render_frame_host) { |
1027 if (render_frame_host == pending_render_frame_host_.get()) | 1027 if (render_frame_host == pending_render_frame_host_.get()) { |
1028 CancelPending(); | 1028 CancelPending(); |
1029 else if (render_frame_host == speculative_render_frame_host_.get()) { | 1029 } else if (render_frame_host == speculative_render_frame_host_.get()) { |
1030 // TODO(nasko, clamy): This should just clean up the speculative RFH | 1030 // TODO(nasko, clamy): This should just clean up the speculative RFH |
1031 // without canceling the request. See https://crbug.com/636119. | 1031 // without canceling the request. See https://crbug.com/636119. |
1032 if (frame_tree_node_->navigation_request() && | 1032 if (frame_tree_node_->navigation_request() && |
1033 frame_tree_node_->navigation_request()->navigation_handle()) { | 1033 frame_tree_node_->navigation_request()->navigation_handle()) { |
1034 frame_tree_node_->navigation_request() | 1034 frame_tree_node_->navigation_request() |
1035 ->navigation_handle() | 1035 ->navigation_handle() |
1036 ->set_net_error_code(net::ERR_ABORTED); | 1036 ->set_net_error_code(net::ERR_ABORTED); |
1037 } | 1037 } |
1038 frame_tree_node_->ResetNavigationRequest(false, true); | 1038 frame_tree_node_->ResetNavigationRequest(false, true); |
1039 } | 1039 } |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 frame_tree_node_->opener()->current_frame_host(); | 1478 frame_tree_node_->opener()->current_frame_host(); |
1479 if (IsCurrentlySameSite(opener_frame, dest_url)) | 1479 if (IsCurrentlySameSite(opener_frame, dest_url)) |
1480 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); | 1480 return SiteInstanceDescriptor(opener_frame->GetSiteInstance()); |
1481 } | 1481 } |
1482 } | 1482 } |
1483 | 1483 |
1484 if (!frame_tree_node_->IsMainFrame() && | 1484 if (!frame_tree_node_->IsMainFrame() && |
1485 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && | 1485 SiteIsolationPolicy::IsTopDocumentIsolationEnabled() && |
1486 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, | 1486 !SiteInstanceImpl::DoesSiteRequireDedicatedProcess(browser_context, |
1487 dest_url)) { | 1487 dest_url)) { |
| 1488 RenderFrameHostImpl* main_frame = |
| 1489 frame_tree_node_->frame_tree()->root()->current_frame_host(); |
1488 if (GetContentClient() | 1490 if (GetContentClient() |
1489 ->browser() | 1491 ->browser() |
1490 ->ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( | 1492 ->ShouldIsolateFrameForTopDocumentIsolation( |
1491 dest_url, current_instance)) { | 1493 frame_tree_node_->current_frame_host(), dest_url, |
| 1494 main_frame->GetSiteInstance())) { |
| 1495 // This is a cross-site subframe of a non-isolated origin, so place this |
| 1496 // frame in the default subframe site instance. |
| 1497 return SiteInstanceDescriptor( |
| 1498 browser_context, dest_url, |
| 1499 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); |
| 1500 } else { |
1492 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); | 1501 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); |
1493 } | 1502 } |
1494 | |
1495 // This is a cross-site subframe of a non-isolated origin, so place this | |
1496 // frame in the default subframe site instance. | |
1497 return SiteInstanceDescriptor( | |
1498 browser_context, dest_url, | |
1499 SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME); | |
1500 } | 1503 } |
1501 | 1504 |
1502 // Keep subframes in the parent's SiteInstance unless a dedicated process is | 1505 // Keep subframes in the parent's SiteInstance unless a dedicated process is |
1503 // required for either the parent or the subframe's destination URL. This | 1506 // required for either the parent or the subframe's destination URL. This |
1504 // isn't a strict invariant but rather a heuristic to avoid unnecessary | 1507 // isn't a strict invariant but rather a heuristic to avoid unnecessary |
1505 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to | 1508 // OOPIFs; see https://crbug.com/711006. Note that this shouldn't apply to |
1506 // TopDocumentIsolation, so do this after TDI checks above. | 1509 // TopDocumentIsolation, so do this after TDI checks above. |
1507 if (!frame_tree_node_->IsMainFrame()) { | 1510 if (!frame_tree_node_->IsMainFrame()) { |
1508 RenderFrameHostImpl* parent = | 1511 RenderFrameHostImpl* parent = |
1509 frame_tree_node_->parent()->current_frame_host(); | 1512 frame_tree_node_->parent()->current_frame_host(); |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2829 ->is_hidden() != delegate_->IsHidden()) { | 2832 ->is_hidden() != delegate_->IsHidden()) { |
2830 if (delegate_->IsHidden()) { | 2833 if (delegate_->IsHidden()) { |
2831 view->Hide(); | 2834 view->Hide(); |
2832 } else { | 2835 } else { |
2833 view->Show(); | 2836 view->Show(); |
2834 } | 2837 } |
2835 } | 2838 } |
2836 } | 2839 } |
2837 | 2840 |
2838 } // namespace content | 2841 } // namespace content |
OLD | NEW |