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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (cross_process_frame_connector_.get() && | 139 if (cross_process_frame_connector_.get() && |
140 cross_process_frame_connector_->OnMessageReceived(msg)) | 140 cross_process_frame_connector_->OnMessageReceived(msg)) |
141 return true; | 141 return true; |
142 | 142 |
143 bool handled = true; | 143 bool handled = true; |
144 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) | 144 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) |
145 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) | 145 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) |
146 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 146 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
147 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 147 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
148 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) | 148 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) |
| 149 IPC_MESSAGE_HANDLER(FrameHostMsg_AdvanceFocus, OnAdvanceFocus) |
149 IPC_MESSAGE_UNHANDLED(handled = false) | 150 IPC_MESSAGE_UNHANDLED(handled = false) |
150 IPC_END_MESSAGE_MAP() | 151 IPC_END_MESSAGE_MAP() |
151 return handled; | 152 return handled; |
152 } | 153 } |
153 | 154 |
154 bool RenderFrameProxyHost::InitRenderFrameProxy() { | 155 bool RenderFrameProxyHost::InitRenderFrameProxy() { |
155 DCHECK(!render_frame_proxy_created_); | 156 DCHECK(!render_frame_proxy_created_); |
156 | 157 |
157 // It is possible to reach this when the process is dead (in particular, when | 158 // It is possible to reach this when the process is dead (in particular, when |
158 // creating proxies from CreateProxiesForChildFrame). In that case, don't | 159 // creating proxies from CreateProxiesForChildFrame). In that case, don't |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 target_rfh->Send( | 319 target_rfh->Send( |
319 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); | 320 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); |
320 } | 321 } |
321 } | 322 } |
322 | 323 |
323 void RenderFrameProxyHost::OnDidChangeOpener(int32 opener_routing_id) { | 324 void RenderFrameProxyHost::OnDidChangeOpener(int32 opener_routing_id) { |
324 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 325 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
325 GetSiteInstance()); | 326 GetSiteInstance()); |
326 } | 327 } |
327 | 328 |
| 329 void RenderFrameProxyHost::OnAdvanceFocus(blink::WebFocusType type, |
| 330 int32_t source_routing_id) { |
| 331 RenderFrameHostImpl* target_rfh = |
| 332 frame_tree_node_->render_manager()->current_frame_host(); |
| 333 |
| 334 // Translate the source RenderFrameHost in this process to its equivalent |
| 335 // RenderFrameProxyHost in the target process. This is needed for continuing |
| 336 // the focus traversal from correct place in a parent frame after one of its |
| 337 // child frames finishes its traversal. |
| 338 RenderFrameHostImpl* source_rfh = |
| 339 RenderFrameHostImpl::FromID(GetProcess()->GetID(), source_routing_id); |
| 340 int32_t source_proxy_routing_id = MSG_ROUTING_NONE; |
| 341 if (source_rfh) { |
| 342 RenderFrameProxyHost* source_proxy = |
| 343 source_rfh->frame_tree_node() |
| 344 ->render_manager() |
| 345 ->GetRenderFrameProxyHost(target_rfh->GetSiteInstance()); |
| 346 if (source_proxy) |
| 347 source_proxy_routing_id = source_proxy->GetRoutingID(); |
| 348 } |
| 349 |
| 350 target_rfh->Send(new FrameMsg_AdvanceFocus(target_rfh->GetRoutingID(), type, |
| 351 source_proxy_routing_id)); |
| 352 } |
| 353 |
328 } // namespace content | 354 } // namespace content |
OLD | NEW |