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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); | 993 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); |
994 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); | 994 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); |
995 render_frame->unique_name_helper_.set_propagated_name( | 995 render_frame->unique_name_helper_.set_propagated_name( |
996 replicated_state.unique_name); | 996 replicated_state.unique_name); |
997 web_frame = parent_web_frame->createLocalChild( | 997 web_frame = parent_web_frame->createLocalChild( |
998 replicated_state.scope, WebString::fromUTF8(replicated_state.name), | 998 replicated_state.scope, WebString::fromUTF8(replicated_state.name), |
999 replicated_state.sandbox_flags, render_frame, | 999 replicated_state.sandbox_flags, render_frame, |
1000 render_frame->blink_interface_provider_.get(), | 1000 render_frame->blink_interface_provider_.get(), |
1001 render_frame->blink_interface_registry_.get(), | 1001 render_frame->blink_interface_registry_.get(), |
1002 previous_sibling_web_frame, | 1002 previous_sibling_web_frame, |
| 1003 FeaturePolicyHeaderToWeb(replicated_state.container_policy), |
1003 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( | 1004 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( |
1004 frame_owner_properties), | 1005 frame_owner_properties), |
1005 ResolveOpener(opener_routing_id)); | 1006 ResolveOpener(opener_routing_id)); |
1006 | 1007 |
1007 // The RenderFrame is created and inserted into the frame tree in the above | 1008 // The RenderFrame is created and inserted into the frame tree in the above |
1008 // call to createLocalChild. | 1009 // call to createLocalChild. |
1009 render_frame->in_frame_tree_ = true; | 1010 render_frame->in_frame_tree_ = true; |
1010 } else { | 1011 } else { |
1011 RenderFrameProxy* proxy = | 1012 RenderFrameProxy* proxy = |
1012 RenderFrameProxy::FromRoutingID(proxy_routing_id); | 1013 RenderFrameProxy::FromRoutingID(proxy_routing_id); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) | 1571 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) |
1571 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 1572 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
1572 OnTextSurroundingSelectionRequest) | 1573 OnTextSurroundingSelectionRequest) |
1573 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | 1574 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
1574 OnSetAccessibilityMode) | 1575 OnSetAccessibilityMode) |
1575 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, | 1576 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, |
1576 OnSnapshotAccessibilityTree) | 1577 OnSnapshotAccessibilityTree) |
1577 IPC_MESSAGE_HANDLER(FrameMsg_ExtractSmartClipData, OnExtractSmartClipData) | 1578 IPC_MESSAGE_HANDLER(FrameMsg_ExtractSmartClipData, OnExtractSmartClipData) |
1578 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) | 1579 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) |
1579 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) | 1580 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) |
1580 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 1581 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateFramePolicy, OnDidUpdateFramePolicy) |
1581 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, | 1582 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, |
1582 OnSetFrameOwnerProperties) | 1583 OnSetFrameOwnerProperties) |
1583 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) | 1584 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) |
1584 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) | 1585 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) |
1585 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, | 1586 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, |
1586 OnTextTrackSettingsChanged) | 1587 OnTextTrackSettingsChanged) |
1587 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) | 1588 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) |
1588 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) | 1589 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) |
1589 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation, | 1590 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation, |
1590 OnReportContentSecurityPolicyViolation) | 1591 OnReportContentSecurityPolicyViolation) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 GetWebFrame()->extractSmartClipData(rect, clip_text, clip_html); | 2177 GetWebFrame()->extractSmartClipData(rect, clip_text, clip_html); |
2177 Send(new FrameHostMsg_SmartClipDataExtracted( | 2178 Send(new FrameHostMsg_SmartClipDataExtracted( |
2178 routing_id_, id, clip_text.utf16(), clip_html.utf16())); | 2179 routing_id_, id, clip_text.utf16(), clip_html.utf16())); |
2179 } | 2180 } |
2180 | 2181 |
2181 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { | 2182 void RenderFrameImpl::OnUpdateOpener(int opener_routing_id) { |
2182 WebFrame* opener = ResolveOpener(opener_routing_id); | 2183 WebFrame* opener = ResolveOpener(opener_routing_id); |
2183 frame_->setOpener(opener); | 2184 frame_->setOpener(opener); |
2184 } | 2185 } |
2185 | 2186 |
2186 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { | 2187 void RenderFrameImpl::OnDidUpdateFramePolicy( |
| 2188 blink::WebSandboxFlags flags, |
| 2189 const ParsedFeaturePolicyHeader& container_policy) { |
2187 frame_->setFrameOwnerSandboxFlags(flags); | 2190 frame_->setFrameOwnerSandboxFlags(flags); |
| 2191 frame_->setFrameOwnerContainerPolicy( |
| 2192 FeaturePolicyHeaderToWeb(container_policy)); |
2188 } | 2193 } |
2189 | 2194 |
2190 void RenderFrameImpl::OnSetFrameOwnerProperties( | 2195 void RenderFrameImpl::OnSetFrameOwnerProperties( |
2191 const FrameOwnerProperties& frame_owner_properties) { | 2196 const FrameOwnerProperties& frame_owner_properties) { |
2192 DCHECK(frame_); | 2197 DCHECK(frame_); |
2193 frame_->setFrameOwnerProperties( | 2198 frame_->setFrameOwnerProperties( |
2194 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( | 2199 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( |
2195 frame_owner_properties)); | 2200 frame_owner_properties)); |
2196 } | 2201 } |
2197 | 2202 |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3049 | 3054 |
3050 has_accessed_initial_document_ = true; | 3055 has_accessed_initial_document_ = true; |
3051 } | 3056 } |
3052 | 3057 |
3053 blink::WebLocalFrame* RenderFrameImpl::createChildFrame( | 3058 blink::WebLocalFrame* RenderFrameImpl::createChildFrame( |
3054 blink::WebLocalFrame* parent, | 3059 blink::WebLocalFrame* parent, |
3055 blink::WebTreeScopeType scope, | 3060 blink::WebTreeScopeType scope, |
3056 const blink::WebString& name, | 3061 const blink::WebString& name, |
3057 const blink::WebString& fallback_name, | 3062 const blink::WebString& fallback_name, |
3058 blink::WebSandboxFlags sandbox_flags, | 3063 blink::WebSandboxFlags sandbox_flags, |
| 3064 const blink::WebParsedFeaturePolicy& container_policy, |
3059 const blink::WebFrameOwnerProperties& frame_owner_properties) { | 3065 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
3060 // Synchronously notify the browser of a child frame creation to get the | 3066 // Synchronously notify the browser of a child frame creation to get the |
3061 // routing_id for the RenderFrame. | 3067 // routing_id for the RenderFrame. |
3062 int child_routing_id = MSG_ROUTING_NONE; | 3068 int child_routing_id = MSG_ROUTING_NONE; |
3063 FrameHostMsg_CreateChildFrame_Params params; | 3069 FrameHostMsg_CreateChildFrame_Params params; |
3064 params.parent_routing_id = routing_id_; | 3070 params.parent_routing_id = routing_id_; |
3065 params.scope = scope; | 3071 params.scope = scope; |
3066 params.frame_name = name.utf8(); | 3072 params.frame_name = name.utf8(); |
3067 // The unique name generation logic was moved out of Blink, so for historical | 3073 // The unique name generation logic was moved out of Blink, so for historical |
3068 // reasons, unique name generation needs to take something called the | 3074 // reasons, unique name generation needs to take something called the |
3069 // |fallback_name| into account. Normally, unique names are generated based on | 3075 // |fallback_name| into account. Normally, unique names are generated based on |
3070 // the browing context name. For new frames, the initial browsing context name | 3076 // the browing context name. For new frames, the initial browsing context name |
3071 // comes from the name attribute of the browsing context container element. | 3077 // comes from the name attribute of the browsing context container element. |
3072 // | 3078 // |
3073 // However, when the browsing context name is null, Blink instead uses the | 3079 // However, when the browsing context name is null, Blink instead uses the |
3074 // "fallback name" to derive the unique name. The exact contents of the | 3080 // "fallback name" to derive the unique name. The exact contents of the |
3075 // "fallback name" are unspecified, but may contain the value of the | 3081 // "fallback name" are unspecified, but may contain the value of the |
3076 // 'subresource attribute' of the browsing context container element. | 3082 // 'subresource attribute' of the browsing context container element. |
3077 // | 3083 // |
3078 // Note that Blink can't be changed to just pass |fallback_name| as |name| in | 3084 // Note that Blink can't be changed to just pass |fallback_name| as |name| in |
3079 // the case |name| is empty: |fallback_name| should never affect the actual | 3085 // the case |name| is empty: |fallback_name| should never affect the actual |
3080 // browsing context name, only unique name generation. | 3086 // browsing context name, only unique name generation. |
3081 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame( | 3087 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame( |
3082 parent, | 3088 parent, |
3083 params.frame_name.empty() ? fallback_name.utf8() : params.frame_name); | 3089 params.frame_name.empty() ? fallback_name.utf8() : params.frame_name); |
3084 params.sandbox_flags = sandbox_flags; | 3090 params.sandbox_flags = sandbox_flags; |
| 3091 params.container_policy = FeaturePolicyHeaderFromWeb(container_policy); |
3085 params.frame_owner_properties = | 3092 params.frame_owner_properties = |
3086 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( | 3093 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( |
3087 frame_owner_properties); | 3094 frame_owner_properties); |
3088 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); | 3095 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); |
3089 | 3096 |
3090 // Allocation of routing id failed, so we can't create a child frame. This can | 3097 // Allocation of routing id failed, so we can't create a child frame. This can |
3091 // happen if the synchronous IPC message above has failed. This can | 3098 // happen if the synchronous IPC message above has failed. This can |
3092 // legitimately happen when the browser process has already destroyed | 3099 // legitimately happen when the browser process has already destroyed |
3093 // RenderProcessHost, but the renderer process hasn't quit yet. | 3100 // RenderProcessHost, but the renderer process hasn't quit yet. |
3094 if (child_routing_id == MSG_ROUTING_NONE) | 3101 if (child_routing_id == MSG_ROUTING_NONE) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3232 blink::WebInsecureRequestPolicy policy) { | 3239 blink::WebInsecureRequestPolicy policy) { |
3233 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); | 3240 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); |
3234 } | 3241 } |
3235 | 3242 |
3236 void RenderFrameImpl::didUpdateToUniqueOrigin( | 3243 void RenderFrameImpl::didUpdateToUniqueOrigin( |
3237 bool is_potentially_trustworthy_unique_origin) { | 3244 bool is_potentially_trustworthy_unique_origin) { |
3238 Send(new FrameHostMsg_UpdateToUniqueOrigin( | 3245 Send(new FrameHostMsg_UpdateToUniqueOrigin( |
3239 routing_id_, is_potentially_trustworthy_unique_origin)); | 3246 routing_id_, is_potentially_trustworthy_unique_origin)); |
3240 } | 3247 } |
3241 | 3248 |
3242 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, | 3249 void RenderFrameImpl::didChangeFramePolicy( |
3243 blink::WebSandboxFlags flags) { | 3250 blink::WebFrame* child_frame, |
3244 Send(new FrameHostMsg_DidChangeSandboxFlags( | 3251 blink::WebSandboxFlags flags, |
3245 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags)); | 3252 const blink::WebParsedFeaturePolicy& container_policy) { |
| 3253 Send(new FrameHostMsg_DidChangeFramePolicy( |
| 3254 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags, |
| 3255 FeaturePolicyHeaderFromWeb(container_policy))); |
3246 } | 3256 } |
3247 | 3257 |
3248 void RenderFrameImpl::didSetFeaturePolicyHeader( | 3258 void RenderFrameImpl::didSetFeaturePolicyHeader( |
3249 const blink::WebParsedFeaturePolicy& parsed_header) { | 3259 const blink::WebParsedFeaturePolicy& parsed_header) { |
3250 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( | 3260 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( |
3251 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); | 3261 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); |
3252 } | 3262 } |
3253 | 3263 |
3254 void RenderFrameImpl::didAddContentSecurityPolicies( | 3264 void RenderFrameImpl::didAddContentSecurityPolicies( |
3255 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) { | 3265 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) { |
(...skipping 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6972 policy(info.defaultPolicy), | 6982 policy(info.defaultPolicy), |
6973 replaces_current_history_item(info.replacesCurrentHistoryItem), | 6983 replaces_current_history_item(info.replacesCurrentHistoryItem), |
6974 history_navigation_in_new_child_frame( | 6984 history_navigation_in_new_child_frame( |
6975 info.isHistoryNavigationInNewChildFrame), | 6985 info.isHistoryNavigationInNewChildFrame), |
6976 client_redirect(info.isClientRedirect), | 6986 client_redirect(info.isClientRedirect), |
6977 cache_disabled(info.isCacheDisabled), | 6987 cache_disabled(info.isCacheDisabled), |
6978 form(info.form), | 6988 form(info.form), |
6979 source_location(info.sourceLocation) {} | 6989 source_location(info.sourceLocation) {} |
6980 | 6990 |
6981 } // namespace content | 6991 } // namespace content |
OLD | NEW |