Chromium Code Reviews| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 ->render_manager() | 153 ->render_manager() |
| 154 ->current_frame_host() | 154 ->current_frame_host() |
| 155 ->GetSiteInstance() | 155 ->GetSiteInstance() |
| 156 ->GetId()); | 156 ->GetId()); |
| 157 if (iter == proxy_hosts_.end()) | 157 if (iter == proxy_hosts_.end()) |
| 158 return NULL; | 158 return NULL; |
| 159 | 159 |
| 160 return iter->second; | 160 return iter->second; |
| 161 } | 161 } |
| 162 | 162 |
| 163 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToOuterContents() { | |
| 164 int outer_contents_frame_tree_node_id = | |
| 165 delegate_->GetOuterWebContentsFrameTreeNodeID(); | |
| 166 FrameTreeNode* outer_contents_frame_tree_node = | |
| 167 FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id); | |
| 168 if (!outer_contents_frame_tree_node) | |
| 169 return nullptr; | |
| 170 | |
| 171 return GetRenderFrameProxyHost( | |
| 172 outer_contents_frame_tree_node->current_frame_host()->GetSiteInstance()); | |
| 173 } | |
| 174 | |
| 175 bool RenderFrameHostManager::IsGuest() { | |
| 176 return frame_tree_node_->IsMainFrame() && | |
|
Charlie Reis
2015/05/22 23:44:30
Thanks for the TODO in the .h file. Can you also
lazyboy
2015/05/26 16:32:54
Done.
| |
| 177 delegate_->GetOuterWebContentsFrameTreeNodeID() != -1; | |
| 178 } | |
| 179 | |
| 163 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) { | 180 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) { |
| 164 pending_web_ui_ = CreateWebUI(url, bindings); | 181 pending_web_ui_ = CreateWebUI(url, bindings); |
| 165 pending_and_current_web_ui_.reset(); | 182 pending_and_current_web_ui_.reset(); |
| 166 } | 183 } |
| 167 | 184 |
| 168 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url, | 185 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url, |
| 169 int bindings) { | 186 int bindings) { |
| 170 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url)); | 187 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url)); |
| 171 | 188 |
| 172 // If we have assigned (zero or more) bindings to this NavigationEntry in the | 189 // If we have assigned (zero or more) bindings to this NavigationEntry in the |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1592 | 1609 |
| 1593 // Recreate the opener chain. | 1610 // Recreate the opener chain. |
| 1594 int opener_route_id = | 1611 int opener_route_id = |
| 1595 delegate_->CreateOpenerRenderViewsForRenderManager(instance); | 1612 delegate_->CreateOpenerRenderViewsForRenderManager(instance); |
| 1596 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); | 1613 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); |
| 1597 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(), | 1614 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(), |
| 1598 source->IsMainFrame()); | 1615 source->IsMainFrame()); |
| 1599 proxy->set_render_frame_proxy_created(true); | 1616 proxy->set_render_frame_proxy_created(true); |
| 1600 } | 1617 } |
| 1601 | 1618 |
| 1619 int RenderFrameHostManager::CreateOuterContentsProxy( | |
| 1620 SiteInstance* outer_contents_site_instance) { | |
| 1621 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1622 switches::kSitePerProcess)); | |
| 1623 int outer_contents_proxy_flags = CREATE_RF_HIDDEN | CREATE_RF_SWAPPED_OUT | | |
| 1624 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION; | |
| 1625 int swapped_out_render_view_routing_id; // Unused. | |
| 1626 scoped_ptr<RenderFrameHostImpl> swapped_out_rfh_in_outer_contents = | |
| 1627 CreateRenderFrame(outer_contents_site_instance, nullptr, | |
|
nasko
2015/05/22 16:32:27
Ah, this is unfortunate : (. I'm working on a CL t
lazyboy
2015/05/26 16:32:54
Bug#?
| |
| 1628 MSG_ROUTING_NONE, // opener_route_id | |
| 1629 outer_contents_proxy_flags, | |
| 1630 &swapped_out_render_view_routing_id); | |
| 1631 | |
| 1632 RenderFrameProxyHost* rfph_in_outer_contents = | |
| 1633 GetRenderFrameProxyHost(outer_contents_site_instance); | |
| 1634 DCHECK(rfph_in_outer_contents); | |
| 1635 return rfph_in_outer_contents->GetRoutingID(); | |
| 1636 } | |
| 1637 | |
| 1638 void RenderFrameHostManager::ReplaceWithInnerContentsProxy( | |
| 1639 int proxy_to_outer_contents_routing_id) { | |
| 1640 current_frame_host()->Send(new FrameMsg_SwapOut( | |
|
Charlie Reis
2015/05/22 23:44:30
Is it correct to pass false for is_loading? I was
lazyboy
2015/05/29 00:02:23
We are in the outer WebContents's FTN and this FTN
| |
| 1641 current_frame_host()->GetRoutingID(), proxy_to_outer_contents_routing_id, | |
| 1642 false /* is_loading */, content::FrameReplicationState())); | |
|
nasko
2015/05/22 16:32:27
nit: No need to use "content::" prefix, this code
lazyboy
2015/05/26 16:32:54
Done, thanks.
| |
| 1643 } | |
| 1644 | |
| 1645 void RenderFrameHostManager::SetRWHViewForInnerContents( | |
| 1646 RenderWidgetHostView* child_rwhv) { | |
| 1647 GetProxyToOuterContents()->SetChildRWHView(child_rwhv); | |
| 1648 } | |
| 1649 | |
| 1602 bool RenderFrameHostManager::InitRenderView( | 1650 bool RenderFrameHostManager::InitRenderView( |
| 1603 RenderViewHostImpl* render_view_host, | 1651 RenderViewHostImpl* render_view_host, |
| 1604 int opener_route_id, | 1652 int opener_route_id, |
| 1605 int proxy_routing_id, | 1653 int proxy_routing_id, |
| 1606 bool for_main_frame_navigation) { | 1654 bool for_main_frame_navigation) { |
| 1607 // We may have initialized this RenderViewHost for another RenderFrameHost. | 1655 // We may have initialized this RenderViewHost for another RenderFrameHost. |
| 1608 if (render_view_host->IsRenderViewLive()) | 1656 if (render_view_host->IsRenderViewLive()) |
| 1609 return true; | 1657 return true; |
| 1610 | 1658 |
| 1611 // If the ongoing navigation is to a WebUI and the RenderView is not in a | 1659 // If the ongoing navigation is to a WebUI and the RenderView is not in a |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2109 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2157 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 2110 SiteInstance* instance) { | 2158 SiteInstance* instance) { |
| 2111 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2159 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 2112 if (iter != proxy_hosts_.end()) { | 2160 if (iter != proxy_hosts_.end()) { |
| 2113 delete iter->second; | 2161 delete iter->second; |
| 2114 proxy_hosts_.erase(iter); | 2162 proxy_hosts_.erase(iter); |
| 2115 } | 2163 } |
| 2116 } | 2164 } |
| 2117 | 2165 |
| 2118 } // namespace content | 2166 } // namespace content |
| OLD | NEW |