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), | |
lunalu1
2017/04/13 20:54:04
This is not important, but some point in the futur
| |
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( |
2187 frame_->SetFrameOwnerSandboxFlags(flags); | 2188 blink::WebSandboxFlags flags, |
2189 const ParsedFeaturePolicyHeader& container_policy) { | |
2190 frame_->SetFrameOwnerPolicy(flags, | |
2191 FeaturePolicyHeaderToWeb(container_policy)); | |
2188 } | 2192 } |
2189 | 2193 |
2190 void RenderFrameImpl::OnSetFrameOwnerProperties( | 2194 void RenderFrameImpl::OnSetFrameOwnerProperties( |
2191 const FrameOwnerProperties& frame_owner_properties) { | 2195 const FrameOwnerProperties& frame_owner_properties) { |
2192 DCHECK(frame_); | 2196 DCHECK(frame_); |
2193 frame_->SetFrameOwnerProperties( | 2197 frame_->SetFrameOwnerProperties( |
2194 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( | 2198 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties( |
2195 frame_owner_properties)); | 2199 frame_owner_properties)); |
2196 } | 2200 } |
2197 | 2201 |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3055 | 3059 |
3056 has_accessed_initial_document_ = true; | 3060 has_accessed_initial_document_ = true; |
3057 } | 3061 } |
3058 | 3062 |
3059 blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame( | 3063 blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame( |
3060 blink::WebLocalFrame* parent, | 3064 blink::WebLocalFrame* parent, |
3061 blink::WebTreeScopeType scope, | 3065 blink::WebTreeScopeType scope, |
3062 const blink::WebString& name, | 3066 const blink::WebString& name, |
3063 const blink::WebString& fallback_name, | 3067 const blink::WebString& fallback_name, |
3064 blink::WebSandboxFlags sandbox_flags, | 3068 blink::WebSandboxFlags sandbox_flags, |
3069 const blink::WebParsedFeaturePolicy& container_policy, | |
3065 const blink::WebFrameOwnerProperties& frame_owner_properties) { | 3070 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
3066 // Synchronously notify the browser of a child frame creation to get the | 3071 // Synchronously notify the browser of a child frame creation to get the |
3067 // routing_id for the RenderFrame. | 3072 // routing_id for the RenderFrame. |
3068 int child_routing_id = MSG_ROUTING_NONE; | 3073 int child_routing_id = MSG_ROUTING_NONE; |
3069 FrameHostMsg_CreateChildFrame_Params params; | 3074 FrameHostMsg_CreateChildFrame_Params params; |
3070 params.parent_routing_id = routing_id_; | 3075 params.parent_routing_id = routing_id_; |
3071 params.scope = scope; | 3076 params.scope = scope; |
3072 params.frame_name = name.Utf8(); | 3077 params.frame_name = name.Utf8(); |
3073 // The unique name generation logic was moved out of Blink, so for historical | 3078 // The unique name generation logic was moved out of Blink, so for historical |
3074 // reasons, unique name generation needs to take something called the | 3079 // reasons, unique name generation needs to take something called the |
3075 // |fallback_name| into account. Normally, unique names are generated based on | 3080 // |fallback_name| into account. Normally, unique names are generated based on |
3076 // the browing context name. For new frames, the initial browsing context name | 3081 // the browing context name. For new frames, the initial browsing context name |
3077 // comes from the name attribute of the browsing context container element. | 3082 // comes from the name attribute of the browsing context container element. |
3078 // | 3083 // |
3079 // However, when the browsing context name is null, Blink instead uses the | 3084 // However, when the browsing context name is null, Blink instead uses the |
3080 // "fallback name" to derive the unique name. The exact contents of the | 3085 // "fallback name" to derive the unique name. The exact contents of the |
3081 // "fallback name" are unspecified, but may contain the value of the | 3086 // "fallback name" are unspecified, but may contain the value of the |
3082 // 'subresource attribute' of the browsing context container element. | 3087 // 'subresource attribute' of the browsing context container element. |
3083 // | 3088 // |
3084 // Note that Blink can't be changed to just pass |fallback_name| as |name| in | 3089 // Note that Blink can't be changed to just pass |fallback_name| as |name| in |
3085 // the case |name| is empty: |fallback_name| should never affect the actual | 3090 // the case |name| is empty: |fallback_name| should never affect the actual |
3086 // browsing context name, only unique name generation. | 3091 // browsing context name, only unique name generation. |
3087 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame( | 3092 params.frame_unique_name = UniqueNameHelper::GenerateNameForNewChildFrame( |
3088 parent, | 3093 parent, |
3089 params.frame_name.empty() ? fallback_name.Utf8() : params.frame_name); | 3094 params.frame_name.empty() ? fallback_name.Utf8() : params.frame_name); |
3090 params.sandbox_flags = sandbox_flags; | 3095 params.sandbox_flags = sandbox_flags; |
3096 params.container_policy = FeaturePolicyHeaderFromWeb(container_policy); | |
3091 params.frame_owner_properties = | 3097 params.frame_owner_properties = |
3092 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( | 3098 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( |
3093 frame_owner_properties); | 3099 frame_owner_properties); |
3094 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); | 3100 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); |
3095 | 3101 |
3096 // Allocation of routing id failed, so we can't create a child frame. This can | 3102 // Allocation of routing id failed, so we can't create a child frame. This can |
3097 // happen if the synchronous IPC message above has failed. This can | 3103 // happen if the synchronous IPC message above has failed. This can |
3098 // legitimately happen when the browser process has already destroyed | 3104 // legitimately happen when the browser process has already destroyed |
3099 // RenderProcessHost, but the renderer process hasn't quit yet. | 3105 // RenderProcessHost, but the renderer process hasn't quit yet. |
3100 if (child_routing_id == MSG_ROUTING_NONE) | 3106 if (child_routing_id == MSG_ROUTING_NONE) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3238 blink::WebInsecureRequestPolicy policy) { | 3244 blink::WebInsecureRequestPolicy policy) { |
3239 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); | 3245 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); |
3240 } | 3246 } |
3241 | 3247 |
3242 void RenderFrameImpl::DidUpdateToUniqueOrigin( | 3248 void RenderFrameImpl::DidUpdateToUniqueOrigin( |
3243 bool is_potentially_trustworthy_unique_origin) { | 3249 bool is_potentially_trustworthy_unique_origin) { |
3244 Send(new FrameHostMsg_UpdateToUniqueOrigin( | 3250 Send(new FrameHostMsg_UpdateToUniqueOrigin( |
3245 routing_id_, is_potentially_trustworthy_unique_origin)); | 3251 routing_id_, is_potentially_trustworthy_unique_origin)); |
3246 } | 3252 } |
3247 | 3253 |
3248 void RenderFrameImpl::DidChangeSandboxFlags(blink::WebFrame* child_frame, | 3254 void RenderFrameImpl::DidChangeFramePolicy( |
3249 blink::WebSandboxFlags flags) { | 3255 blink::WebFrame* child_frame, |
3250 Send(new FrameHostMsg_DidChangeSandboxFlags( | 3256 blink::WebSandboxFlags flags, |
3251 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags)); | 3257 const blink::WebParsedFeaturePolicy& container_policy) { |
3258 Send(new FrameHostMsg_DidChangeFramePolicy( | |
3259 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), flags, | |
3260 FeaturePolicyHeaderFromWeb(container_policy))); | |
3252 } | 3261 } |
3253 | 3262 |
3254 void RenderFrameImpl::DidSetFeaturePolicyHeader( | 3263 void RenderFrameImpl::DidSetFeaturePolicyHeader( |
3255 const blink::WebParsedFeaturePolicy& parsed_header) { | 3264 const blink::WebParsedFeaturePolicy& parsed_header) { |
3256 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( | 3265 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( |
3257 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); | 3266 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); |
3258 } | 3267 } |
3259 | 3268 |
3260 void RenderFrameImpl::DidAddContentSecurityPolicies( | 3269 void RenderFrameImpl::DidAddContentSecurityPolicies( |
3261 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) { | 3270 const blink::WebVector<blink::WebContentSecurityPolicy>& policies) { |
(...skipping 3713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6975 policy(info.default_policy), | 6984 policy(info.default_policy), |
6976 replaces_current_history_item(info.replaces_current_history_item), | 6985 replaces_current_history_item(info.replaces_current_history_item), |
6977 history_navigation_in_new_child_frame( | 6986 history_navigation_in_new_child_frame( |
6978 info.is_history_navigation_in_new_child_frame), | 6987 info.is_history_navigation_in_new_child_frame), |
6979 client_redirect(info.is_client_redirect), | 6988 client_redirect(info.is_client_redirect), |
6980 cache_disabled(info.is_cache_disabled), | 6989 cache_disabled(info.is_cache_disabled), |
6981 form(info.form), | 6990 form(info.form), |
6982 source_location(info.source_location) {} | 6991 source_location(info.source_location) {} |
6983 | 6992 |
6984 } // namespace content | 6993 } // namespace content |
OLD | NEW |