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 <stdint.h> | 7 #include <stdint.h> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 IPC_MESSAGE_HANDLER(FrameMsg_ResetContentSecurityPolicy, | 294 IPC_MESSAGE_HANDLER(FrameMsg_ResetContentSecurityPolicy, |
295 OnResetContentSecurityPolicy) | 295 OnResetContentSecurityPolicy) |
296 IPC_MESSAGE_HANDLER(FrameMsg_EnforceInsecureRequestPolicy, | 296 IPC_MESSAGE_HANDLER(FrameMsg_EnforceInsecureRequestPolicy, |
297 OnEnforceInsecureRequestPolicy) | 297 OnEnforceInsecureRequestPolicy) |
298 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, | 298 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, |
299 OnSetFrameOwnerProperties) | 299 OnSetFrameOwnerProperties) |
300 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) | 300 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) |
301 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus) | 301 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus) |
302 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) | 302 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) |
303 IPC_MESSAGE_HANDLER(FrameMsg_WillEnterFullscreen, OnWillEnterFullscreen) | 303 IPC_MESSAGE_HANDLER(FrameMsg_WillEnterFullscreen, OnWillEnterFullscreen) |
| 304 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, |
| 305 OnSetHasReceivedUserGesture) |
304 IPC_MESSAGE_UNHANDLED(handled = false) | 306 IPC_MESSAGE_UNHANDLED(handled = false) |
305 IPC_END_MESSAGE_MAP() | 307 IPC_END_MESSAGE_MAP() |
306 | 308 |
307 // Note: If |handled| is true, |this| may have been deleted. | 309 // Note: If |handled| is true, |this| may have been deleted. |
308 return handled; | 310 return handled; |
309 } | 311 } |
310 | 312 |
311 bool RenderFrameProxy::Send(IPC::Message* message) { | 313 bool RenderFrameProxy::Send(IPC::Message* message) { |
312 return RenderThread::Get()->Send(message); | 314 return RenderThread::Get()->Send(message); |
313 } | 315 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void RenderFrameProxy::OnSetFocusedFrame() { | 403 void RenderFrameProxy::OnSetFocusedFrame() { |
402 // This uses focusDocumentView rather than setFocusedFrame so that blur | 404 // This uses focusDocumentView rather than setFocusedFrame so that blur |
403 // events are properly dispatched on any currently focused elements. | 405 // events are properly dispatched on any currently focused elements. |
404 render_view_->webview()->focusDocumentView(web_frame_); | 406 render_view_->webview()->focusDocumentView(web_frame_); |
405 } | 407 } |
406 | 408 |
407 void RenderFrameProxy::OnWillEnterFullscreen() { | 409 void RenderFrameProxy::OnWillEnterFullscreen() { |
408 web_frame_->willEnterFullscreen(); | 410 web_frame_->willEnterFullscreen(); |
409 } | 411 } |
410 | 412 |
| 413 void RenderFrameProxy::OnSetHasReceivedUserGesture() { |
| 414 web_frame_->setHasReceivedUserGesture(); |
| 415 } |
| 416 |
411 void RenderFrameProxy::frameDetached(DetachType type) { | 417 void RenderFrameProxy::frameDetached(DetachType type) { |
412 if (type == DetachType::Remove && web_frame_->parent()) { | 418 if (type == DetachType::Remove && web_frame_->parent()) { |
413 web_frame_->parent()->removeChild(web_frame_); | 419 web_frame_->parent()->removeChild(web_frame_); |
414 | 420 |
415 // Let the browser process know this subframe is removed, so that it is | 421 // Let the browser process know this subframe is removed, so that it is |
416 // destroyed in its current process. | 422 // destroyed in its current process. |
417 Send(new FrameHostMsg_Detach(routing_id_)); | 423 Send(new FrameHostMsg_Detach(routing_id_)); |
418 } | 424 } |
419 | 425 |
420 web_frame_->close(); | 426 web_frame_->close(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 rect = gfx::ScaleToEnclosingRect( | 495 rect = gfx::ScaleToEnclosingRect( |
490 rect, 1.f / render_widget_->GetOriginalDeviceScaleFactor()); | 496 rect, 1.f / render_widget_->GetOriginalDeviceScaleFactor()); |
491 } | 497 } |
492 Send(new FrameHostMsg_FrameRectChanged(routing_id_, rect)); | 498 Send(new FrameHostMsg_FrameRectChanged(routing_id_, rect)); |
493 } | 499 } |
494 | 500 |
495 void RenderFrameProxy::visibilityChanged(bool visible) { | 501 void RenderFrameProxy::visibilityChanged(bool visible) { |
496 Send(new FrameHostMsg_VisibilityChanged(routing_id_, visible)); | 502 Send(new FrameHostMsg_VisibilityChanged(routing_id_, visible)); |
497 } | 503 } |
498 | 504 |
499 void RenderFrameProxy::setHasReceivedUserGesture() { | |
500 Send(new FrameHostMsg_SetHasReceivedUserGesture(routing_id_)); | |
501 } | |
502 | |
503 void RenderFrameProxy::didChangeOpener(blink::WebFrame* opener) { | 505 void RenderFrameProxy::didChangeOpener(blink::WebFrame* opener) { |
504 // A proxy shouldn't normally be disowning its opener. It is possible to get | 506 // A proxy shouldn't normally be disowning its opener. It is possible to get |
505 // here when a proxy that is being detached clears its opener, in which case | 507 // here when a proxy that is being detached clears its opener, in which case |
506 // there is no need to notify the browser process. | 508 // there is no need to notify the browser process. |
507 if (!opener) | 509 if (!opener) |
508 return; | 510 return; |
509 | 511 |
510 // Only a LocalFrame (i.e., the caller of window.open) should be able to | 512 // Only a LocalFrame (i.e., the caller of window.open) should be able to |
511 // update another frame's opener. | 513 // update another frame's opener. |
512 DCHECK(opener->isWebLocalFrame()); | 514 DCHECK(opener->isWebLocalFrame()); |
513 | 515 |
514 int opener_routing_id = | 516 int opener_routing_id = |
515 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); | 517 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); |
516 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); | 518 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); |
517 } | 519 } |
518 | 520 |
519 void RenderFrameProxy::advanceFocus(blink::WebFocusType type, | 521 void RenderFrameProxy::advanceFocus(blink::WebFocusType type, |
520 blink::WebLocalFrame* source) { | 522 blink::WebLocalFrame* source) { |
521 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID(); | 523 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID(); |
522 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id)); | 524 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id)); |
523 } | 525 } |
524 | 526 |
525 void RenderFrameProxy::frameFocused() { | 527 void RenderFrameProxy::frameFocused() { |
526 Send(new FrameHostMsg_FrameFocused(routing_id_)); | 528 Send(new FrameHostMsg_FrameFocused(routing_id_)); |
527 } | 529 } |
528 | 530 |
529 } // namespace | 531 } // namespace |
OLD | NEW |