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/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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); | 994 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); |
995 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); | 995 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); |
996 render_frame->unique_name_helper_.set_propagated_name( | 996 render_frame->unique_name_helper_.set_propagated_name( |
997 replicated_state.unique_name); | 997 replicated_state.unique_name); |
998 web_frame = parent_web_frame->CreateLocalChild( | 998 web_frame = parent_web_frame->CreateLocalChild( |
999 replicated_state.scope, WebString::FromUTF8(replicated_state.name), | 999 replicated_state.scope, WebString::FromUTF8(replicated_state.name), |
1000 replicated_state.sandbox_flags, render_frame, | 1000 replicated_state.sandbox_flags, render_frame, |
1001 render_frame->blink_interface_provider_.get(), | 1001 render_frame->blink_interface_provider_.get(), |
1002 render_frame->blink_interface_registry_.get(), | 1002 render_frame->blink_interface_registry_.get(), |
1003 previous_sibling_web_frame, | 1003 previous_sibling_web_frame, |
| 1004 FeaturePolicyHeaderToWeb(replicated_state.container_policy), |
1004 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( | 1005 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( |
1005 frame_owner_properties), | 1006 frame_owner_properties), |
1006 ResolveOpener(opener_routing_id)); | 1007 ResolveOpener(opener_routing_id)); |
1007 | 1008 |
1008 // The RenderFrame is created and inserted into the frame tree in the above | 1009 // The RenderFrame is created and inserted into the frame tree in the above |
1009 // call to createLocalChild. | 1010 // call to createLocalChild. |
1010 render_frame->in_frame_tree_ = true; | 1011 render_frame->in_frame_tree_ = true; |
1011 } else { | 1012 } else { |
1012 RenderFrameProxy* proxy = | 1013 RenderFrameProxy* proxy = |
1013 RenderFrameProxy::FromRoutingID(proxy_routing_id); | 1014 RenderFrameProxy::FromRoutingID(proxy_routing_id); |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) | 1581 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) |
1581 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 1582 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
1582 OnTextSurroundingSelectionRequest) | 1583 OnTextSurroundingSelectionRequest) |
1583 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | 1584 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
1584 OnSetAccessibilityMode) | 1585 OnSetAccessibilityMode) |
1585 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, | 1586 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, |
1586 OnSnapshotAccessibilityTree) | 1587 OnSnapshotAccessibilityTree) |
1587 IPC_MESSAGE_HANDLER(FrameMsg_ExtractSmartClipData, OnExtractSmartClipData) | 1588 IPC_MESSAGE_HANDLER(FrameMsg_ExtractSmartClipData, OnExtractSmartClipData) |
1588 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) | 1589 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) |
1589 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) | 1590 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) |
1590 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 1591 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateFramePolicy, OnDidUpdateFramePolicy) |
1591 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, | 1592 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, |
1592 OnSetFrameOwnerProperties) | 1593 OnSetFrameOwnerProperties) |
1593 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) | 1594 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) |
1594 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) | 1595 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) |
1595 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, | 1596 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, |
1596 OnTextTrackSettingsChanged) | 1597 OnTextTrackSettingsChanged) |
1597 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) | 1598 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) |
1598 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) | 1599 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) |
1599 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation, | 1600 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation, |
1600 OnReportContentSecurityPolicyViolation) | 1601 OnReportContentSecurityPolicyViolation) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 GetWebFrame()->ExtractSmartClipData(rect, clip_text, clip_html); | 2187 GetWebFrame()->ExtractSmartClipData(rect, clip_text, clip_html); |
2187 Send(new FrameHostMsg_SmartClipDataExtracted( | 2188 Send(new FrameHostMsg_SmartClipDataExtracted( |
2188 routing_id_, id, clip_text.Utf16(), clip_html.Utf16())); | 2189 routing_id_, id, clip_text.Utf16(), clip_html.Utf16())); |
2189 } | 2190 } |
2190 | 2191 |
2191 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { | 2192 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { |
2192 WebFrame* opener = ResolveOpener(opener_routing_id); | 2193 WebFrame* opener = ResolveOpener(opener_routing_id); |
2193 frame_->SetOpener(opener); | 2194 frame_->SetOpener(opener); |
2194 } | 2195 } |
2195 | 2196 |
2196 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { | 2197 void RenderFrameImpl::OnDidUpdateFramePolicy( |
2197 frame_->SetFrameOwnerSandboxFlags(flags); | 2198 blink::WebSandboxFlags flags, |
| 2199 const ParsedFeaturePolicyHeader& container_policy) { |
| 2200 frame_->SetFrameOwnerPolicy(flags, |
| 2201 FeaturePolicyHeaderToWeb(container_policy)); |
2198 } | 2202 } |
2199 | 2203 |
2200 void RenderFrameImpl::OnSetFrameOwnerProperties( | 2204 void RenderFrameImpl::OnSetFrameOwnerProperties( |
2201 const FrameOwnerProperties& frame_owner_properties) { | 2205 const FrameOwnerProperties& frame_owner_properties) { |
2202 DCHECK(frame_); | 2206 DCHECK(frame_); |
2203 frame_->SetFrameOwnerProperties( | 2207 frame_->SetFrameOwnerProperties( |
2204 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( | 2208 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( |
2205 frame_owner_properties)); | 2209 frame_owner_properties)); |
2206 } | 2210 } |
2207 | 2211 |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3065 | 3069 |
3066 has_accessed_initial_document_ = true; | 3070 has_accessed_initial_document_ = true; |
3067 } | 3071 } |
3068 | 3072 |
3069 blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame( | 3073 blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame( |
3070 blink::WebLocalFrame* parent, | 3074 blink::WebLocalFrame* parent, |
3071 blink::WebTreeScopeType scope, | 3075 blink::WebTreeScopeType scope, |
3072 const blink::WebString& name, | 3076 const blink::WebString& name, |
3073 const blink::WebString& fallback_name, | 3077 const blink::WebString& fallback_name, |
3074 blink::WebSandboxFlags sandbox_flags, | 3078 blink::WebSandboxFlags sandbox_flags, |
| 3079 const blink::WebParsedFeaturePolicy& container_policy, |
3075 const blink::WebFrameOwnerProperties& frame_owner_properties) { | 3080 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
3076 // Synchronously notify the browser of a child frame creation to get the | 3081 // Synchronously notify the browser of a child frame creation to get the |
3077 // routing_id for the RenderFrame. | 3082 // routing_id for the RenderFrame. |
3078 int child_routing_id = MSG_ROUTING_NONE; | 3083 int child_routing_id = MSG_ROUTING_NONE; |
3079 FrameHostMsg_CreateChildFrame_Params params; | 3084 FrameHostMsg_CreateChildFrame_Params params; |
3080 params.parent_routing_id = routing_id_; | 3085 params.parent_routing_id = routing_id_; |
3081 params.scope = scope; | 3086 params.scope = scope; |
3082 params.frame_name = name.Utf8(); | 3087 params.frame_name = name.Utf8(); |
3083 // The unique name generation logic was moved out of Blink, so for historical | 3088 // The unique name generation logic was moved out of Blink, so for historical |
3084 // reasons, unique name generation needs to take something called the | 3089 // reasons, unique name generation needs to take something called the |
3085 // |fallback_name| into account. Normally, unique names are generated based on | 3090 // |fallback_name| into account. Normally, unique names are generated based on |
3086 // the browing context name. For new frames, the initial browsing context name | 3091 // the browing context name. For new frames, the initial browsing context name |
3087 // comes from the name attribute of the browsing context container element. | 3092 // comes from the name attribute of the browsing context container element. |
3088 // | 3093 // |
3089 // However, when the browsing context name is null, Blink instead uses the | 3094 // However, when the browsing context name is null, Blink instead uses the |
3090 // "fallback name" to derive the unique name. The exact contents of the | 3095 // "fallback name" to derive the unique name. The exact contents of the |
3091 // "fallback name" are unspecified, but may contain the value of the | 3096 // "fallback name" are unspecified, but may contain the value of the |
3092 // 'subresource attribute' of the browsing context container element. | 3097 // 'subresource attribute' of the browsing context container element. |
3093 // | 3098 // |
3094 // Note that Blink can't be changed to just pass |fallback_name| as |name| in | 3099 // Note that Blink can't be changed to just pass |fallback_name| as |name| in |
3095 // the case |name| is empty: |fallback_name| should never affect the actual | 3100 // the case |name| is empty: |fallback_name| should never affect the actual |
3096 // browsing context name, only unique name generation. | 3101 // browsing context name, only unique name generation. |
3097 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame( | 3102 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame( |
3098 parent, | 3103 parent, |
3099 params.frame_name.empty() ? fallback_name.Utf8() : params.frame_name); | 3104 params.frame_name.empty() ? fallback_name.Utf8() : params.frame_name); |
3100 params.sandbox_flags = sandbox_flags; | 3105 params.sandbox_flags = sandbox_flags; |
| 3106 params.container_policy = FeaturePolicyHeaderFromWeb(container_policy); |
3101 params.frame_owner_properties = | 3107 params.frame_owner_properties = |
3102 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( | 3108 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( |
3103 frame_owner_properties); | 3109 frame_owner_properties); |
3104 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); | 3110 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); |
3105 | 3111 |
3106 // Allocation of routing id failed, so we can't create a child frame. This can | 3112 // Allocation of routing id failed, so we can't create a child frame. This can |
3107 // happen if the synchronous IPC message above has failed. This can | 3113 // happen if the synchronous IPC message above has failed. This can |
3108 // legitimately happen when the browser process has already destroyed | 3114 // legitimately happen when the browser process has already destroyed |
3109 // RenderProcessHost, but the renderer process hasn't quit yet. | 3115 // RenderProcessHost, but the renderer process hasn't quit yet. |
3110 if (child_routing_id == MSG_ROUTING_NONE) | 3116 if (child_routing_id == MSG_ROUTING_NONE) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 blink::WebInsecureRequestPolicy policy) { | 3254 blink::WebInsecureRequestPolicy policy) { |
3249 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); | 3255 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); |
3250 } | 3256 } |
3251 | 3257 |
3252 void RenderFrameImpl::DidUpdateToUniqueOrigin( | 3258 void RenderFrameImpl::DidUpdateToUniqueOrigin( |
3253 bool is_potentially_trustworthy_unique_origin) { | 3259 bool is_potentially_trustworthy_unique_origin) { |
3254 Send(new FrameHostMsg_UpdateToUniqueOrigin( | 3260 Send(new FrameHostMsg_UpdateToUniqueOrigin( |
3255 routing_id_, is_potentially_trustworthy_unique_origin)); | 3261 routing_id_, is_potentially_trustworthy_unique_origin)); |
3256 } | 3262 } |
3257 | 3263 |
3258 void RenderFrameImpl::DidChangeSandboxFlags(blink::WebFrame* child_frame, | 3264 void RenderFrameImpl::DidChangeFramePolicy( |
3259 blink::WebSandboxFlags flags) { | 3265 blink::WebFrame* child_frame, |
3260 Send(new FrameHostMsg_DidChangeSandboxFlags( | 3266 blink::WebSandboxFlags flags, |
3261 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags)); | 3267 const blink::WebParsedFeaturePolicy& container_policy) { |
| 3268 Send(new FrameHostMsg_DidChangeFramePolicy( |
| 3269 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags, |
| 3270 FeaturePolicyHeaderFromWeb(container_policy))); |
3262 } | 3271 } |
3263 | 3272 |
3264 void RenderFrameImpl::DidSetFeaturePolicyHeader( | 3273 void RenderFrameImpl::DidSetFeaturePolicyHeader( |
3265 const blink::WebParsedFeaturePolicy& parsed_header) { | 3274 const blink::WebParsedFeaturePolicy& parsed_header) { |
3266 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( | 3275 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( |
3267 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); | 3276 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); |
3268 } | 3277 } |
3269 | 3278 |
3270 void RenderFrameImpl::DidAddContentSecurityPolicies( | 3279 void RenderFrameImpl::DidAddContentSecurityPolicies( |
3271 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) { | 3280 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) { |
(...skipping 3699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6971 policy(info.default_policy), | 6980 policy(info.default_policy), |
6972 replaces_current_history_item(info.replaces_current_history_item), | 6981 replaces_current_history_item(info.replaces_current_history_item), |
6973 history_navigation_in_new_child_frame( | 6982 history_navigation_in_new_child_frame( |
6974 info.is_history_navigation_in_new_child_frame), | 6983 info.is_history_navigation_in_new_child_frame), |
6975 client_redirect(info.is_client_redirect), | 6984 client_redirect(info.is_client_redirect), |
6976 cache_disabled(info.is_cache_disabled), | 6985 cache_disabled(info.is_cache_disabled), |
6977 form(info.form), | 6986 form(info.form), |
6978 source_location(info.source_location) {} | 6987 source_location(info.source_location) {} |
6979 | 6988 |
6980 } // namespace content | 6989 } // namespace content |
OLD | NEW |