| 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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "content/child/webmessageportchannel_impl.h" | 10 #include "content/child/webmessageportchannel_impl.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 RenderFrameImpl::ContentToWebSandboxFlags(flags)); | 198 RenderFrameImpl::ContentToWebSandboxFlags(flags)); |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) { | 201 bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) { |
| 202 bool handled = true; | 202 bool handled = true; |
| 203 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg) | 203 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg) |
| 204 IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy) | 204 IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy) |
| 205 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) | 205 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) |
| 206 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, | 206 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, |
| 207 OnCompositorFrameSwapped(msg)) | 207 OnCompositorFrameSwapped(msg)) |
| 208 IPC_MESSAGE_HANDLER(FrameMsg_SetChildFrameSurface, OnSetChildFrameSurface) |
| 208 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) | 209 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) |
| 209 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) | 210 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) |
| 210 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) | 211 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) |
| 211 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 212 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) |
| 212 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) | 213 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) |
| 213 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) | 214 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) |
| 214 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) | 215 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) |
| 215 IPC_MESSAGE_UNHANDLED(handled = false) | 216 IPC_MESSAGE_UNHANDLED(handled = false) |
| 216 IPC_END_MESSAGE_MAP() | 217 IPC_END_MESSAGE_MAP() |
| 217 | 218 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 compositing_helper_->EnableCompositing(true); | 255 compositing_helper_->EnableCompositing(true); |
| 255 } | 256 } |
| 256 compositing_helper_->OnCompositorFrameSwapped( | 257 compositing_helper_->OnCompositorFrameSwapped( |
| 257 frame.Pass(), | 258 frame.Pass(), |
| 258 get<0>(param).producing_route_id, | 259 get<0>(param).producing_route_id, |
| 259 get<0>(param).output_surface_id, | 260 get<0>(param).output_surface_id, |
| 260 get<0>(param).producing_host_id, | 261 get<0>(param).producing_host_id, |
| 261 get<0>(param).shared_memory_handle); | 262 get<0>(param).shared_memory_handle); |
| 262 } | 263 } |
| 263 | 264 |
| 265 void RenderFrameProxy::OnSetChildFrameSurface( |
| 266 const cc::SurfaceId& surface_id, |
| 267 const gfx::Size& frame_size, |
| 268 float scale_factor, |
| 269 const cc::SurfaceSequence& sequence) { |
| 270 // If this WebFrame has already been detached, its parent will be null. This |
| 271 // can happen when swapping a WebRemoteFrame with a WebLocalFrame, where this |
| 272 // message may arrive after the frame was removed from the frame tree, but |
| 273 // before the frame has been destroyed. http://crbug.com/446575. |
| 274 if (!web_frame()->parent()) |
| 275 return; |
| 276 |
| 277 if (!compositing_helper_.get()) { |
| 278 compositing_helper_ = |
| 279 ChildFrameCompositingHelper::CreateForRenderFrameProxy(this); |
| 280 compositing_helper_->EnableCompositing(true); |
| 281 } |
| 282 compositing_helper_->OnSetSurface(surface_id, frame_size, scale_factor, |
| 283 sequence); |
| 284 } |
| 285 |
| 264 void RenderFrameProxy::OnDisownOpener() { | 286 void RenderFrameProxy::OnDisownOpener() { |
| 265 // TODO(creis): We should only see this for main frames for now. To support | 287 // TODO(creis): We should only see this for main frames for now. To support |
| 266 // disowning the opener on subframes, we will need to move WebContentsImpl's | 288 // disowning the opener on subframes, we will need to move WebContentsImpl's |
| 267 // opener_ to FrameTreeNode. | 289 // opener_ to FrameTreeNode. |
| 268 CHECK(!web_frame_->parent()); | 290 CHECK(!web_frame_->parent()); |
| 269 | 291 |
| 270 // When there is a RenderFrame for this proxy, tell it to disown its opener. | 292 // When there is a RenderFrame for this proxy, tell it to disown its opener. |
| 271 // TODO(creis): Remove this when we only have WebRemoteFrames and make sure | 293 // TODO(creis): Remove this when we only have WebRemoteFrames and make sure |
| 272 // they know they have an opener. | 294 // they know they have an opener. |
| 273 RenderFrameImpl* render_frame = | 295 RenderFrameImpl* render_frame = |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 blink::WebUserGestureIndicator::isProcessingUserGesture(); | 396 blink::WebUserGestureIndicator::isProcessingUserGesture(); |
| 375 blink::WebUserGestureIndicator::consumeUserGesture(); | 397 blink::WebUserGestureIndicator::consumeUserGesture(); |
| 376 Send(new FrameHostMsg_OpenURL(routing_id_, params)); | 398 Send(new FrameHostMsg_OpenURL(routing_id_, params)); |
| 377 } | 399 } |
| 378 | 400 |
| 379 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { | 401 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { |
| 380 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); | 402 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); |
| 381 } | 403 } |
| 382 | 404 |
| 383 } // namespace | 405 } // namespace |
| OLD | NEW |