| 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 new_render_frame_host = proxy->PassFrameHostOwnership(); | 931 new_render_frame_host = proxy->PassFrameHostOwnership(); |
| 932 new_render_frame_host->GetProcess()->AddPendingView(); | 932 new_render_frame_host->GetProcess()->AddPendingView(); |
| 933 | 933 |
| 934 proxy_hosts_.erase(instance->GetId()); | 934 proxy_hosts_.erase(instance->GetId()); |
| 935 delete proxy; | 935 delete proxy; |
| 936 | 936 |
| 937 // When a new render view is created by the renderer, the new WebContents | 937 // When a new render view is created by the renderer, the new WebContents |
| 938 // gets a RenderViewHost in the SiteInstance of its opener WebContents. | 938 // gets a RenderViewHost in the SiteInstance of its opener WebContents. |
| 939 // If not used in the first navigation, this RVH is swapped out and is not | 939 // If not used in the first navigation, this RVH is swapped out and is not |
| 940 // granted bindings, so we may need to grant them when swapping it in. | 940 // granted bindings, so we may need to grant them when swapping it in. |
| 941 if (pending_web_ui() && !new_render_frame_host->GetProcess()->IsGuest()) { | 941 if (pending_web_ui() && |
| 942 !new_render_frame_host->GetProcess()->IsIsolatedGuest()) { |
| 942 int required_bindings = pending_web_ui()->GetBindings(); | 943 int required_bindings = pending_web_ui()->GetBindings(); |
| 943 RenderViewHost* rvh = new_render_frame_host->render_view_host(); | 944 RenderViewHost* rvh = new_render_frame_host->render_view_host(); |
| 944 if ((rvh->GetEnabledBindings() & required_bindings) != | 945 if ((rvh->GetEnabledBindings() & required_bindings) != |
| 945 required_bindings) { | 946 required_bindings) { |
| 946 rvh->AllowBindings(required_bindings); | 947 rvh->AllowBindings(required_bindings); |
| 947 } | 948 } |
| 948 } | 949 } |
| 949 } else { | 950 } else { |
| 950 // Detect if this is a cross-process child frame that is navigating | 951 // Detect if this is a cross-process child frame that is navigating |
| 951 // back to the same SiteInstance as its parent. | 952 // back to the same SiteInstance as its parent. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 int opener_route_id, | 1005 int opener_route_id, |
| 1005 int proxy_routing_id, | 1006 int proxy_routing_id, |
| 1006 bool for_main_frame) { | 1007 bool for_main_frame) { |
| 1007 // We may have initialized this RenderViewHost for another RenderFrameHost. | 1008 // We may have initialized this RenderViewHost for another RenderFrameHost. |
| 1008 if (render_view_host->IsRenderViewLive()) | 1009 if (render_view_host->IsRenderViewLive()) |
| 1009 return true; | 1010 return true; |
| 1010 | 1011 |
| 1011 // If the pending navigation is to a WebUI and the RenderView is not in a | 1012 // If the pending navigation is to a WebUI and the RenderView is not in a |
| 1012 // guest process, tell the RenderViewHost about any bindings it will need | 1013 // guest process, tell the RenderViewHost about any bindings it will need |
| 1013 // enabled. | 1014 // enabled. |
| 1014 if (pending_web_ui() && !render_view_host->GetProcess()->IsGuest()) { | 1015 if (pending_web_ui() && !render_view_host->GetProcess()->IsIsolatedGuest()) { |
| 1015 render_view_host->AllowBindings(pending_web_ui()->GetBindings()); | 1016 render_view_host->AllowBindings(pending_web_ui()->GetBindings()); |
| 1016 } else { | 1017 } else { |
| 1017 // Ensure that we don't create an unprivileged RenderView in a WebUI-enabled | 1018 // Ensure that we don't create an unprivileged RenderView in a WebUI-enabled |
| 1018 // process unless it's swapped out. | 1019 // process unless it's swapped out. |
| 1019 RenderViewHostImpl* rvh_impl = | 1020 RenderViewHostImpl* rvh_impl = |
| 1020 static_cast<RenderViewHostImpl*>(render_view_host); | 1021 static_cast<RenderViewHostImpl*>(render_view_host); |
| 1021 if (!rvh_impl->IsSwappedOut()) { | 1022 if (!rvh_impl->IsSwappedOut()) { |
| 1022 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( | 1023 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( |
| 1023 render_view_host->GetProcess()->GetID())); | 1024 render_view_host->GetProcess()->GetID())); |
| 1024 } | 1025 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 | 1359 |
| 1359 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. | 1360 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. |
| 1360 DCHECK(!cross_navigation_pending_); | 1361 DCHECK(!cross_navigation_pending_); |
| 1361 if (ShouldReuseWebUI(current_entry, &entry)) { | 1362 if (ShouldReuseWebUI(current_entry, &entry)) { |
| 1362 pending_web_ui_.reset(); | 1363 pending_web_ui_.reset(); |
| 1363 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); | 1364 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); |
| 1364 } else { | 1365 } else { |
| 1365 SetPendingWebUI(entry); | 1366 SetPendingWebUI(entry); |
| 1366 | 1367 |
| 1367 // Make sure the new RenderViewHost has the right bindings. | 1368 // Make sure the new RenderViewHost has the right bindings. |
| 1368 if (pending_web_ui() && !render_frame_host_->GetProcess()->IsGuest()) { | 1369 if (pending_web_ui() && |
| 1370 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { |
| 1369 render_frame_host_->render_view_host()->AllowBindings( | 1371 render_frame_host_->render_view_host()->AllowBindings( |
| 1370 pending_web_ui()->GetBindings()); | 1372 pending_web_ui()->GetBindings()); |
| 1371 } | 1373 } |
| 1372 } | 1374 } |
| 1373 | 1375 |
| 1374 if (pending_web_ui() && | 1376 if (pending_web_ui() && |
| 1375 render_frame_host_->render_view_host()->IsRenderViewLive()) { | 1377 render_frame_host_->render_view_host()->IsRenderViewLive()) { |
| 1376 pending_web_ui()->GetController()->RenderViewReused( | 1378 pending_web_ui()->GetController()->RenderViewReused( |
| 1377 render_frame_host_->render_view_host()); | 1379 render_frame_host_->render_view_host()); |
| 1378 } | 1380 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 SiteInstance* instance) const { | 1482 SiteInstance* instance) const { |
| 1481 RenderFrameProxyHostMap::const_iterator iter = | 1483 RenderFrameProxyHostMap::const_iterator iter = |
| 1482 proxy_hosts_.find(instance->GetId()); | 1484 proxy_hosts_.find(instance->GetId()); |
| 1483 if (iter != proxy_hosts_.end()) | 1485 if (iter != proxy_hosts_.end()) |
| 1484 return iter->second; | 1486 return iter->second; |
| 1485 | 1487 |
| 1486 return NULL; | 1488 return NULL; |
| 1487 } | 1489 } |
| 1488 | 1490 |
| 1489 } // namespace content | 1491 } // namespace content |
| OLD | NEW |