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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 DCHECK(web_frame_); | 236 DCHECK(web_frame_); |
237 web_frame_->setReplicatedOrigin(state.origin); | 237 web_frame_->setReplicatedOrigin(state.origin); |
238 web_frame_->setReplicatedSandboxFlags(state.sandbox_flags); | 238 web_frame_->setReplicatedSandboxFlags(state.sandbox_flags); |
239 web_frame_->setReplicatedName(blink::WebString::fromUTF8(state.name), | 239 web_frame_->setReplicatedName(blink::WebString::fromUTF8(state.name), |
240 blink::WebString::fromUTF8(state.unique_name)); | 240 blink::WebString::fromUTF8(state.unique_name)); |
241 web_frame_->setReplicatedInsecureRequestPolicy(state.insecure_request_policy); | 241 web_frame_->setReplicatedInsecureRequestPolicy(state.insecure_request_policy); |
242 web_frame_->setReplicatedPotentiallyTrustworthyUniqueOrigin( | 242 web_frame_->setReplicatedPotentiallyTrustworthyUniqueOrigin( |
243 state.has_potentially_trustworthy_unique_origin); | 243 state.has_potentially_trustworthy_unique_origin); |
244 web_frame_->setReplicatedFeaturePolicyHeader( | 244 web_frame_->setReplicatedFeaturePolicyHeader( |
245 ToWebParsedFeaturePolicy(state.feature_policy_header)); | 245 ToWebParsedFeaturePolicy(state.feature_policy_header)); |
| 246 if (state.has_received_user_gesture) |
| 247 web_frame_->setHasReceivedUserGesture(); |
246 | 248 |
247 web_frame_->resetReplicatedContentSecurityPolicy(); | 249 web_frame_->resetReplicatedContentSecurityPolicy(); |
248 for (const auto& header : state.accumulated_csp_headers) | 250 for (const auto& header : state.accumulated_csp_headers) |
249 OnAddContentSecurityPolicy(header); | 251 OnAddContentSecurityPolicy(header); |
250 } | 252 } |
251 | 253 |
252 // Update the proxy's SecurityContext and FrameOwner with new sandbox flags | 254 // Update the proxy's SecurityContext and FrameOwner with new sandbox flags |
253 // that were set by its parent in another process. | 255 // that were set by its parent in another process. |
254 // | 256 // |
255 // Normally, when a frame's sandbox attribute is changed dynamically, the | 257 // Normally, when a frame's sandbox attribute is changed dynamically, the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 IPC_MESSAGE_HANDLER(FrameMsg_ResetContentSecurityPolicy, | 297 IPC_MESSAGE_HANDLER(FrameMsg_ResetContentSecurityPolicy, |
296 OnResetContentSecurityPolicy) | 298 OnResetContentSecurityPolicy) |
297 IPC_MESSAGE_HANDLER(FrameMsg_EnforceInsecureRequestPolicy, | 299 IPC_MESSAGE_HANDLER(FrameMsg_EnforceInsecureRequestPolicy, |
298 OnEnforceInsecureRequestPolicy) | 300 OnEnforceInsecureRequestPolicy) |
299 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, | 301 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, |
300 OnSetFrameOwnerProperties) | 302 OnSetFrameOwnerProperties) |
301 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) | 303 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin) |
302 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus) | 304 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus) |
303 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) | 305 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) |
304 IPC_MESSAGE_HANDLER(FrameMsg_WillEnterFullscreen, OnWillEnterFullscreen) | 306 IPC_MESSAGE_HANDLER(FrameMsg_WillEnterFullscreen, OnWillEnterFullscreen) |
| 307 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, |
| 308 OnSetHasReceivedUserGesture) |
305 IPC_MESSAGE_UNHANDLED(handled = false) | 309 IPC_MESSAGE_UNHANDLED(handled = false) |
306 IPC_END_MESSAGE_MAP() | 310 IPC_END_MESSAGE_MAP() |
307 | 311 |
308 // Note: If |handled| is true, |this| may have been deleted. | 312 // Note: If |handled| is true, |this| may have been deleted. |
309 return handled; | 313 return handled; |
310 } | 314 } |
311 | 315 |
312 bool RenderFrameProxy::Send(IPC::Message* message) { | 316 bool RenderFrameProxy::Send(IPC::Message* message) { |
313 return RenderThread::Get()->Send(message); | 317 return RenderThread::Get()->Send(message); |
314 } | 318 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 void RenderFrameProxy::OnSetFocusedFrame() { | 406 void RenderFrameProxy::OnSetFocusedFrame() { |
403 // This uses focusDocumentView rather than setFocusedFrame so that blur | 407 // This uses focusDocumentView rather than setFocusedFrame so that blur |
404 // events are properly dispatched on any currently focused elements. | 408 // events are properly dispatched on any currently focused elements. |
405 render_view_->webview()->focusDocumentView(web_frame_); | 409 render_view_->webview()->focusDocumentView(web_frame_); |
406 } | 410 } |
407 | 411 |
408 void RenderFrameProxy::OnWillEnterFullscreen() { | 412 void RenderFrameProxy::OnWillEnterFullscreen() { |
409 web_frame_->willEnterFullscreen(); | 413 web_frame_->willEnterFullscreen(); |
410 } | 414 } |
411 | 415 |
| 416 void RenderFrameProxy::OnSetHasReceivedUserGesture() { |
| 417 web_frame_->setHasReceivedUserGesture(); |
| 418 } |
| 419 |
412 void RenderFrameProxy::frameDetached(DetachType type) { | 420 void RenderFrameProxy::frameDetached(DetachType type) { |
413 if (type == DetachType::Remove && web_frame_->parent()) { | 421 if (type == DetachType::Remove && web_frame_->parent()) { |
414 web_frame_->parent()->removeChild(web_frame_); | 422 web_frame_->parent()->removeChild(web_frame_); |
415 | 423 |
416 // Let the browser process know this subframe is removed, so that it is | 424 // Let the browser process know this subframe is removed, so that it is |
417 // destroyed in its current process. | 425 // destroyed in its current process. |
418 Send(new FrameHostMsg_Detach(routing_id_)); | 426 Send(new FrameHostMsg_Detach(routing_id_)); |
419 } | 427 } |
420 | 428 |
421 web_frame_->close(); | 429 web_frame_->close(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 void RenderFrameProxy::updateRemoteViewportIntersection( | 504 void RenderFrameProxy::updateRemoteViewportIntersection( |
497 const blink::WebRect& viewportIntersection) { | 505 const blink::WebRect& viewportIntersection) { |
498 Send(new FrameHostMsg_UpdateViewportIntersection( | 506 Send(new FrameHostMsg_UpdateViewportIntersection( |
499 routing_id_, gfx::Rect(viewportIntersection))); | 507 routing_id_, gfx::Rect(viewportIntersection))); |
500 } | 508 } |
501 | 509 |
502 void RenderFrameProxy::visibilityChanged(bool visible) { | 510 void RenderFrameProxy::visibilityChanged(bool visible) { |
503 Send(new FrameHostMsg_VisibilityChanged(routing_id_, visible)); | 511 Send(new FrameHostMsg_VisibilityChanged(routing_id_, visible)); |
504 } | 512 } |
505 | 513 |
506 void RenderFrameProxy::setHasReceivedUserGesture() { | |
507 Send(new FrameHostMsg_SetHasReceivedUserGesture(routing_id_)); | |
508 } | |
509 | |
510 void RenderFrameProxy::didChangeOpener(blink::WebFrame* opener) { | 514 void RenderFrameProxy::didChangeOpener(blink::WebFrame* opener) { |
511 // A proxy shouldn't normally be disowning its opener. It is possible to get | 515 // A proxy shouldn't normally be disowning its opener. It is possible to get |
512 // here when a proxy that is being detached clears its opener, in which case | 516 // here when a proxy that is being detached clears its opener, in which case |
513 // there is no need to notify the browser process. | 517 // there is no need to notify the browser process. |
514 if (!opener) | 518 if (!opener) |
515 return; | 519 return; |
516 | 520 |
517 // Only a LocalFrame (i.e., the caller of window.open) should be able to | 521 // Only a LocalFrame (i.e., the caller of window.open) should be able to |
518 // update another frame's opener. | 522 // update another frame's opener. |
519 DCHECK(opener->isWebLocalFrame()); | 523 DCHECK(opener->isWebLocalFrame()); |
520 | 524 |
521 int opener_routing_id = | 525 int opener_routing_id = |
522 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); | 526 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID(); |
523 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); | 527 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); |
524 } | 528 } |
525 | 529 |
526 void RenderFrameProxy::advanceFocus(blink::WebFocusType type, | 530 void RenderFrameProxy::advanceFocus(blink::WebFocusType type, |
527 blink::WebLocalFrame* source) { | 531 blink::WebLocalFrame* source) { |
528 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID(); | 532 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID(); |
529 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id)); | 533 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id)); |
530 } | 534 } |
531 | 535 |
532 void RenderFrameProxy::frameFocused() { | 536 void RenderFrameProxy::frameFocused() { |
533 Send(new FrameHostMsg_FrameFocused(routing_id_)); | 537 Send(new FrameHostMsg_FrameFocused(routing_id_)); |
534 } | 538 } |
535 | 539 |
536 } // namespace | 540 } // namespace |
OLD | NEW |