OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 } | 201 } |
202 | 202 |
203 DOMWindow* HTMLFrameOwnerElement::contentWindow() const { | 203 DOMWindow* HTMLFrameOwnerElement::contentWindow() const { |
204 return content_frame_ ? content_frame_->DomWindow() : 0; | 204 return content_frame_ ? content_frame_->DomWindow() : 0; |
205 } | 205 } |
206 | 206 |
207 void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) { | 207 void HTMLFrameOwnerElement::SetSandboxFlags(SandboxFlags flags) { |
208 sandbox_flags_ = flags; | 208 sandbox_flags_ = flags; |
209 // Recalculate the container policy in case the allow-same-origin flag has | 209 // Recalculate the container policy in case the allow-same-origin flag has |
210 // changed. | 210 // changed. |
211 container_policy_ = GetContainerPolicyFromAllowedFeatures( | 211 container_policy_ = GetContainerPolicyFromAllowedFeatures( |
raymes
2017/06/07 23:54:38
Hmm - should this use the same ConstructContainerP
iclelland
2017/06/12 17:32:17
Good catch -- thanks. Updated.
raymes
2017/06/12 22:54:26
Can we remove GetContainerPolicyFromAllowedFeature
| |
212 AllowedFeatures(), AllowFullscreen(), AllowPaymentRequest(), | 212 AllowedFeatures(), AllowFullscreen(), AllowPaymentRequest(), |
213 GetOriginForFeaturePolicy()); | 213 GetOriginForFeaturePolicy()); |
214 | 214 |
215 // Don't notify about updates if ContentFrame() is null, for example when | 215 // Don't notify about updates if ContentFrame() is null, for example when |
216 // the subframe hasn't been created yet. | 216 // the subframe hasn't been created yet. |
217 if (ContentFrame()) { | 217 if (ContentFrame()) { |
218 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( | 218 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( |
219 ContentFrame(), sandbox_flags_, container_policy_); | 219 ContentFrame(), sandbox_flags_, container_policy_); |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const { | 223 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const { |
224 return content_frame_ && HTMLElement::IsKeyboardFocusable(); | 224 return content_frame_ && HTMLElement::IsKeyboardFocusable(); |
225 } | 225 } |
226 | 226 |
227 void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon( | 227 void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon( |
228 FrameOrPlugin* frame_or_plugin) { | 228 FrameOrPlugin* frame_or_plugin) { |
229 if (g_update_suspend_count) { | 229 if (g_update_suspend_count) { |
230 FrameOrPluginsPendingDispose().insert(frame_or_plugin); | 230 FrameOrPluginsPendingDispose().insert(frame_or_plugin); |
231 } else { | 231 } else { |
232 frame_or_plugin->Dispose(); | 232 frame_or_plugin->Dispose(); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 Vector<WebParsedFeaturePolicyDeclaration> | |
237 HTMLFrameOwnerElement::ConstructContainerPolicy() const { | |
238 RefPtr<SecurityOrigin> origin = GetOriginForFeaturePolicy(); | |
239 Vector<WebParsedFeaturePolicyDeclaration> whitelists; | |
240 for (const WebFeaturePolicyFeature feature : AllowedFeatures()) { | |
241 WebParsedFeaturePolicyDeclaration whitelist; | |
242 whitelist.feature = feature; | |
243 whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin}); | |
244 whitelists.push_back(whitelist); | |
245 } | |
246 return whitelists; | |
247 } | |
raymes
2017/06/07 23:54:38
Is this actually needed or can this be a pure virt
iclelland
2017/06/12 17:32:17
i had expected that it would be common code to han
| |
248 | |
236 void HTMLFrameOwnerElement::UpdateContainerPolicy() { | 249 void HTMLFrameOwnerElement::UpdateContainerPolicy() { |
237 container_policy_ = GetContainerPolicyFromAllowedFeatures( | 250 container_policy_ = ConstructContainerPolicy(); |
238 AllowedFeatures(), AllowFullscreen(), AllowPaymentRequest(), | |
239 GetOriginForFeaturePolicy()); | |
240 // Don't notify about updates if ContentFrame() is null, for example when | 251 // Don't notify about updates if ContentFrame() is null, for example when |
241 // the subframe hasn't been created yet. | 252 // the subframe hasn't been created yet. |
242 if (ContentFrame()) { | 253 if (ContentFrame()) { |
243 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( | 254 GetDocument().GetFrame()->Loader().Client()->DidChangeFramePolicy( |
244 ContentFrame(), sandbox_flags_, container_policy_); | 255 ContentFrame(), sandbox_flags_, container_policy_); |
245 } | 256 } |
246 } | 257 } |
247 | 258 |
248 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() { | 259 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() { |
249 // Don't notify about updates if ContentFrame() is null, for example when | 260 // Don't notify about updates if ContentFrame() is null, for example when |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 } | 372 } |
362 | 373 |
363 DEFINE_TRACE(HTMLFrameOwnerElement) { | 374 DEFINE_TRACE(HTMLFrameOwnerElement) { |
364 visitor->Trace(content_frame_); | 375 visitor->Trace(content_frame_); |
365 visitor->Trace(widget_); | 376 visitor->Trace(widget_); |
366 HTMLElement::Trace(visitor); | 377 HTMLElement::Trace(visitor); |
367 FrameOwner::Trace(visitor); | 378 FrameOwner::Trace(visitor); |
368 } | 379 } |
369 | 380 |
370 } // namespace blink | 381 } // namespace blink |
OLD | NEW |