Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1307013004: Propagate scrolling/marginwidth/marginheight property values to child frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move setSandboxFlags call Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 // static 581 // static
582 void RenderFrameImpl::CreateFrame( 582 void RenderFrameImpl::CreateFrame(
583 int routing_id, 583 int routing_id,
584 int proxy_routing_id, 584 int proxy_routing_id,
585 int opener_routing_id, 585 int opener_routing_id,
586 int parent_routing_id, 586 int parent_routing_id,
587 int previous_sibling_routing_id, 587 int previous_sibling_routing_id,
588 const FrameReplicationState& replicated_state, 588 const FrameReplicationState& replicated_state,
589 CompositorDependencies* compositor_deps, 589 CompositorDependencies* compositor_deps,
590 const FrameMsg_NewFrame_WidgetParams& widget_params) { 590 const FrameMsg_NewFrame_WidgetParams& widget_params,
591 const blink::WebFrameOwnerProperties& frame_owner_properties) {
591 blink::WebLocalFrame* web_frame; 592 blink::WebLocalFrame* web_frame;
592 RenderFrameImpl* render_frame; 593 RenderFrameImpl* render_frame;
593 if (proxy_routing_id == MSG_ROUTING_NONE) { 594 if (proxy_routing_id == MSG_ROUTING_NONE) {
594 RenderFrameProxy* parent_proxy = 595 RenderFrameProxy* parent_proxy =
595 RenderFrameProxy::FromRoutingID(parent_routing_id); 596 RenderFrameProxy::FromRoutingID(parent_routing_id);
596 // If the browser is sending a valid parent routing id, it should already 597 // If the browser is sending a valid parent routing id, it should already
597 // be created and registered. 598 // be created and registered.
598 CHECK(parent_proxy); 599 CHECK(parent_proxy);
599 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame(); 600 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame();
600 601
601 blink::WebFrame* previous_sibling_web_frame = nullptr; 602 blink::WebFrame* previous_sibling_web_frame = nullptr;
602 RenderFrameProxy* previous_sibling_proxy = 603 RenderFrameProxy* previous_sibling_proxy =
603 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 604 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
604 if (previous_sibling_proxy) 605 if (previous_sibling_proxy)
605 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 606 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
606 607
607 // Create the RenderFrame and WebLocalFrame, linking the two. 608 // Create the RenderFrame and WebLocalFrame, linking the two.
608 render_frame = 609 render_frame =
609 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 610 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
610 web_frame = parent_web_frame->createLocalChild( 611 web_frame = parent_web_frame->createLocalChild(
611 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 612 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
612 replicated_state.sandbox_flags, render_frame, 613 replicated_state.sandbox_flags, render_frame,
613 previous_sibling_web_frame); 614 previous_sibling_web_frame, frame_owner_properties);
614 } else { 615 } else {
615 RenderFrameProxy* proxy = 616 RenderFrameProxy* proxy =
616 RenderFrameProxy::FromRoutingID(proxy_routing_id); 617 RenderFrameProxy::FromRoutingID(proxy_routing_id);
617 CHECK(proxy); 618 CHECK(proxy);
618 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 619 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
619 web_frame = 620 web_frame =
620 blink::WebLocalFrame::create(replicated_state.scope, render_frame); 621 blink::WebLocalFrame::create(replicated_state.scope, render_frame);
621 render_frame->proxy_routing_id_ = proxy_routing_id; 622 render_frame->proxy_routing_id_ = proxy_routing_id;
622 web_frame->initializeToReplaceRemoteFrame( 623 web_frame->initializeToReplaceRemoteFrame(
623 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), 624 proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
624 replicated_state.sandbox_flags); 625 replicated_state.sandbox_flags, frame_owner_properties);
625 } 626 }
626 render_frame->SetWebFrame(web_frame); 627 render_frame->SetWebFrame(web_frame);
627 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); 628 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent());
628 629
629 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr); 630 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
630 web_frame->setOpener(opener); 631 web_frame->setOpener(opener);
631 632
632 if (widget_params.routing_id != MSG_ROUTING_NONE) { 633 if (widget_params.routing_id != MSG_ROUTING_NONE) {
633 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); 634 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
634 render_frame->render_widget_ = RenderWidget::CreateForFrame( 635 render_frame->render_widget_ = RenderWidget::CreateForFrame(
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) 1127 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload)
1127 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, 1128 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest,
1128 OnTextSurroundingSelectionRequest) 1129 OnTextSurroundingSelectionRequest)
1129 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, 1130 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode,
1130 OnSetAccessibilityMode) 1131 OnSetAccessibilityMode)
1131 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, 1132 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree,
1132 OnSnapshotAccessibilityTree) 1133 OnSnapshotAccessibilityTree)
1133 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) 1134 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener)
1134 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) 1135 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
1135 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) 1136 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags)
1137 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1138 OnSetFrameOwnerProperties)
1136 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocus, OnClearFocus) 1139 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocus, OnClearFocus)
1137 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1140 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1138 OnTextTrackSettingsChanged) 1141 OnTextTrackSettingsChanged)
1139 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1142 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1140 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1143 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1141 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1144 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1142 OnGetSavableResourceLinks) 1145 OnGetSavableResourceLinks)
1143 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1146 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1144 OnGetSerializedHtmlWithLocalLinks) 1147 OnGetSerializedHtmlWithLocalLinks)
1145 #if defined(OS_ANDROID) 1148 #if defined(OS_ANDROID)
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 1686
1684 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { 1687 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) {
1685 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr); 1688 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
1686 frame_->setOpener(opener); 1689 frame_->setOpener(opener);
1687 } 1690 }
1688 1691
1689 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { 1692 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) {
1690 frame_->setFrameOwnerSandboxFlags(flags); 1693 frame_->setFrameOwnerSandboxFlags(flags);
1691 } 1694 }
1692 1695
1696 void RenderFrameImpl::OnSetFrameOwnerProperties(
1697 const blink::WebFrameOwnerProperties& frame_owner_properties) {
1698 DCHECK(frame_);
1699 frame_->setFrameOwnerProperties(frame_owner_properties);
1700 }
1701
1693 void RenderFrameImpl::OnClearFocus() { 1702 void RenderFrameImpl::OnClearFocus() {
1694 frame_->clearFocus(); 1703 frame_->clearFocus();
1695 } 1704 }
1696 1705
1697 void RenderFrameImpl::OnTextTrackSettingsChanged( 1706 void RenderFrameImpl::OnTextTrackSettingsChanged(
1698 const FrameMsg_TextTrackSettings_Params& params) { 1707 const FrameMsg_TextTrackSettings_Params& params) {
1699 DCHECK(!frame_->parent()); 1708 DCHECK(!frame_->parent());
1700 if (!render_view_->webview()) 1709 if (!render_view_->webview())
1701 return; 1710 return;
1702 1711
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 if (!navigation_state->request_committed()) { 2240 if (!navigation_state->request_committed()) {
2232 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_)); 2241 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_));
2233 } 2242 }
2234 } 2243 }
2235 } 2244 }
2236 2245
2237 blink::WebFrame* RenderFrameImpl::createChildFrame( 2246 blink::WebFrame* RenderFrameImpl::createChildFrame(
2238 blink::WebLocalFrame* parent, 2247 blink::WebLocalFrame* parent,
2239 blink::WebTreeScopeType scope, 2248 blink::WebTreeScopeType scope,
2240 const blink::WebString& name, 2249 const blink::WebString& name,
2241 blink::WebSandboxFlags sandbox_flags) { 2250 blink::WebSandboxFlags sandbox_flags,
2251 const blink::WebFrameOwnerProperties& frameOwnerProperties) {
2242 // Synchronously notify the browser of a child frame creation to get the 2252 // Synchronously notify the browser of a child frame creation to get the
2243 // routing_id for the RenderFrame. 2253 // routing_id for the RenderFrame.
2244 int child_routing_id = MSG_ROUTING_NONE; 2254 int child_routing_id = MSG_ROUTING_NONE;
2245 Send(new FrameHostMsg_CreateChildFrame( 2255 Send(new FrameHostMsg_CreateChildFrame(
2246 routing_id_, scope, 2256 routing_id_, scope, base::UTF16ToUTF8(base::StringPiece16(name)),
2247 base::UTF16ToUTF8(base::StringPiece16(name)), sandbox_flags, 2257 sandbox_flags, frameOwnerProperties, &child_routing_id));
2248 &child_routing_id));
2249 2258
2250 // Allocation of routing id failed, so we can't create a child frame. This can 2259 // Allocation of routing id failed, so we can't create a child frame. This can
2251 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped 2260 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped
2252 // out state or synchronous IPC message above has failed. 2261 // out state or synchronous IPC message above has failed.
2253 if (child_routing_id == MSG_ROUTING_NONE) { 2262 if (child_routing_id == MSG_ROUTING_NONE) {
2254 NOTREACHED() << "Failed to allocate routing id for child frame."; 2263 NOTREACHED() << "Failed to allocate routing id for child frame.";
2255 return nullptr; 2264 return nullptr;
2256 } 2265 }
2257 2266
2258 // This method is always called by local frames, never remote frames. 2267 // This method is always called by local frames, never remote frames.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)))); 2382 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name))));
2374 } 2383 }
2375 } 2384 }
2376 2385
2377 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, 2386 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame,
2378 blink::WebSandboxFlags flags) { 2387 blink::WebSandboxFlags flags) {
2379 Send(new FrameHostMsg_DidChangeSandboxFlags( 2388 Send(new FrameHostMsg_DidChangeSandboxFlags(
2380 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags)); 2389 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags));
2381 } 2390 }
2382 2391
2392 void RenderFrameImpl::didChangeFrameOwnerProperties(
2393 blink::WebFrame* child_frame,
2394 const blink::WebFrameOwnerProperties& frame_owner_properties) {
2395 Send(new FrameHostMsg_DidChangeFrameOwnerProperties(
2396 routing_id_, GetRoutingIdForFrameOrProxy(child_frame),
2397 frame_owner_properties));
2398 }
2399
2383 void RenderFrameImpl::didMatchCSS( 2400 void RenderFrameImpl::didMatchCSS(
2384 blink::WebLocalFrame* frame, 2401 blink::WebLocalFrame* frame,
2385 const blink::WebVector<blink::WebString>& newly_matching_selectors, 2402 const blink::WebVector<blink::WebString>& newly_matching_selectors,
2386 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { 2403 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
2387 DCHECK(!frame_ || frame_ == frame); 2404 DCHECK(!frame_ || frame_ == frame);
2388 2405
2389 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 2406 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
2390 DidMatchCSS(newly_matching_selectors, 2407 DidMatchCSS(newly_matching_selectors,
2391 stopped_matching_selectors)); 2408 stopped_matching_selectors));
2392 } 2409 }
(...skipping 2815 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 mojo::ServiceProviderPtr service_provider; 5225 mojo::ServiceProviderPtr service_provider;
5209 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5226 mojo::URLRequestPtr request(mojo::URLRequest::New());
5210 request->url = mojo::String::From(url); 5227 request->url = mojo::String::From(url);
5211 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5228 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5212 nullptr, nullptr, 5229 nullptr, nullptr,
5213 base::Bind(&OnGotContentHandlerID)); 5230 base::Bind(&OnGotContentHandlerID));
5214 return service_provider.Pass(); 5231 return service_provider.Pass();
5215 } 5232 }
5216 5233
5217 } // namespace content 5234 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698