Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
| index 0a9e723d661e0c70d8d428c5e4c11ffd87252239..3a17536fcbc1cd61d3fb3bcfe08d8314f6169305 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
| @@ -198,6 +198,57 @@ void HTMLIFrameElement::ParseAttribute( |
| } |
| } |
| +Vector<WebParsedFeaturePolicyDeclaration> |
| +HTMLIFrameElement::ConstructContainerPolicy() const { |
| + RefPtr<SecurityOrigin> origin = GetOriginForFeaturePolicy(); |
| + Vector<WebParsedFeaturePolicyDeclaration> container_policy; |
| + |
| + // Populate the initial container policy from the allow attribute. |
| + for (const WebFeaturePolicyFeature feature : AllowedFeatures()) { |
| + WebParsedFeaturePolicyDeclaration whitelist; |
| + whitelist.feature = feature; |
| + whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin}); |
| + container_policy.push_back(whitelist); |
| + } |
| + |
| + // If allowfullscreen attribute is present and no fullscreen policy is set, |
| + // enable the feature for all origins; similarly for allowpaymentrequest. |
| + if (AllowFullscreen()) { |
| + bool can_override_fullscreen = true; |
|
foolip
2017/06/13 14:59:30
Maybe call this any_fullscreen_policy or similar (
iclelland
2017/06/13 18:36:47
Done.
|
| + for (const auto& declaration : container_policy) { |
| + if (declaration.feature == WebFeaturePolicyFeature::kFullscreen) { |
| + can_override_fullscreen = false; |
| + break; |
| + } |
| + } |
| + if (can_override_fullscreen) { |
| + WebParsedFeaturePolicyDeclaration whitelist; |
| + whitelist.feature = WebFeaturePolicyFeature::kFullscreen; |
| + whitelist.matches_all_origins = true; |
| + whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
| + container_policy.push_back(whitelist); |
| + } |
| + } |
| + if (AllowPaymentRequest()) { |
| + bool can_override_payment = true; |
| + for (const auto& declaration : container_policy) { |
| + if (declaration.feature == WebFeaturePolicyFeature::kPayment) { |
| + can_override_payment = false; |
| + break; |
| + } |
| + } |
| + if (can_override_payment) { |
| + WebParsedFeaturePolicyDeclaration whitelist; |
| + whitelist.feature = WebFeaturePolicyFeature::kPayment; |
| + whitelist.matches_all_origins = true; |
| + whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
| + container_policy.push_back(whitelist); |
| + } |
| + } |
| + |
| + return container_policy; |
| +} |
| + |
| bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { |
| return ContentFrame() && !collapsed_by_client_ && |
| HTMLElement::LayoutObjectIsNeeded(style); |