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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 RenderFrameImpl::ContentToWebSandboxFlags(flags)); | 203 RenderFrameImpl::ContentToWebSandboxFlags(flags)); |
204 } | 204 } |
205 | 205 |
206 bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) { | 206 bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) { |
207 bool handled = true; | 207 bool handled = true; |
208 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg) | 208 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg) |
209 IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy) | 209 IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy) |
210 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) | 210 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) |
211 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, | 211 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, |
212 OnCompositorFrameSwapped(msg)) | 212 OnCompositorFrameSwapped(msg)) |
| 213 IPC_MESSAGE_HANDLER(FrameMsg_SetChildFrameSurface, OnSetChildFrameSurface) |
213 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) | 214 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) |
214 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) | 215 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading) |
215 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) | 216 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading) |
216 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 217 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) |
217 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) | 218 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad) |
218 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) | 219 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName) |
219 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) | 220 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) |
220 IPC_MESSAGE_UNHANDLED(handled = false) | 221 IPC_MESSAGE_UNHANDLED(handled = false) |
221 IPC_END_MESSAGE_MAP() | 222 IPC_END_MESSAGE_MAP() |
222 | 223 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 compositing_helper_->EnableCompositing(true); | 260 compositing_helper_->EnableCompositing(true); |
260 } | 261 } |
261 compositing_helper_->OnCompositorFrameSwapped( | 262 compositing_helper_->OnCompositorFrameSwapped( |
262 frame.Pass(), | 263 frame.Pass(), |
263 get<0>(param).producing_route_id, | 264 get<0>(param).producing_route_id, |
264 get<0>(param).output_surface_id, | 265 get<0>(param).output_surface_id, |
265 get<0>(param).producing_host_id, | 266 get<0>(param).producing_host_id, |
266 get<0>(param).shared_memory_handle); | 267 get<0>(param).shared_memory_handle); |
267 } | 268 } |
268 | 269 |
| 270 void RenderFrameProxy::OnSetChildFrameSurface( |
| 271 const cc::SurfaceId& surface_id, |
| 272 const gfx::Size& frame_size, |
| 273 float scale_factor, |
| 274 const cc::SurfaceSequence& sequence) { |
| 275 // If this WebFrame has already been detached, its parent will be null. This |
| 276 // can happen when swapping a WebRemoteFrame with a WebLocalFrame, where this |
| 277 // message may arrive after the frame was removed from the frame tree, but |
| 278 // before the frame has been destroyed. http://crbug.com/446575. |
| 279 if (!web_frame()->parent()) |
| 280 return; |
| 281 |
| 282 if (!compositing_helper_.get()) { |
| 283 compositing_helper_ = |
| 284 ChildFrameCompositingHelper::CreateForRenderFrameProxy(this); |
| 285 compositing_helper_->EnableCompositing(true); |
| 286 } |
| 287 compositing_helper_->OnSetSurface(surface_id, frame_size, scale_factor, |
| 288 sequence); |
| 289 } |
| 290 |
269 void RenderFrameProxy::OnDisownOpener() { | 291 void RenderFrameProxy::OnDisownOpener() { |
270 // TODO(creis): We should only see this for main frames for now. To support | 292 // TODO(creis): We should only see this for main frames for now. To support |
271 // disowning the opener on subframes, we will need to move WebContentsImpl's | 293 // disowning the opener on subframes, we will need to move WebContentsImpl's |
272 // opener_ to FrameTreeNode. | 294 // opener_ to FrameTreeNode. |
273 CHECK(!web_frame_->parent()); | 295 CHECK(!web_frame_->parent()); |
274 | 296 |
275 // When there is a RenderFrame for this proxy, tell it to disown its opener. | 297 // When there is a RenderFrame for this proxy, tell it to disown its opener. |
276 // TODO(creis): Remove this when we only have WebRemoteFrames and make sure | 298 // TODO(creis): Remove this when we only have WebRemoteFrames and make sure |
277 // they know they have an opener. | 299 // they know they have an opener. |
278 RenderFrameImpl* render_frame = | 300 RenderFrameImpl* render_frame = |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 blink::WebUserGestureIndicator::isProcessingUserGesture(); | 411 blink::WebUserGestureIndicator::isProcessingUserGesture(); |
390 blink::WebUserGestureIndicator::consumeUserGesture(); | 412 blink::WebUserGestureIndicator::consumeUserGesture(); |
391 Send(new FrameHostMsg_OpenURL(routing_id_, params)); | 413 Send(new FrameHostMsg_OpenURL(routing_id_, params)); |
392 } | 414 } |
393 | 415 |
394 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { | 416 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { |
395 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); | 417 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); |
396 } | 418 } |
397 | 419 |
398 } // namespace | 420 } // namespace |
OLD | NEW |