Chromium Code Reviews| 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 <v8.h> | |
| 8 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 9 #include "platform/feature_policy/FeaturePolicy.h" | |
| 10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| 11 #include <v8.h> | |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 | 13 |
| 15 class LocalFrame; | |
| 16 class ScriptState; | 14 class ScriptState; |
| 17 struct WrapperTypeInfo; | 15 struct WrapperTypeInfo; |
| 18 | 16 |
| 19 using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*, | 17 using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*, |
| 20 const ScriptState*, | 18 const ScriptState*, |
| 21 v8::Local<v8::Object>, | 19 v8::Local<v8::Object>, |
| 22 v8::Local<v8::Function>); | 20 v8::Local<v8::Function>); |
| 23 | 21 |
| 24 using InstallPendingConditionalFeatureFunction = void (*)(const String&, | 22 using InstallPendingConditionalFeatureFunction = void (*)(const String&, |
| 25 const ScriptState*); | 23 const ScriptState*); |
| 26 | 24 |
| 27 // Sets the function to be called by |installConditionalFeatures|. The function | 25 // Sets the function to be called by |installConditionalFeatures|. The function |
| 28 // is initially set to the private |installConditionalFeaturesCore| function, | 26 // is initially set to the private |installConditionalFeaturesDefault| function, |
| 29 // but can be overridden by this function. A pointer to the previously set | 27 // but can be overridden by this function. A pointer to the previously set |
| 30 // function is returned, so that functions can be chained. | 28 // function is returned, so that functions can be chained. |
| 31 CORE_EXPORT InstallConditionalFeaturesFunction | 29 CORE_EXPORT InstallConditionalFeaturesFunction |
| 32 setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction); | 30 setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction); |
| 33 | 31 |
| 34 // Sets the function to be called by |installPendingConditionalFeature|. This | 32 // Sets the function to be called by |installPendingConditionalFeature|. This |
| 35 // Initially set to the private |installPendingConditionalFeatureCore| function, | 33 // Initially set to the private |installPendingConditionalFeatureDefault| |
|
Yuki
2017/02/20 09:34:29
typo: s/Initially/is initially/
| |
| 36 // but can be overridden by this function. A pointer to the previously set | 34 // function, but can be overridden by this function. A pointer to the previously |
| 37 // function is returned, so that functions can be chained. | 35 // set function is returned, so that functions can be chained. |
| 38 CORE_EXPORT InstallPendingConditionalFeatureFunction | 36 CORE_EXPORT InstallPendingConditionalFeatureFunction |
| 39 setInstallPendingConditionalFeatureFunction( | 37 setInstallPendingConditionalFeatureFunction( |
| 40 InstallPendingConditionalFeatureFunction); | 38 InstallPendingConditionalFeatureFunction); |
| 41 | 39 |
| 42 // Installs all of the conditionally enabled V8 bindings for the given type, in | 40 // Installs all of the conditionally enabled V8 bindings for the given type, in |
| 43 // a specific context. This is called in V8PerContextData, after the constructor | 41 // a specific context. This is called in V8PerContextData, after the constructor |
| 44 // and prototype for the type have been created. It indirectly calls the | 42 // and prototype for the type have been created. It indirectly calls the |
| 45 // function set by |setInstallConditionalFeaturesFunction|. | 43 // function set by |setInstallConditionalFeaturesFunction|. |
| 46 CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*, | 44 CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*, |
| 47 const ScriptState*, | 45 const ScriptState*, |
| 48 v8::Local<v8::Object>, | 46 v8::Local<v8::Object>, |
| 49 v8::Local<v8::Function>); | 47 v8::Local<v8::Function>); |
| 50 | 48 |
| 51 // Installs all of the conditionally enabled V8 bindings on the Window object. | |
| 52 // This is called separately from other objects so that attributes and | |
| 53 // interfaces which need to be visible on the global object are installed even | |
| 54 // when the V8 context is reused (i.e., after navigation) | |
| 55 CORE_EXPORT void installConditionalFeaturesOnWindow(const ScriptState*); | |
| 56 | |
| 57 // Installs all of the conditionally enabled V8 bindings for a feature, if | 49 // Installs all of the conditionally enabled V8 bindings for a feature, if |
| 58 // needed. This is called to install a newly-enabled feature on any existing | 50 // needed. This is called to install a newly-enabled feature on any existing |
| 59 // objects. If the target object hasn't been created, nothing is installed. The | 51 // objects. If the target object hasn't been created, nothing is installed. The |
| 60 // enabled feature will be instead be installed when the object is created | 52 // enabled feature will be instead be installed when the object is created |
| 61 // (avoids forcing the creation of objects prematurely). | 53 // (avoids forcing the creation of objects prematurely). |
| 62 CORE_EXPORT void installPendingConditionalFeature(const String&, | 54 CORE_EXPORT void installPendingConditionalFeature(const String&, |
| 63 const ScriptState*); | 55 const ScriptState*); |
| 64 | 56 |
| 65 CORE_EXPORT bool isFeatureEnabledInFrame(const FeaturePolicy::Feature&, | |
| 66 const LocalFrame*); | |
| 67 | |
| 68 } // namespace blink | 57 } // namespace blink |
| 69 | 58 |
| 70 #endif // ConditionalFeatures_h | 59 #endif // ConditionalFeatures_h |
| OLD | NEW |