| 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/bad_message.h" | 8 #include "content/browser/bad_message.h" |
| 9 #include "content/browser/frame_host/cross_process_frame_connector.h" | 9 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // here, since there is no valid parent RenderFrameProxy on the renderer | 178 // here, since there is no valid parent RenderFrameProxy on the renderer |
| 179 // side. This can happen when adding a new child frame after an opener | 179 // side. This can happen when adding a new child frame after an opener |
| 180 // process crashed and was reloaded. See https://crbug.com/501152. | 180 // process crashed and was reloaded. See https://crbug.com/501152. |
| 181 if (!parent_proxy->is_render_frame_proxy_live()) | 181 if (!parent_proxy->is_render_frame_proxy_live()) |
| 182 return false; | 182 return false; |
| 183 | 183 |
| 184 parent_routing_id = parent_proxy->GetRoutingID(); | 184 parent_routing_id = parent_proxy->GetRoutingID(); |
| 185 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); | 185 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); |
| 186 } | 186 } |
| 187 | 187 |
| 188 int opener_routing_id = MSG_ROUTING_NONE; |
| 189 if (frame_tree_node_->opener()) { |
| 190 opener_routing_id = frame_tree_node_->render_manager()->GetOpenerRoutingID( |
| 191 site_instance_.get()); |
| 192 } |
| 193 |
| 188 Send(new FrameMsg_NewFrameProxy(routing_id_, | 194 Send(new FrameMsg_NewFrameProxy(routing_id_, |
| 189 parent_routing_id, | |
| 190 frame_tree_node_->frame_tree() | 195 frame_tree_node_->frame_tree() |
| 191 ->GetRenderViewHost(site_instance_.get()) | 196 ->GetRenderViewHost(site_instance_.get()) |
| 192 ->GetRoutingID(), | 197 ->GetRoutingID(), |
| 198 opener_routing_id, |
| 199 parent_routing_id, |
| 193 frame_tree_node_ | 200 frame_tree_node_ |
| 194 ->current_replication_state())); | 201 ->current_replication_state())); |
| 195 | 202 |
| 196 render_frame_proxy_created_ = true; | 203 render_frame_proxy_created_ = true; |
| 197 return true; | 204 return true; |
| 198 } | 205 } |
| 199 | 206 |
| 200 void RenderFrameProxyHost::UpdateOpener() { | 207 void RenderFrameProxyHost::UpdateOpener() { |
| 201 // Another frame in this proxy's SiteInstance may reach the new opener by | 208 // Another frame in this proxy's SiteInstance may reach the new opener by |
| 202 // first reaching this proxy and then referencing its window.opener. Ensure | 209 // first reaching this proxy and then referencing its window.opener. Ensure |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); | 315 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); |
| 309 } | 316 } |
| 310 } | 317 } |
| 311 | 318 |
| 312 void RenderFrameProxyHost::OnDidChangeOpener(int32 opener_routing_id) { | 319 void RenderFrameProxyHost::OnDidChangeOpener(int32 opener_routing_id) { |
| 313 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 320 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
| 314 GetSiteInstance()); | 321 GetSiteInstance()); |
| 315 } | 322 } |
| 316 | 323 |
| 317 } // namespace content | 324 } // namespace content |
| OLD | NEW |