| Index: content/browser/frame_host/render_frame_host_manager.cc
|
| diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
|
| index 8b4004ca56c11d5cca2661230b62ad7c23fa220f..5e74247acb324d77517421fb781970d8601d740b 100644
|
| --- a/content/browser/frame_host/render_frame_host_manager.cc
|
| +++ b/content/browser/frame_host/render_frame_host_manager.cc
|
| @@ -151,6 +151,28 @@ RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const {
|
| return nullptr;
|
| }
|
|
|
| +bool RenderFrameHostManager::ForInnerDelegate() {
|
| + // TODO(lazyboy): Subframes inside inner WebContents needs to be tested and
|
| + // we have to make sure that IsMainFrame() check below is appropriate. See
|
| + // http://crbug.com/500957.
|
| + return frame_tree_node_->IsMainFrame() &&
|
| + delegate_->GetOuterDelegateFrameTreeNodeID() !=
|
| + FrameTreeNode::kFrameTreeNodeInvalidID;
|
| +}
|
| +
|
| +RenderWidgetHostImpl*
|
| +RenderFrameHostManager::GetOuterRenderWidgetHostForKeyboardInput() {
|
| + if (!ForInnerDelegate())
|
| + return nullptr;
|
| +
|
| + FrameTreeNode* outer_contents_frame_tree_node =
|
| + FrameTreeNode::GloballyFindByID(
|
| + delegate_->GetOuterDelegateFrameTreeNodeID());
|
| + return outer_contents_frame_tree_node->parent()
|
| + ->current_frame_host()
|
| + ->render_view_host();
|
| +}
|
| +
|
| RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() {
|
| if (frame_tree_node_->IsMainFrame())
|
| return NULL;
|
| @@ -167,6 +189,30 @@ RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() {
|
| return iter->second;
|
| }
|
|
|
| +RenderFrameProxyHost* RenderFrameHostManager::GetProxyToOuterDelegate() {
|
| + int outer_contents_frame_tree_node_id =
|
| + delegate_->GetOuterDelegateFrameTreeNodeID();
|
| + FrameTreeNode* outer_contents_frame_tree_node =
|
| + FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id);
|
| + if (!outer_contents_frame_tree_node ||
|
| + !outer_contents_frame_tree_node->parent()) {
|
| + return nullptr;
|
| + }
|
| +
|
| + return GetRenderFrameProxyHost(outer_contents_frame_tree_node->parent()
|
| + ->current_frame_host()
|
| + ->GetSiteInstance());
|
| +}
|
| +
|
| +void RenderFrameHostManager::RemoveOuterDelegateFrame() {
|
| + FrameTreeNode* outer_delegate_frame_tree_node =
|
| + FrameTreeNode::GloballyFindByID(
|
| + delegate_->GetOuterDelegateFrameTreeNodeID());
|
| + DCHECK(outer_delegate_frame_tree_node->parent());
|
| + outer_delegate_frame_tree_node->frame_tree()->RemoveFrame(
|
| + outer_delegate_frame_tree_node);
|
| +}
|
| +
|
| void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) {
|
| pending_web_ui_ = CreateWebUI(url, bindings);
|
| pending_and_current_web_ui_.reset();
|
| @@ -1648,6 +1694,35 @@ void RenderFrameHostManager::EnsureRenderViewInitialized(
|
| proxy->set_render_frame_proxy_created(true);
|
| }
|
|
|
| +void RenderFrameHostManager::CreateOuterDelegateProxy(
|
| + SiteInstance* outer_contents_site_instance,
|
| + RenderFrameHostImpl* render_frame_host) {
|
| + CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kSitePerProcess));
|
| + RenderFrameProxyHost* proxy = new RenderFrameProxyHost(
|
| + outer_contents_site_instance, nullptr, frame_tree_node_);
|
| + proxy_hosts_[outer_contents_site_instance->GetId()] = proxy;
|
| +
|
| + // Swap the outer WebContents's frame with the proxy to inner WebContents.
|
| + //
|
| + // We are in the outer WebContents, and its FrameTree would never see
|
| + // a load start for any of its inner WebContents. Eventually, that also makes
|
| + // the FrameTree never see the matching load stop. Therefore, we always pass
|
| + // false to |is_loading| below.
|
| + // TODO(lazyboy): This |is_loading| behavior might not be what we want,
|
| + // investigate and fix.
|
| + render_frame_host->Send(new FrameMsg_SwapOut(
|
| + render_frame_host->GetRoutingID(), proxy->GetRoutingID(),
|
| + false /* is_loading */, FrameReplicationState()));
|
| + proxy->set_render_frame_proxy_created(true);
|
| +}
|
| +
|
| +void RenderFrameHostManager::SetRWHViewForInnerContents(
|
| + RenderWidgetHostView* child_rwhv) {
|
| + DCHECK(ForInnerDelegate());
|
| + GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv);
|
| +}
|
| +
|
| bool RenderFrameHostManager::InitRenderView(
|
| RenderViewHostImpl* render_view_host,
|
| int opener_route_id,
|
|
|