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

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

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Addressing review comments Created 3 years, 8 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 995 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
996 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); 996 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id));
997 render_frame->unique_name_helper_.set_propagated_name( 997 render_frame->unique_name_helper_.set_propagated_name(
998 replicated_state.unique_name); 998 replicated_state.unique_name);
999 web_frame = parent_web_frame->CreateLocalChild( 999 web_frame = parent_web_frame->CreateLocalChild(
1000 replicated_state.scope, WebString::FromUTF8(replicated_state.name), 1000 replicated_state.scope, WebString::FromUTF8(replicated_state.name),
1001 replicated_state.sandbox_flags, render_frame, 1001 replicated_state.sandbox_flags, render_frame,
1002 render_frame->blink_interface_provider_.get(), 1002 render_frame->blink_interface_provider_.get(),
1003 render_frame->blink_interface_registry_.get(), 1003 render_frame->blink_interface_registry_.get(),
1004 previous_sibling_web_frame, 1004 previous_sibling_web_frame,
1005 FeaturePolicyHeaderToWeb(replicated_state.container_policy),
1005 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( 1006 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties(
1006 frame_owner_properties), 1007 frame_owner_properties),
1007 ResolveOpener(opener_routing_id)); 1008 ResolveOpener(opener_routing_id));
1008 1009
1009 // The RenderFrame is created and inserted into the frame tree in the above 1010 // The RenderFrame is created and inserted into the frame tree in the above
1010 // call to createLocalChild. 1011 // call to createLocalChild.
1011 render_frame->in_frame_tree_ = true; 1012 render_frame->in_frame_tree_ = true;
1012 } else { 1013 } else {
1013 RenderFrameProxy* proxy = 1014 RenderFrameProxy* proxy =
1014 RenderFrameProxy::FromRoutingID(proxy_routing_id); 1015 RenderFrameProxy::FromRoutingID(proxy_routing_id);
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) 1582 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages)
1582 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, 1583 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest,
1583 OnTextSurroundingSelectionRequest) 1584 OnTextSurroundingSelectionRequest)
1584 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, 1585 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode,
1585 OnSetAccessibilityMode) 1586 OnSetAccessibilityMode)
1586 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, 1587 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree,
1587 OnSnapshotAccessibilityTree) 1588 OnSnapshotAccessibilityTree)
1588 IPC_MESSAGE_HANDLER(FrameMsg_ExtractSmartClipData, OnExtractSmartClipData) 1589 IPC_MESSAGE_HANDLER(FrameMsg_ExtractSmartClipData, OnExtractSmartClipData)
1589 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) 1590 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener)
1590 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) 1591 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
1591 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) 1592 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateFramePolicy, OnDidUpdateFramePolicy)
1592 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, 1593 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1593 OnSetFrameOwnerProperties) 1594 OnSetFrameOwnerProperties)
1594 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) 1595 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus)
1595 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) 1596 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame)
1596 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1597 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1597 OnTextTrackSettingsChanged) 1598 OnTextTrackSettingsChanged)
1598 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1599 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1599 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1600 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1600 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation, 1601 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation,
1601 OnReportContentSecurityPolicyViolation) 1602 OnReportContentSecurityPolicyViolation)
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 GetWebFrame()->ExtractSmartClipData(rect, clip_text, clip_html); 2188 GetWebFrame()->ExtractSmartClipData(rect, clip_text, clip_html);
2188 Send(new FrameHostMsg_SmartClipDataExtracted( 2189 Send(new FrameHostMsg_SmartClipDataExtracted(
2189 routing_id_, id, clip_text.Utf16(), clip_html.Utf16())); 2190 routing_id_, id, clip_text.Utf16(), clip_html.Utf16()));
2190 } 2191 }
2191 2192
2192 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { 2193 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) {
2193 WebFrame* opener = ResolveOpener(opener_routing_id); 2194 WebFrame* opener = ResolveOpener(opener_routing_id);
2194 frame_->SetOpener(opener); 2195 frame_->SetOpener(opener);
2195 } 2196 }
2196 2197
2197 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { 2198 void RenderFrameImpl::OnDidUpdateFramePolicy(
2198 frame_->SetFrameOwnerSandboxFlags(flags); 2199 blink::WebSandboxFlags flags,
2200 const ParsedFeaturePolicyHeader& container_policy) {
2201 frame_->SetFrameOwnerPolicy(flags,
2202 FeaturePolicyHeaderToWeb(container_policy));
2199 } 2203 }
2200 2204
2201 void RenderFrameImpl::OnSetFrameOwnerProperties( 2205 void RenderFrameImpl::OnSetFrameOwnerProperties(
2202 const FrameOwnerProperties& frame_owner_properties) { 2206 const FrameOwnerProperties& frame_owner_properties) {
2203 DCHECK(frame_); 2207 DCHECK(frame_);
2204 frame_->SetFrameOwnerProperties( 2208 frame_->SetFrameOwnerProperties(
2205 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( 2209 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties(
2206 frame_owner_properties)); 2210 frame_owner_properties));
2207 } 2211 }
2208 2212
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 3076
3073 has_accessed_initial_document_ = true; 3077 has_accessed_initial_document_ = true;
3074 } 3078 }
3075 3079
3076 blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame( 3080 blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame(
3077 blink::WebLocalFrame* parent, 3081 blink::WebLocalFrame* parent,
3078 blink::WebTreeScopeType scope, 3082 blink::WebTreeScopeType scope,
3079 const blink::WebString& name, 3083 const blink::WebString& name,
3080 const blink::WebString& fallback_name, 3084 const blink::WebString& fallback_name,
3081 blink::WebSandboxFlags sandbox_flags, 3085 blink::WebSandboxFlags sandbox_flags,
3086 const blink::WebParsedFeaturePolicy& container_policy,
3082 const blink::WebFrameOwnerProperties& frame_owner_properties) { 3087 const blink::WebFrameOwnerProperties& frame_owner_properties) {
3083 // Synchronously notify the browser of a child frame creation to get the 3088 // Synchronously notify the browser of a child frame creation to get the
3084 // routing_id for the RenderFrame. 3089 // routing_id for the RenderFrame.
3085 int child_routing_id = MSG_ROUTING_NONE; 3090 int child_routing_id = MSG_ROUTING_NONE;
3086 FrameHostMsg_CreateChildFrame_Params params; 3091 FrameHostMsg_CreateChildFrame_Params params;
3087 params.parent_routing_id = routing_id_; 3092 params.parent_routing_id = routing_id_;
3088 params.scope = scope; 3093 params.scope = scope;
3089 params.frame_name = name.Utf8(); 3094 params.frame_name = name.Utf8();
3090 // The unique name generation logic was moved out of Blink, so for historical 3095 // The unique name generation logic was moved out of Blink, so for historical
3091 // reasons, unique name generation needs to take something called the 3096 // reasons, unique name generation needs to take something called the
3092 // |fallback_name| into account. Normally, unique names are generated based on 3097 // |fallback_name| into account. Normally, unique names are generated based on
3093 // the browing context name. For new frames, the initial browsing context name 3098 // the browing context name. For new frames, the initial browsing context name
3094 // comes from the name attribute of the browsing context container element. 3099 // comes from the name attribute of the browsing context container element.
3095 // 3100 //
3096 // However, when the browsing context name is null, Blink instead uses the 3101 // However, when the browsing context name is null, Blink instead uses the
3097 // "fallback name" to derive the unique name. The exact contents of the 3102 // "fallback name" to derive the unique name. The exact contents of the
3098 // "fallback name" are unspecified, but may contain the value of the 3103 // "fallback name" are unspecified, but may contain the value of the
3099 // 'subresource attribute' of the browsing context container element. 3104 // 'subresource attribute' of the browsing context container element.
3100 // 3105 //
3101 // Note that Blink can't be changed to just pass |fallback_name| as |name| in 3106 // Note that Blink can't be changed to just pass |fallback_name| as |name| in
3102 // the case |name| is empty: |fallback_name| should never affect the actual 3107 // the case |name| is empty: |fallback_name| should never affect the actual
3103 // browsing context name, only unique name generation. 3108 // browsing context name, only unique name generation.
3104 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame( 3109 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame(
3105 parent, 3110 parent,
3106 params.frame_name.empty() ? fallback_name.Utf8() : params.frame_name); 3111 params.frame_name.empty() ? fallback_name.Utf8() : params.frame_name);
3107 params.sandbox_flags = sandbox_flags; 3112 params.sandbox_flags = sandbox_flags;
3113 params.container_policy = FeaturePolicyHeaderFromWeb(container_policy);
3108 params.frame_owner_properties = 3114 params.frame_owner_properties =
3109 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( 3115 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties(
3110 frame_owner_properties); 3116 frame_owner_properties);
3111 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); 3117 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id));
3112 3118
3113 // Allocation of routing id failed, so we can't create a child frame. This can 3119 // Allocation of routing id failed, so we can't create a child frame. This can
3114 // happen if the synchronous IPC message above has failed. This can 3120 // happen if the synchronous IPC message above has failed. This can
3115 // legitimately happen when the browser process has already destroyed 3121 // legitimately happen when the browser process has already destroyed
3116 // RenderProcessHost, but the renderer process hasn't quit yet. 3122 // RenderProcessHost, but the renderer process hasn't quit yet.
3117 if (child_routing_id == MSG_ROUTING_NONE) 3123 if (child_routing_id == MSG_ROUTING_NONE)
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 blink::WebInsecureRequestPolicy policy) { 3261 blink::WebInsecureRequestPolicy policy) {
3256 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); 3262 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy));
3257 } 3263 }
3258 3264
3259 void RenderFrameImpl::DidUpdateToUniqueOrigin( 3265 void RenderFrameImpl::DidUpdateToUniqueOrigin(
3260 bool is_potentially_trustworthy_unique_origin) { 3266 bool is_potentially_trustworthy_unique_origin) {
3261 Send(new FrameHostMsg_UpdateToUniqueOrigin( 3267 Send(new FrameHostMsg_UpdateToUniqueOrigin(
3262 routing_id_, is_potentially_trustworthy_unique_origin)); 3268 routing_id_, is_potentially_trustworthy_unique_origin));
3263 } 3269 }
3264 3270
3265 void RenderFrameImpl::DidChangeSandboxFlags(blink::WebFrame* child_frame, 3271 void RenderFrameImpl::DidChangeFramePolicy(
3266 blink::WebSandboxFlags flags) { 3272 blink::WebFrame* child_frame,
3267 Send(new FrameHostMsg_DidChangeSandboxFlags( 3273 blink::WebSandboxFlags flags,
3268 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags)); 3274 const blink::WebParsedFeaturePolicy& container_policy) {
3275 Send(new FrameHostMsg_DidChangeFramePolicy(
3276 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags,
3277 FeaturePolicyHeaderFromWeb(container_policy)));
3269 } 3278 }
3270 3279
3271 void RenderFrameImpl::DidSetFeaturePolicyHeader( 3280 void RenderFrameImpl::DidSetFeaturePolicyHeader(
3272 const blink::WebParsedFeaturePolicy& parsed_header) { 3281 const blink::WebParsedFeaturePolicy& parsed_header) {
3273 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( 3282 Send(new FrameHostMsg_DidSetFeaturePolicyHeader(
3274 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); 3283 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header)));
3275 } 3284 }
3276 3285
3277 void RenderFrameImpl::DidAddContentSecurityPolicies( 3286 void RenderFrameImpl::DidAddContentSecurityPolicies(
3278 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) { 3287 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) {
(...skipping 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after
6988 policy(info.default_policy), 6997 policy(info.default_policy),
6989 replaces_current_history_item(info.replaces_current_history_item), 6998 replaces_current_history_item(info.replaces_current_history_item),
6990 history_navigation_in_new_child_frame( 6999 history_navigation_in_new_child_frame(
6991 info.is_history_navigation_in_new_child_frame), 7000 info.is_history_navigation_in_new_child_frame),
6992 client_redirect(info.is_client_redirect), 7001 client_redirect(info.is_client_redirect),
6993 cache_disabled(info.is_cache_disabled), 7002 cache_disabled(info.is_cache_disabled),
6994 form(info.form), 7003 form(info.form),
6995 source_location(info.source_location) {} 7004 source_location(info.source_location) {}
6996 7005
6997 } // namespace content 7006 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698