| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "bindings/core/v8/ConditionalFeatures.h" | 5 #include "bindings/core/v8/ConditionalFeatures.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Document.h" | 8 #include "bindings/core/v8/V8Document.h" |
| 9 #include "bindings/core/v8/V8HTMLLinkElement.h" | 9 #include "bindings/core/v8/V8HTMLLinkElement.h" |
| 10 #include "bindings/core/v8/V8Navigator.h" | 10 #include "bindings/core/v8/V8Navigator.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 v8::Local<v8::Function>()); | 92 v8::Local<v8::Function>()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature, | 95 bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature, |
| 96 const LocalFrame* frame) { | 96 const LocalFrame* frame) { |
| 97 // If there is no frame, or if feature policy is disabled, use defaults. | 97 // If there is no frame, or if feature policy is disabled, use defaults. |
| 98 bool enabledByDefault = | 98 bool enabledByDefault = |
| 99 (feature.defaultPolicy != FeaturePolicy::FeatureDefault::DisableForAll); | 99 (feature.defaultPolicy != FeaturePolicy::FeatureDefault::DisableForAll); |
| 100 if (!RuntimeEnabledFeatures::featurePolicyEnabled() || !frame) | 100 if (!RuntimeEnabledFeatures::featurePolicyEnabled() || !frame) |
| 101 return enabledByDefault; | 101 return enabledByDefault; |
| 102 FeaturePolicy* featurePolicy = frame->getFeaturePolicy(); | 102 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy(); |
| 103 if (!featurePolicy) | 103 if (!featurePolicy) |
| 104 return enabledByDefault; | 104 return enabledByDefault; |
| 105 | 105 |
| 106 // Otherwise, check policy. | 106 // Otherwise, check policy. |
| 107 return featurePolicy->isFeatureEnabled(feature); | 107 return featurePolicy->isFeatureEnabled(feature); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |