| 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 #ifndef ConditionalFeatures_h | 5 #ifndef ConditionalFeatures_h |
| 6 #define ConditionalFeatures_h | 6 #define ConditionalFeatures_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "platform/feature_policy/FeaturePolicy.h" |
| 10 #include <v8.h> | 11 #include <v8.h> |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 class ScriptState; | 15 class ScriptState; |
| 16 class LocalFrame; |
| 15 | 17 |
| 16 using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*, | 18 using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*, |
| 17 const ScriptState*, | 19 const ScriptState*, |
| 18 v8::Local<v8::Object>, | 20 v8::Local<v8::Object>, |
| 19 v8::Local<v8::Function>); | 21 v8::Local<v8::Function>); |
| 20 | 22 |
| 21 // Installs all of the conditionally enabled V8 bindings for the given type, in | 23 // Installs all of the conditionally enabled V8 bindings for the given type, in |
| 22 // a specific context. This is called in V8PerContextData, after the constructor | 24 // a specific context. This is called in V8PerContextData, after the constructor |
| 23 // and prototype for the type have been created. It indirectly calls the | 25 // and prototype for the type have been created. It indirectly calls the |
| 24 // function set by |setInstallConditionalFeaturesFunction|. | 26 // function set by |setInstallConditionalFeaturesFunction|. |
| 25 CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*, | 27 CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*, |
| 26 const ScriptState*, | 28 const ScriptState*, |
| 27 v8::Local<v8::Object>, | 29 v8::Local<v8::Object>, |
| 28 v8::Local<v8::Function>); | 30 v8::Local<v8::Function>); |
| 29 | 31 |
| 30 // Sets the function to be called by |installConditionalFeatures|. The function | 32 // Sets the function to be called by |installConditionalFeatures|. The function |
| 31 // is initially set to the private |installConditionalFeaturesCore| function, | 33 // is initially set to the private |installConditionalFeaturesCore| function, |
| 32 // but can be overridden by this function. A pointer to the previously set | 34 // but can be overridden by this function. A pointer to the previously set |
| 33 // function is returned, so that functions can be chained. | 35 // function is returned, so that functions can be chained. |
| 34 CORE_EXPORT InstallConditionalFeaturesFunction | 36 CORE_EXPORT InstallConditionalFeaturesFunction |
| 35 setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction); | 37 setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction); |
| 36 | 38 |
| 39 bool isFeatureEnabledInFrame(const FeaturePolicy::Feature*, const LocalFrame*); |
| 40 |
| 37 } // namespace blink | 41 } // namespace blink |
| 38 | 42 |
| 39 #endif // ConditionalFeatures_h | 43 #endif // ConditionalFeatures_h |
| OLD | NEW |