OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_proxy_host.h" | 5 #include "content/browser/frame_host/render_frame_proxy_host.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "content/browser/frame_host/cross_process_frame_connector.h" | 8 #include "content/browser/frame_host/cross_process_frame_connector.h" |
9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return GetProcess()->Send(msg); | 109 return GetProcess()->Send(msg); |
110 } | 110 } |
111 | 111 |
112 bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) { | 112 bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) { |
113 if (cross_process_frame_connector_.get() && | 113 if (cross_process_frame_connector_.get() && |
114 cross_process_frame_connector_->OnMessageReceived(msg)) | 114 cross_process_frame_connector_->OnMessageReceived(msg)) |
115 return true; | 115 return true; |
116 | 116 |
117 bool handled = true; | 117 bool handled = true; |
118 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) | 118 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) |
| 119 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) |
119 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 120 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
120 IPC_MESSAGE_UNHANDLED(handled = false) | 121 IPC_MESSAGE_UNHANDLED(handled = false) |
121 IPC_END_MESSAGE_MAP() | 122 IPC_END_MESSAGE_MAP() |
122 return handled; | 123 return handled; |
123 } | 124 } |
124 | 125 |
125 bool RenderFrameProxyHost::InitRenderFrameProxy() { | 126 bool RenderFrameProxyHost::InitRenderFrameProxy() { |
126 DCHECK(!render_frame_proxy_created_); | 127 DCHECK(!render_frame_proxy_created_); |
127 // The process may (if we're sharing a process with another host that already | 128 // The process may (if we're sharing a process with another host that already |
128 // initialized it) or may not (we have our own process or the old process | 129 // initialized it) or may not (we have our own process or the old process |
(...skipping 21 matching lines...) Expand all Loading... |
150 ->current_replication_state())); | 151 ->current_replication_state())); |
151 | 152 |
152 render_frame_proxy_created_ = true; | 153 render_frame_proxy_created_ = true; |
153 return true; | 154 return true; |
154 } | 155 } |
155 | 156 |
156 void RenderFrameProxyHost::DisownOpener() { | 157 void RenderFrameProxyHost::DisownOpener() { |
157 Send(new FrameMsg_DisownOpener(GetRoutingID())); | 158 Send(new FrameMsg_DisownOpener(GetRoutingID())); |
158 } | 159 } |
159 | 160 |
| 161 void RenderFrameProxyHost::OnDetach() { |
| 162 // This message should only be received for subframes, and only from processes |
| 163 // of its ancestor frames (which have the ability to remove it). |
| 164 if (frame_tree_node_->IsMainFrame() || |
| 165 !frame_tree_node_->HasAncestorFrom(GetSiteInstance())) { |
| 166 // TODO(creis): Use updated contract for ReceivedBadMessage. |
| 167 GetProcess()->ReceivedBadMessage(); |
| 168 return; |
| 169 } |
| 170 frame_tree_node_->frame_tree()->RemoveFrame(frame_tree_node_); |
| 171 } |
| 172 |
160 void RenderFrameProxyHost::OnOpenURL( | 173 void RenderFrameProxyHost::OnOpenURL( |
161 const FrameHostMsg_OpenURL_Params& params) { | 174 const FrameHostMsg_OpenURL_Params& params) { |
| 175 // TODO(creis): Verify that we are in the same BrowsingInstance as the current |
| 176 // RenderFrameHost. See NavigatorImpl::RequestOpenURL. |
162 frame_tree_node_->current_frame_host()->OpenURL(params, site_instance_.get()); | 177 frame_tree_node_->current_frame_host()->OpenURL(params, site_instance_.get()); |
163 } | 178 } |
164 | 179 |
165 } // namespace content | 180 } // namespace content |
OLD | NEW |