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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 new_render_frame_host = proxy->PassFrameHostOwnership(); | 926 new_render_frame_host = proxy->PassFrameHostOwnership(); |
927 new_render_frame_host->GetProcess()->AddPendingView(); | 927 new_render_frame_host->GetProcess()->AddPendingView(); |
928 | 928 |
929 proxy_hosts_.erase(instance->GetId()); | 929 proxy_hosts_.erase(instance->GetId()); |
930 delete proxy; | 930 delete proxy; |
931 | 931 |
932 // When a new render view is created by the renderer, the new WebContents | 932 // When a new render view is created by the renderer, the new WebContents |
933 // gets a RenderViewHost in the SiteInstance of its opener WebContents. | 933 // gets a RenderViewHost in the SiteInstance of its opener WebContents. |
934 // If not used in the first navigation, this RVH is swapped out and is not | 934 // If not used in the first navigation, this RVH is swapped out and is not |
935 // granted bindings, so we may need to grant them when swapping it in. | 935 // granted bindings, so we may need to grant them when swapping it in. |
936 if (pending_web_ui() && !new_render_frame_host->GetProcess()->IsGuest()) { | 936 if (pending_web_ui() && |
| 937 !new_render_frame_host->GetProcess()->IsIsolatedGuest()) { |
937 int required_bindings = pending_web_ui()->GetBindings(); | 938 int required_bindings = pending_web_ui()->GetBindings(); |
938 RenderViewHost* rvh = new_render_frame_host->render_view_host(); | 939 RenderViewHost* rvh = new_render_frame_host->render_view_host(); |
939 if ((rvh->GetEnabledBindings() & required_bindings) != | 940 if ((rvh->GetEnabledBindings() & required_bindings) != |
940 required_bindings) { | 941 required_bindings) { |
941 rvh->AllowBindings(required_bindings); | 942 rvh->AllowBindings(required_bindings); |
942 } | 943 } |
943 } | 944 } |
944 } else { | 945 } else { |
945 // Detect if this is a cross-process child frame that is navigating | 946 // Detect if this is a cross-process child frame that is navigating |
946 // back to the same SiteInstance as its parent. | 947 // back to the same SiteInstance as its parent. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 int opener_route_id, | 995 int opener_route_id, |
995 int proxy_routing_id, | 996 int proxy_routing_id, |
996 bool for_main_frame) { | 997 bool for_main_frame) { |
997 // We may have initialized this RenderViewHost for another RenderFrameHost. | 998 // We may have initialized this RenderViewHost for another RenderFrameHost. |
998 if (render_view_host->IsRenderViewLive()) | 999 if (render_view_host->IsRenderViewLive()) |
999 return true; | 1000 return true; |
1000 | 1001 |
1001 // If the pending navigation is to a WebUI and the RenderView is not in a | 1002 // If the pending navigation is to a WebUI and the RenderView is not in a |
1002 // guest process, tell the RenderViewHost about any bindings it will need | 1003 // guest process, tell the RenderViewHost about any bindings it will need |
1003 // enabled. | 1004 // enabled. |
1004 if (pending_web_ui() && !render_view_host->GetProcess()->IsGuest()) { | 1005 if (pending_web_ui() && !render_view_host->GetProcess()->IsIsolatedGuest()) { |
1005 render_view_host->AllowBindings(pending_web_ui()->GetBindings()); | 1006 render_view_host->AllowBindings(pending_web_ui()->GetBindings()); |
1006 } else { | 1007 } else { |
1007 // Ensure that we don't create an unprivileged RenderView in a WebUI-enabled | 1008 // Ensure that we don't create an unprivileged RenderView in a WebUI-enabled |
1008 // process unless it's swapped out. | 1009 // process unless it's swapped out. |
1009 RenderViewHostImpl* rvh_impl = | 1010 RenderViewHostImpl* rvh_impl = |
1010 static_cast<RenderViewHostImpl*>(render_view_host); | 1011 static_cast<RenderViewHostImpl*>(render_view_host); |
1011 if (!rvh_impl->IsSwappedOut()) { | 1012 if (!rvh_impl->IsSwappedOut()) { |
1012 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( | 1013 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( |
1013 render_view_host->GetProcess()->GetID())); | 1014 render_view_host->GetProcess()->GetID())); |
1014 } | 1015 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 | 1349 |
1349 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. | 1350 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. |
1350 DCHECK(!cross_navigation_pending_); | 1351 DCHECK(!cross_navigation_pending_); |
1351 if (ShouldReuseWebUI(current_entry, &entry)) { | 1352 if (ShouldReuseWebUI(current_entry, &entry)) { |
1352 pending_web_ui_.reset(); | 1353 pending_web_ui_.reset(); |
1353 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); | 1354 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); |
1354 } else { | 1355 } else { |
1355 SetPendingWebUI(entry); | 1356 SetPendingWebUI(entry); |
1356 | 1357 |
1357 // Make sure the new RenderViewHost has the right bindings. | 1358 // Make sure the new RenderViewHost has the right bindings. |
1358 if (pending_web_ui() && !render_frame_host_->GetProcess()->IsGuest()) { | 1359 if (pending_web_ui() && |
| 1360 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { |
1359 render_frame_host_->render_view_host()->AllowBindings( | 1361 render_frame_host_->render_view_host()->AllowBindings( |
1360 pending_web_ui()->GetBindings()); | 1362 pending_web_ui()->GetBindings()); |
1361 } | 1363 } |
1362 } | 1364 } |
1363 | 1365 |
1364 if (pending_web_ui() && | 1366 if (pending_web_ui() && |
1365 render_frame_host_->render_view_host()->IsRenderViewLive()) { | 1367 render_frame_host_->render_view_host()->IsRenderViewLive()) { |
1366 pending_web_ui()->GetController()->RenderViewReused( | 1368 pending_web_ui()->GetController()->RenderViewReused( |
1367 render_frame_host_->render_view_host()); | 1369 render_frame_host_->render_view_host()); |
1368 } | 1370 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 SiteInstance* instance) const { | 1472 SiteInstance* instance) const { |
1471 RenderFrameProxyHostMap::const_iterator iter = | 1473 RenderFrameProxyHostMap::const_iterator iter = |
1472 proxy_hosts_.find(instance->GetId()); | 1474 proxy_hosts_.find(instance->GetId()); |
1473 if (iter != proxy_hosts_.end()) | 1475 if (iter != proxy_hosts_.end()) |
1474 return iter->second; | 1476 return iter->second; |
1475 | 1477 |
1476 return NULL; | 1478 return NULL; |
1477 } | 1479 } |
1478 | 1480 |
1479 } // namespace content | 1481 } // namespace content |
OLD | NEW |