OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ConditionalFeaturesForCore.h" | 5 #include "bindings/core/v8/ConditionalFeaturesForCore.h" |
6 | 6 |
7 #include "bindings/core/v8/ConditionalFeatures.h" | 7 #include "bindings/core/v8/ConditionalFeatures.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/V8Document.h" | 9 #include "bindings/core/v8/V8Document.h" |
10 #include "bindings/core/v8/V8HTMLLinkElement.h" | 10 #include "bindings/core/v8/V8HTMLLinkElement.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void installConditionalFeaturesOnWindow(const ScriptState* scriptState) { | 74 void installConditionalFeaturesOnWindow(const ScriptState* scriptState) { |
75 DCHECK(scriptState); | 75 DCHECK(scriptState); |
76 DCHECK(scriptState->context() == scriptState->isolate()->GetCurrentContext()); | 76 DCHECK(scriptState->context() == scriptState->isolate()->GetCurrentContext()); |
77 DCHECK(scriptState->perContextData()); | 77 DCHECK(scriptState->perContextData()); |
78 DCHECK(scriptState->world().isMainWorld()); | 78 DCHECK(scriptState->world().isMainWorld()); |
79 installConditionalFeatures(&V8Window::wrapperTypeInfo, scriptState, | 79 installConditionalFeatures(&V8Window::wrapperTypeInfo, scriptState, |
80 v8::Local<v8::Object>(), | 80 v8::Local<v8::Object>(), |
81 v8::Local<v8::Function>()); | 81 v8::Local<v8::Function>()); |
82 } | 82 } |
83 | 83 |
84 bool isFeatureEnabledInFrame(WebFeaturePolicyFeature feature, | |
85 const Frame* frame) { | |
86 DCHECK(frame); | |
87 WebFeaturePolicy* featurePolicy = | |
88 frame->securityContext()->getFeaturePolicy(); | |
89 // The policy should always be initialized before checking it to ensure we | |
90 // properly inherit the parent policy. | |
91 DCHECK(featurePolicy); | |
92 | |
93 // Otherwise, check policy. | |
94 return featurePolicy->IsFeatureEnabled(feature); | |
95 } | |
96 | |
97 void registerInstallConditionalFeaturesForCore() { | 84 void registerInstallConditionalFeaturesForCore() { |
98 s_oldInstallConditionalFeaturesFunction = | 85 s_oldInstallConditionalFeaturesFunction = |
99 setInstallConditionalFeaturesFunction(&installConditionalFeaturesCore); | 86 setInstallConditionalFeaturesFunction(&installConditionalFeaturesCore); |
100 s_oldInstallPendingConditionalFeatureFunction = | 87 s_oldInstallPendingConditionalFeatureFunction = |
101 setInstallPendingConditionalFeatureFunction( | 88 setInstallPendingConditionalFeatureFunction( |
102 &installPendingConditionalFeatureCore); | 89 &installPendingConditionalFeatureCore); |
103 } | 90 } |
104 | 91 |
105 } // namespace blink | 92 } // namespace blink |
OLD | NEW |