| 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/renderer/render_frame_proxy.h" | 5 #include "content/renderer/render_frame_proxy.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 OnCompositorFrameSwapped(msg)) | 214 OnCompositorFrameSwapped(msg)) |
| 215 IPC_MESSAGE_HANDLER(FrameMsg_SetChildFrameSurface, OnSetChildFrameSurface) | 215 IPC_MESSAGE_HANDLER(FrameMsg_SetChildFrameSurface, OnSetChildFrameSurface) |
| 216 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) | 216 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) |
| 217 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) | 217 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) |
| 218 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) | 218 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) |
| 219 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 219 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) |
| 220 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) | 220 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) |
| 221 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) | 221 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) |
| 222 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) | 222 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) |
| 223 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus) | 223 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus) |
| 224 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) |
| 224 IPC_MESSAGE_UNHANDLED(handled = false) | 225 IPC_MESSAGE_UNHANDLED(handled = false) |
| 225 IPC_END_MESSAGE_MAP() | 226 IPC_END_MESSAGE_MAP() |
| 226 | 227 |
| 227 // Note: If |handled| is true, |this| may have been deleted. | 228 // Note: If |handled| is true, |this| may have been deleted. |
| 228 return handled; | 229 return handled; |
| 229 } | 230 } |
| 230 | 231 |
| 231 bool RenderFrameProxy::Send(IPC::Message* message) { | 232 bool RenderFrameProxy::Send(IPC::Message* message) { |
| 232 return RenderThread::Get()->Send(message); | 233 return RenderThread::Get()->Send(message); |
| 233 } | 234 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 333 } |
| 333 | 334 |
| 334 void RenderFrameProxy::OnDidUpdateOrigin(const url::Origin& origin) { | 335 void RenderFrameProxy::OnDidUpdateOrigin(const url::Origin& origin) { |
| 335 web_frame_->setReplicatedOrigin(origin); | 336 web_frame_->setReplicatedOrigin(origin); |
| 336 } | 337 } |
| 337 | 338 |
| 338 void RenderFrameProxy::OnSetPageFocus(bool is_focused) { | 339 void RenderFrameProxy::OnSetPageFocus(bool is_focused) { |
| 339 render_view_->SetFocus(is_focused); | 340 render_view_->SetFocus(is_focused); |
| 340 } | 341 } |
| 341 | 342 |
| 343 void RenderFrameProxy::OnSetFocusedFrame() { |
| 344 // This uses focusDocumentView rather than setFocusedFrame so that blur |
| 345 // events are properly dispatched on any currently focused elements. |
| 346 render_view_->webview()->focusDocumentView(web_frame_); |
| 347 } |
| 348 |
| 342 void RenderFrameProxy::frameDetached(DetachType type) { | 349 void RenderFrameProxy::frameDetached(DetachType type) { |
| 343 if (type == DetachType::Remove && web_frame_->parent()) { | 350 if (type == DetachType::Remove && web_frame_->parent()) { |
| 344 web_frame_->parent()->removeChild(web_frame_); | 351 web_frame_->parent()->removeChild(web_frame_); |
| 345 | 352 |
| 346 // Let the browser process know this subframe is removed, so that it is | 353 // Let the browser process know this subframe is removed, so that it is |
| 347 // destroyed in its current process. | 354 // destroyed in its current process. |
| 348 Send(new FrameHostMsg_Detach(routing_id_)); | 355 Send(new FrameHostMsg_Detach(routing_id_)); |
| 349 } | 356 } |
| 350 | 357 |
| 351 web_frame_->close(); | 358 web_frame_->close(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 // Only a LocalFrame (i.e., the caller of window.open) should be able to | 440 // Only a LocalFrame (i.e., the caller of window.open) should be able to |
| 434 // update another frame's opener. | 441 // update another frame's opener. |
| 435 DCHECK(opener->isWebLocalFrame()); | 442 DCHECK(opener->isWebLocalFrame()); |
| 436 | 443 |
| 437 int opener_routing_id = | 444 int opener_routing_id = |
| 438 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); | 445 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); |
| 439 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); | 446 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); |
| 440 } | 447 } |
| 441 | 448 |
| 442 } // namespace | 449 } // namespace |
| OLD | NEW |