Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index f7bf0b0b354edd142fe23e6feb3eb4b0c9055eaa..acd252f2512b075674acd6742c0c3baeb3b37a2b 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -477,6 +477,61 @@ CommonNavigationParams MakeCommonNavigationParams( |
| RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = |
| nullptr; |
| +// Check that blink::WebSandboxFlags is kept in sync with |
|
Charlie Reis
2015/01/08 22:17:26
I haven't dealt with these much before, but it loo
alexmos
2015/01/09 20:43:25
Done. I put them as static functions in RenderFra
|
| +// content::SandboxFlags. |
| +COMPILE_ASSERT(blink::WebSandboxNone == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::NONE), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxNavigation == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::NAVIGATION), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxPlugins == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::PLUGINS), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxOrigin == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::ORIGIN), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxForms == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::FORMS), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxScripts == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::SCRIPTS), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxTopNavigation == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::TOP_NAVIGATION), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxPopups == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::POPUPS), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT( |
| + blink::WebSandboxAutomaticFeatures == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::AUTOMATIC_FEATURES), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxPointerLock == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::POINTER_LOCK), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxDocumentDomain == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::DOCUMENT_DOMAIN), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxOrientationLock == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::ORIENTATION_LOCK), |
| + enum_values_must_match_for_sandbox_flags); |
| +COMPILE_ASSERT(blink::WebSandboxAll == |
| + static_cast<blink::WebSandboxFlags>( |
| + content::SandboxFlags::ALL), |
| + enum_values_must_match_for_sandbox_flags); |
| } // namespace |
| @@ -501,9 +556,11 @@ RenderFrameImpl* RenderFrameImpl::FromRoutingID(int32 routing_id) { |
| } |
| // static |
| -void RenderFrameImpl::CreateFrame(int routing_id, |
| - int parent_routing_id, |
| - int proxy_routing_id) { |
| +void RenderFrameImpl::CreateFrame( |
| + int routing_id, |
| + int parent_routing_id, |
| + int proxy_routing_id, |
| + const FrameReplicationState& replicated_state) { |
| // TODO(nasko): For now, this message is only sent for subframes, as the |
| // top level frame is created when the RenderView is created through the |
| // ViewMsg_New IPC. |
| @@ -522,7 +579,9 @@ void RenderFrameImpl::CreateFrame(int routing_id, |
| // Create the RenderFrame and WebLocalFrame, linking the two. |
| render_frame = |
| RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); |
| - web_frame = parent_web_frame->createLocalChild("", render_frame); |
| + web_frame = parent_web_frame->createLocalChild("", |
| + static_cast<blink::WebSandboxFlags>(replicated_state.sandbox_flags), |
| + render_frame); |
| } else { |
| RenderFrameProxy* proxy = |
| RenderFrameProxy::FromRoutingID(proxy_routing_id); |
| @@ -1924,15 +1983,26 @@ void RenderFrameImpl::didAccessInitialDocument(blink::WebLocalFrame* frame) { |
| Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_)); |
| } |
| +// TODO(alexmos): Remove once Blink is updated to use the version that takes |
| +// sandboxFlags. |
| blink::WebFrame* RenderFrameImpl::createChildFrame( |
| blink::WebLocalFrame* parent, |
| const blink::WebString& name) { |
| + return createChildFrame(parent, name, blink::WebSandboxNone); |
| +} |
| + |
| +blink::WebFrame* RenderFrameImpl::createChildFrame( |
| + blink::WebLocalFrame* parent, |
| + const blink::WebString& name, |
| + blink::WebSandboxFlags sandbox_flags) { |
| // Synchronously notify the browser of a child frame creation to get the |
| // routing_id for the RenderFrame. |
| int child_routing_id = MSG_ROUTING_NONE; |
| - Send(new FrameHostMsg_CreateChildFrame(routing_id_, |
| - base::UTF16ToUTF8(name), |
| - &child_routing_id)); |
| + Send(new FrameHostMsg_CreateChildFrame( |
| + routing_id_, |
| + base::UTF16ToUTF8(name), |
| + static_cast<content::SandboxFlags>(sandbox_flags), |
| + &child_routing_id)); |
| // Allocation of routing id failed, so we can't create a child frame. This can |
| // happen if this RenderFrameImpl's IPCs are being filtered when in swapped |
| // out state. |