OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 OnRunJavaScriptMessage) | 449 OnRunJavaScriptMessage) |
450 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, | 450 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, |
451 OnRunBeforeUnloadConfirm) | 451 OnRunBeforeUnloadConfirm) |
452 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 452 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
453 OnDidAccessInitialDocument) | 453 OnDidAccessInitialDocument) |
454 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) | 454 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) |
455 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) | 455 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) |
456 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) | 456 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) |
457 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeSandboxFlags, | 457 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeSandboxFlags, |
458 OnDidChangeSandboxFlags) | 458 OnDidChangeSandboxFlags) |
459 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeScrollingMode, | |
460 OnDidChangeScrollingMode) | |
461 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeMarginWidth, | |
462 OnDidChangeMarginWidth) | |
463 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeMarginHeight, | |
464 OnDidChangeMarginHeight) | |
459 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 465 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
460 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 466 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
461 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 467 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
462 OnBeginNavigation) | 468 OnBeginNavigation) |
463 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 469 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
464 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 470 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
465 OnTextSurroundingSelectionResponse) | 471 OnTextSurroundingSelectionResponse) |
466 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 472 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
467 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 473 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
468 OnAccessibilityLocationChanges) | 474 OnAccessibilityLocationChanges) |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 return false; | 618 return false; |
613 | 619 |
614 DCHECK(GetProcess()->HasConnection()); | 620 DCHECK(GetProcess()->HasConnection()); |
615 | 621 |
616 FrameMsg_NewFrame_Params params; | 622 FrameMsg_NewFrame_Params params; |
617 params.routing_id = routing_id_; | 623 params.routing_id = routing_id_; |
618 params.parent_routing_id = parent_routing_id; | 624 params.parent_routing_id = parent_routing_id; |
619 params.proxy_routing_id = proxy_routing_id; | 625 params.proxy_routing_id = proxy_routing_id; |
620 params.previous_sibling_routing_id = previous_sibling_routing_id; | 626 params.previous_sibling_routing_id = previous_sibling_routing_id; |
621 params.replication_state = frame_tree_node()->current_replication_state(); | 627 params.replication_state = frame_tree_node()->current_replication_state(); |
628 params.frame_owner_properties = frame_tree_node()->frame_owner_properties(); | |
622 | 629 |
623 if (render_widget_host_) { | 630 if (render_widget_host_) { |
624 params.widget_params.routing_id = render_widget_host_->GetRoutingID(); | 631 params.widget_params.routing_id = render_widget_host_->GetRoutingID(); |
625 params.widget_params.surface_id = render_widget_host_->surface_id(); | 632 params.widget_params.surface_id = render_widget_host_->surface_id(); |
626 params.widget_params.hidden = render_widget_host_->is_hidden(); | 633 params.widget_params.hidden = render_widget_host_->is_hidden(); |
627 } else { | 634 } else { |
628 // MSG_ROUTING_NONE will prevent a new RenderWidget from being created in | 635 // MSG_ROUTING_NONE will prevent a new RenderWidget from being created in |
629 // the renderer process. | 636 // the renderer process. |
630 params.widget_params.routing_id = MSG_ROUTING_NONE; | 637 params.widget_params.routing_id = MSG_ROUTING_NONE; |
631 params.widget_params.surface_id = 0; | 638 params.widget_params.surface_id = 0; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
703 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() | 710 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() |
704 << "\"" << message << "\", source: " << source_id << " (" << line_no | 711 << "\"" << message << "\", source: " << source_id << " (" << line_no |
705 << ")"; | 712 << ")"; |
706 } | 713 } |
707 } | 714 } |
708 | 715 |
709 void RenderFrameHostImpl::OnCreateChildFrame( | 716 void RenderFrameHostImpl::OnCreateChildFrame( |
710 int new_routing_id, | 717 int new_routing_id, |
711 blink::WebTreeScopeType scope, | 718 blink::WebTreeScopeType scope, |
712 const std::string& frame_name, | 719 const std::string& frame_name, |
713 blink::WebSandboxFlags sandbox_flags) { | 720 blink::WebSandboxFlags sandbox_flags, |
721 const blink::WebFrameOwnerProperties& frame_owner_properties) { | |
714 // It is possible that while a new RenderFrameHost was committed, the | 722 // It is possible that while a new RenderFrameHost was committed, the |
715 // RenderFrame corresponding to this host sent an IPC message to create a | 723 // RenderFrame corresponding to this host sent an IPC message to create a |
716 // frame and it is delivered after this host is swapped out. | 724 // frame and it is delivered after this host is swapped out. |
717 // Ignore such messages, as we know this RenderFrameHost is going away. | 725 // Ignore such messages, as we know this RenderFrameHost is going away. |
718 if (rfh_state_ != RenderFrameHostImpl::STATE_DEFAULT) | 726 if (rfh_state_ != RenderFrameHostImpl::STATE_DEFAULT) |
719 return; | 727 return; |
720 | 728 |
721 RenderFrameHostImpl* new_frame = | 729 RenderFrameHostImpl* new_frame = frame_tree_->AddFrame( |
722 frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), | 730 frame_tree_node_, GetProcess()->GetID(), new_routing_id, scope, |
723 new_routing_id, scope, frame_name, sandbox_flags); | 731 frame_name, sandbox_flags, frame_owner_properties); |
724 if (!new_frame) | 732 if (!new_frame) |
725 return; | 733 return; |
726 | 734 |
727 // We know that the RenderFrame has been created in this case, immediately | 735 // We know that the RenderFrame has been created in this case, immediately |
728 // after the CreateChildFrame IPC was sent. | 736 // after the CreateChildFrame IPC was sent. |
729 new_frame->SetRenderFrameCreated(true); | 737 new_frame->SetRenderFrameCreated(true); |
730 } | 738 } |
731 | 739 |
732 void RenderFrameHostImpl::OnDetach() { | 740 void RenderFrameHostImpl::OnDetach() { |
733 frame_tree_->RemoveFrame(frame_tree_node_); | 741 frame_tree_->RemoveFrame(frame_tree_node_); |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1306 // the updated sandbox flags, but these notifications are sent later in | 1314 // the updated sandbox flags, but these notifications are sent later in |
1307 // RenderFrameHostManager::CommitPendingSandboxFlags(), when the frame | 1315 // RenderFrameHostManager::CommitPendingSandboxFlags(), when the frame |
1308 // navigates and the new sandbox flags take effect. | 1316 // navigates and the new sandbox flags take effect. |
1309 RenderFrameHost* child_rfh = child->current_frame_host(); | 1317 RenderFrameHost* child_rfh = child->current_frame_host(); |
1310 if (child_rfh->GetSiteInstance() != GetSiteInstance()) { | 1318 if (child_rfh->GetSiteInstance() != GetSiteInstance()) { |
1311 child_rfh->Send( | 1319 child_rfh->Send( |
1312 new FrameMsg_DidUpdateSandboxFlags(child_rfh->GetRoutingID(), flags)); | 1320 new FrameMsg_DidUpdateSandboxFlags(child_rfh->GetRoutingID(), flags)); |
1313 } | 1321 } |
1314 } | 1322 } |
1315 | 1323 |
1324 void RenderFrameHostImpl::OnDidChangeScrollingMode( | |
1325 int32 frame_routing_id, | |
1326 blink::WebFrameOwnerProperties::ScrollingMode mode) { | |
1327 FrameTree* frame_tree = frame_tree_node()->frame_tree(); | |
1328 FrameTreeNode* child = | |
1329 frame_tree->FindByRoutingID(GetProcess()->GetID(), frame_routing_id); | |
1330 if (!child) | |
1331 return; | |
1332 | |
alexmos
2015/09/02 21:42:09
How about adding a security check here that it's t
lazyboy
2015/09/15 19:30:56
Done.
| |
1333 child->SetScrollingMode(mode); | |
1334 } | |
1335 | |
1336 void RenderFrameHostImpl::OnDidChangeMarginWidth(int32 frame_routing_id, | |
1337 int new_margin_width) { | |
1338 FrameTree* frame_tree = frame_tree_node()->frame_tree(); | |
1339 FrameTreeNode* child = | |
1340 frame_tree->FindByRoutingID(GetProcess()->GetID(), frame_routing_id); | |
1341 if (!child) | |
1342 return; | |
1343 | |
1344 child->SetMarginWidth(new_margin_width); | |
1345 } | |
1346 | |
1347 void RenderFrameHostImpl::OnDidChangeMarginHeight(int32 frame_routing_id, | |
1348 int new_margin_height) { | |
1349 FrameTree* frame_tree = frame_tree_node()->frame_tree(); | |
1350 FrameTreeNode* child = | |
1351 frame_tree->FindByRoutingID(GetProcess()->GetID(), frame_routing_id); | |
1352 if (!child) | |
1353 return; | |
1354 | |
1355 child->SetMarginHeight(new_margin_height); | |
1356 } | |
1357 | |
1316 void RenderFrameHostImpl::OnUpdateTitle( | 1358 void RenderFrameHostImpl::OnUpdateTitle( |
1317 const base::string16& title, | 1359 const base::string16& title, |
1318 blink::WebTextDirection title_direction) { | 1360 blink::WebTextDirection title_direction) { |
1319 // This message is only sent for top-level frames. TODO(avi): when frame tree | 1361 // This message is only sent for top-level frames. TODO(avi): when frame tree |
1320 // mirroring works correctly, add a check here to enforce it. | 1362 // mirroring works correctly, add a check here to enforce it. |
1321 if (title.length() > kMaxTitleChars) { | 1363 if (title.length() > kMaxTitleChars) { |
1322 NOTREACHED() << "Renderer sent too many characters in title."; | 1364 NOTREACHED() << "Renderer sent too many characters in title."; |
1323 return; | 1365 return; |
1324 } | 1366 } |
1325 | 1367 |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2219 BrowserPluginInstanceIDToAXTreeID(value))); | 2261 BrowserPluginInstanceIDToAXTreeID(value))); |
2220 break; | 2262 break; |
2221 case AX_CONTENT_INT_ATTRIBUTE_LAST: | 2263 case AX_CONTENT_INT_ATTRIBUTE_LAST: |
2222 NOTREACHED(); | 2264 NOTREACHED(); |
2223 break; | 2265 break; |
2224 } | 2266 } |
2225 } | 2267 } |
2226 } | 2268 } |
2227 | 2269 |
2228 } // namespace content | 2270 } // namespace content |
OLD | NEW |