| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "content/browser/bad_message.h" | 10 #include "content/browser/bad_message.h" |
| 11 #include "content/browser/frame_host/cross_process_frame_connector.h" | 11 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 12 #include "content/browser/frame_host/frame_tree.h" | 12 #include "content/browser/frame_host/frame_tree.h" |
| 13 #include "content/browser/frame_host/frame_tree_node.h" | 13 #include "content/browser/frame_host/frame_tree_node.h" |
| 14 #include "content/browser/frame_host/navigator.h" | 14 #include "content/browser/frame_host/navigator.h" |
| 15 #include "content/browser/frame_host/render_frame_host_delegate.h" | 15 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 16 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 16 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 17 #include "content/browser/message_port_message_filter.h" | |
| 18 #include "content/browser/renderer_host/render_view_host_impl.h" | 17 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 18 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 20 #include "content/browser/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
| 21 #include "content/common/frame_messages.h" | 20 #include "content/common/frame_messages.h" |
| 22 #include "content/common/frame_owner_properties.h" | 21 #include "content/common/frame_owner_properties.h" |
| 23 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 24 #include "ipc/ipc_message.h" | 23 #include "ipc/ipc_message.h" |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 | 26 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 ->GetRenderFrameProxyHost(target_site_instance); | 313 ->GetRenderFrameProxyHost(target_site_instance); |
| 315 if (source_proxy_in_target_site_instance) { | 314 if (source_proxy_in_target_site_instance) { |
| 316 new_params.source_routing_id = | 315 new_params.source_routing_id = |
| 317 source_proxy_in_target_site_instance->GetRoutingID(); | 316 source_proxy_in_target_site_instance->GetRoutingID(); |
| 318 } else { | 317 } else { |
| 319 new_params.source_routing_id = MSG_ROUTING_NONE; | 318 new_params.source_routing_id = MSG_ROUTING_NONE; |
| 320 } | 319 } |
| 321 } | 320 } |
| 322 } | 321 } |
| 323 | 322 |
| 324 if (!params.message_ports.empty()) { | 323 target_rfh->Send( |
| 325 // Updating the message port information has to be done in the IO thread; | 324 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); |
| 326 // MessagePortMessageFilter::RouteMessageEventWithMessagePorts will send | |
| 327 // FrameMsg_PostMessageEvent after it's done. Note that a trivial solution | |
| 328 // would've been to post a task on the IO thread to do the IO-thread-bound | |
| 329 // work, and make that post a task back to WebContentsImpl in the UI | |
| 330 // thread. But we cannot do that, since there's nothing to guarantee that | |
| 331 // WebContentsImpl stays alive during the round trip. | |
| 332 scoped_refptr<MessagePortMessageFilter> message_port_message_filter( | |
| 333 static_cast<RenderProcessHostImpl*>(target_rfh->GetProcess()) | |
| 334 ->message_port_message_filter()); | |
| 335 BrowserThread::PostTask( | |
| 336 BrowserThread::IO, FROM_HERE, | |
| 337 base::Bind(&MessagePortMessageFilter::RouteMessageEventWithMessagePorts, | |
| 338 message_port_message_filter, target_rfh->GetRoutingID(), | |
| 339 new_params)); | |
| 340 } else { | |
| 341 target_rfh->Send( | |
| 342 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); | |
| 343 } | |
| 344 } | 325 } |
| 345 | 326 |
| 346 void RenderFrameProxyHost::OnDidChangeOpener(int32_t opener_routing_id) { | 327 void RenderFrameProxyHost::OnDidChangeOpener(int32_t opener_routing_id) { |
| 347 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 328 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
| 348 GetSiteInstance()); | 329 GetSiteInstance()); |
| 349 } | 330 } |
| 350 | 331 |
| 351 void RenderFrameProxyHost::OnAdvanceFocus(blink::WebFocusType type, | 332 void RenderFrameProxyHost::OnAdvanceFocus(blink::WebFocusType type, |
| 352 int32_t source_routing_id) { | 333 int32_t source_routing_id) { |
| 353 RenderFrameHostImpl* target_rfh = | 334 RenderFrameHostImpl* target_rfh = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 376 void RenderFrameProxyHost::OnFrameFocused() { | 357 void RenderFrameProxyHost::OnFrameFocused() { |
| 377 frame_tree_node_->current_frame_host()->delegate()->SetFocusedFrame( | 358 frame_tree_node_->current_frame_host()->delegate()->SetFocusedFrame( |
| 378 frame_tree_node_, GetSiteInstance()); | 359 frame_tree_node_, GetSiteInstance()); |
| 379 } | 360 } |
| 380 | 361 |
| 381 void RenderFrameProxyHost::OnSetHasReceivedUserGesture() { | 362 void RenderFrameProxyHost::OnSetHasReceivedUserGesture() { |
| 382 frame_tree_node_->current_frame_host()->SetHasReceivedUserGesture(); | 363 frame_tree_node_->current_frame_host()->SetHasReceivedUserGesture(); |
| 383 } | 364 } |
| 384 | 365 |
| 385 } // namespace content | 366 } // namespace content |
| OLD | NEW |