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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 } | 137 } |
138 | 138 |
139 RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const { | 139 RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const { |
140 if (interstitial_page_) | 140 if (interstitial_page_) |
141 return interstitial_page_->GetView(); | 141 return interstitial_page_->GetView(); |
142 if (render_frame_host_) | 142 if (render_frame_host_) |
143 return render_frame_host_->GetView(); | 143 return render_frame_host_->GetView(); |
144 return nullptr; | 144 return nullptr; |
145 } | 145 } |
146 | 146 |
147 RenderWidgetHostImpl* | |
148 RenderFrameHostManager::GetOuterRenderWidgetHostForKeyboardInput() { | |
149 if (!ForInnerDelegate()) | |
150 return nullptr; | |
151 | |
152 FrameTreeNode* outer_contents_frame_tree_node = | |
153 FrameTreeNode::GloballyFindByID( | |
154 delegate_->GetOuterDelegateFrameTreeNodeID()); | |
155 return outer_contents_frame_tree_node->parent() | |
156 ->current_frame_host() | |
157 ->render_view_host(); | |
158 } | |
159 | |
147 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() { | 160 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() { |
148 if (frame_tree_node_->IsMainFrame()) | 161 if (frame_tree_node_->IsMainFrame()) |
149 return NULL; | 162 return NULL; |
150 | 163 |
151 RenderFrameProxyHostMap::iterator iter = | 164 RenderFrameProxyHostMap::iterator iter = |
152 proxy_hosts_.find(frame_tree_node_->parent() | 165 proxy_hosts_.find(frame_tree_node_->parent() |
153 ->render_manager() | 166 ->render_manager() |
154 ->current_frame_host() | 167 ->current_frame_host() |
155 ->GetSiteInstance() | 168 ->GetSiteInstance() |
156 ->GetId()); | 169 ->GetId()); |
157 if (iter == proxy_hosts_.end()) | 170 if (iter == proxy_hosts_.end()) |
158 return NULL; | 171 return NULL; |
159 | 172 |
160 return iter->second; | 173 return iter->second; |
161 } | 174 } |
162 | 175 |
176 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToOuterDelegate() { | |
177 int outer_contents_frame_tree_node_id = | |
178 delegate_->GetOuterDelegateFrameTreeNodeID(); | |
179 FrameTreeNode* outer_contents_frame_tree_node = | |
180 FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id); | |
181 if (!outer_contents_frame_tree_node || | |
182 !outer_contents_frame_tree_node->parent()) { | |
183 return nullptr; | |
184 } | |
185 | |
186 return GetRenderFrameProxyHost(outer_contents_frame_tree_node->parent() | |
187 ->current_frame_host() | |
188 ->GetSiteInstance()); | |
189 } | |
190 | |
191 bool RenderFrameHostManager::ForInnerDelegate() { | |
192 // TODO(lazyboy): We should remove IsMainFrame() check below since any frames | |
nasko
2015/06/11 00:21:28
Should we? Wouldn't this cause us to skip the ref-
lazyboy
2015/06/11 22:20:29
Hmmm, I think so.
Out of process subframes inside
| |
193 // in the inner WebContents should be treated as a part of inner | |
194 // WebContents/Delegate. | |
195 return frame_tree_node_->IsMainFrame() && | |
196 delegate_->GetOuterDelegateFrameTreeNodeID() != -1; | |
197 } | |
198 | |
199 void RenderFrameHostManager::RemoveOuterDelegateFrame() { | |
200 FrameTreeNode* outer_delegate_frame_tree_node = | |
201 FrameTreeNode::GloballyFindByID( | |
202 delegate_->GetOuterDelegateFrameTreeNodeID()); | |
203 DCHECK(outer_delegate_frame_tree_node->parent()); | |
204 outer_delegate_frame_tree_node->frame_tree()->RemoveFrame( | |
nasko
2015/06/11 00:21:28
Shouldn't this work be driven by the chrome/ layer
lazyboy
2015/06/11 22:20:29
This is an <iframe> element in outer WebContents b
| |
205 outer_delegate_frame_tree_node); | |
206 } | |
207 | |
163 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) { | 208 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) { |
164 pending_web_ui_ = CreateWebUI(url, bindings); | 209 pending_web_ui_ = CreateWebUI(url, bindings); |
165 pending_and_current_web_ui_.reset(); | 210 pending_and_current_web_ui_.reset(); |
166 } | 211 } |
167 | 212 |
168 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url, | 213 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url, |
169 int bindings) { | 214 int bindings) { |
170 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url)); | 215 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url)); |
171 | 216 |
172 // If we have assigned (zero or more) bindings to this NavigationEntry in the | 217 // If we have assigned (zero or more) bindings to this NavigationEntry in the |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1640 | 1685 |
1641 // Recreate the opener chain. | 1686 // Recreate the opener chain. |
1642 int opener_route_id = | 1687 int opener_route_id = |
1643 delegate_->CreateOpenerRenderViewsForRenderManager(instance); | 1688 delegate_->CreateOpenerRenderViewsForRenderManager(instance); |
1644 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); | 1689 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); |
1645 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(), | 1690 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(), |
1646 source->IsMainFrame()); | 1691 source->IsMainFrame()); |
1647 proxy->set_render_frame_proxy_created(true); | 1692 proxy->set_render_frame_proxy_created(true); |
1648 } | 1693 } |
1649 | 1694 |
1695 void RenderFrameHostManager::CreateOuterDelegateProxy( | |
1696 SiteInstance* outer_contents_site_instance, | |
1697 RenderFrameHostImpl* render_frame_host) { | |
1698 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | |
1699 switches::kSitePerProcess)); | |
1700 RenderFrameProxyHost* proxy = new RenderFrameProxyHost( | |
1701 outer_contents_site_instance, render_frame_host->render_view_host(), | |
nasko
2015/06/11 00:21:28
I thought the idea was to not associate this proxy
lazyboy
2015/06/11 22:20:29
That works.
Done.
| |
1702 frame_tree_node_); | |
1703 proxy_hosts_[outer_contents_site_instance->GetId()] = proxy; | |
1704 | |
1705 render_frame_host->Send( | |
1706 new FrameMsg_SwapOut(render_frame_host->GetRoutingID(), | |
1707 proxy->GetRoutingID(), false /* is_loading */, | |
1708 FrameReplicationState())); | |
1709 proxy->set_render_frame_proxy_created(true); | |
1710 } | |
1711 | |
1712 void RenderFrameHostManager::SetRWHViewForInnerContents( | |
1713 RenderWidgetHostView* child_rwhv) { | |
1714 GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv); | |
1715 } | |
1716 | |
1650 bool RenderFrameHostManager::InitRenderView( | 1717 bool RenderFrameHostManager::InitRenderView( |
1651 RenderViewHostImpl* render_view_host, | 1718 RenderViewHostImpl* render_view_host, |
1652 int opener_route_id, | 1719 int opener_route_id, |
1653 int proxy_routing_id, | 1720 int proxy_routing_id, |
1654 bool for_main_frame_navigation) { | 1721 bool for_main_frame_navigation) { |
1655 // Ensure the renderer process is initialized before creating the | 1722 // Ensure the renderer process is initialized before creating the |
1656 // RenderView. | 1723 // RenderView. |
1657 if (!render_view_host->GetProcess()->Init()) | 1724 if (!render_view_host->GetProcess()->Init()) |
1658 return false; | 1725 return false; |
1659 | 1726 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2176 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2243 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
2177 SiteInstance* instance) { | 2244 SiteInstance* instance) { |
2178 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2245 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
2179 if (iter != proxy_hosts_.end()) { | 2246 if (iter != proxy_hosts_.end()) { |
2180 delete iter->second; | 2247 delete iter->second; |
2181 proxy_hosts_.erase(iter); | 2248 proxy_hosts_.erase(iter); |
2182 } | 2249 } |
2183 } | 2250 } |
2184 | 2251 |
2185 } // namespace content | 2252 } // namespace content |
OLD | NEW |