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" |
11 #include "content/child/webmessageportchannel_impl.h" | 11 #include "content/child/webmessageportchannel_impl.h" |
12 #include "content/common/frame_messages.h" | 12 #include "content/common/frame_messages.h" |
13 #include "content/common/frame_replication_state.h" | 13 #include "content/common/frame_replication_state.h" |
| 14 #include "content/common/input_messages.h" |
14 #include "content/common/site_isolation_policy.h" | 15 #include "content/common/site_isolation_policy.h" |
15 #include "content/common/swapped_out_messages.h" | 16 #include "content/common/swapped_out_messages.h" |
16 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
17 #include "content/renderer/child_frame_compositing_helper.h" | 18 #include "content/renderer/child_frame_compositing_helper.h" |
18 #include "content/renderer/render_frame_impl.h" | 19 #include "content/renderer/render_frame_impl.h" |
19 #include "content/renderer/render_thread_impl.h" | 20 #include "content/renderer/render_thread_impl.h" |
20 #include "content/renderer/render_view_impl.h" | 21 #include "content/renderer/render_view_impl.h" |
21 #include "third_party/WebKit/public/platform/WebString.h" | 22 #include "third_party/WebKit/public/platform/WebString.h" |
22 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 23 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
23 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 24 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, | 213 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, |
213 OnCompositorFrameSwapped(msg)) | 214 OnCompositorFrameSwapped(msg)) |
214 IPC_MESSAGE_HANDLER(FrameMsg_SetChildFrameSurface, OnSetChildFrameSurface) | 215 IPC_MESSAGE_HANDLER(FrameMsg_SetChildFrameSurface, OnSetChildFrameSurface) |
215 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) | 216 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) |
216 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) | 217 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) |
217 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) | 218 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) |
218 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 219 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) |
219 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) | 220 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) |
220 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) | 221 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) |
221 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) | 222 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) |
| 223 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus) |
222 IPC_MESSAGE_UNHANDLED(handled = false) | 224 IPC_MESSAGE_UNHANDLED(handled = false) |
223 IPC_END_MESSAGE_MAP() | 225 IPC_END_MESSAGE_MAP() |
224 | 226 |
225 // Note: If |handled| is true, |this| may have been deleted. | 227 // Note: If |handled| is true, |this| may have been deleted. |
226 return handled; | 228 return handled; |
227 } | 229 } |
228 | 230 |
229 bool RenderFrameProxy::Send(IPC::Message* message) { | 231 bool RenderFrameProxy::Send(IPC::Message* message) { |
230 return RenderThread::Get()->Send(message); | 232 return RenderThread::Get()->Send(message); |
231 } | 233 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 328 } |
327 | 329 |
328 void RenderFrameProxy::OnDidUpdateName(const std::string& name) { | 330 void RenderFrameProxy::OnDidUpdateName(const std::string& name) { |
329 web_frame_->setReplicatedName(blink::WebString::fromUTF8(name)); | 331 web_frame_->setReplicatedName(blink::WebString::fromUTF8(name)); |
330 } | 332 } |
331 | 333 |
332 void RenderFrameProxy::OnDidUpdateOrigin(const url::Origin& origin) { | 334 void RenderFrameProxy::OnDidUpdateOrigin(const url::Origin& origin) { |
333 web_frame_->setReplicatedOrigin(origin); | 335 web_frame_->setReplicatedOrigin(origin); |
334 } | 336 } |
335 | 337 |
| 338 void RenderFrameProxy::OnSetPageFocus(bool is_focused) { |
| 339 render_view_->SetFocus(is_focused); |
| 340 } |
| 341 |
336 void RenderFrameProxy::frameDetached(DetachType type) { | 342 void RenderFrameProxy::frameDetached(DetachType type) { |
337 if (type == DetachType::Remove && web_frame_->parent()) { | 343 if (type == DetachType::Remove && web_frame_->parent()) { |
338 web_frame_->parent()->removeChild(web_frame_); | 344 web_frame_->parent()->removeChild(web_frame_); |
339 | 345 |
340 // Let the browser process know this subframe is removed, so that it is | 346 // Let the browser process know this subframe is removed, so that it is |
341 // destroyed in its current process. | 347 // destroyed in its current process. |
342 Send(new FrameHostMsg_Detach(routing_id_)); | 348 Send(new FrameHostMsg_Detach(routing_id_)); |
343 } | 349 } |
344 | 350 |
345 web_frame_->close(); | 351 web_frame_->close(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 // Only a LocalFrame (i.e., the caller of window.open) should be able to | 433 // Only a LocalFrame (i.e., the caller of window.open) should be able to |
428 // update another frame's opener. | 434 // update another frame's opener. |
429 DCHECK(opener->isWebLocalFrame()); | 435 DCHECK(opener->isWebLocalFrame()); |
430 | 436 |
431 int opener_routing_id = | 437 int opener_routing_id = |
432 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); | 438 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); |
433 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); | 439 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); |
434 } | 440 } |
435 | 441 |
436 } // namespace | 442 } // namespace |
OLD | NEW |