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 "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 "platform/feature_policy/FeaturePolicy.h" |
| 11 #include "wtf/HashSet.h" | |
|
iclelland
2017/01/26 20:14:11
Unneeded here?
chasej
2017/01/27 17:22:36
Yes, removed.
| |
| 11 #include <v8.h> | 12 #include <v8.h> |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class ScriptState; | 16 class ScriptState; |
| 16 class LocalFrame; | 17 class LocalFrame; |
| 17 | 18 |
| 18 using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*, | 19 using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*, |
| 19 const ScriptState*, | 20 const ScriptState*, |
| 20 v8::Local<v8::Object>, | 21 v8::Local<v8::Object>, |
| 21 v8::Local<v8::Function>); | 22 v8::Local<v8::Function>); |
| 22 | 23 |
| 24 using InstallPendingConditionalFeatureFunction = void (*)(const String&, | |
| 25 const ScriptState*); | |
| 26 | |
| 27 // Sets the function to be called by |installConditionalFeatures|. The function | |
| 28 // is initially set to the private |installConditionalFeaturesCore| function, | |
| 29 // but can be overridden by this function. A pointer to the previously set | |
| 30 // function is returned, so that functions can be chained. | |
| 31 CORE_EXPORT InstallConditionalFeaturesFunction | |
| 32 setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction); | |
| 33 | |
| 34 // Sets the function to be called by |installPendingConditionalFeature|. This | |
| 35 // Initially set to the private |installPendingConditionalFeatureCore| function, | |
| 36 // but can be overridden by this function. A pointer to the previously set | |
| 37 // function is returned, so that functions can be chained. | |
| 38 CORE_EXPORT InstallPendingConditionalFeatureFunction | |
| 39 setInstallPendingConditionalFeatureFunction( | |
| 40 InstallPendingConditionalFeatureFunction); | |
| 41 | |
| 23 // Installs all of the conditionally enabled V8 bindings for the given type, in | 42 // Installs all of the conditionally enabled V8 bindings for the given type, in |
| 24 // a specific context. This is called in V8PerContextData, after the constructor | 43 // a specific context. This is called in V8PerContextData, after the constructor |
| 25 // and prototype for the type have been created. It indirectly calls the | 44 // and prototype for the type have been created. It indirectly calls the |
| 26 // function set by |setInstallConditionalFeaturesFunction|. | 45 // function set by |setInstallConditionalFeaturesFunction|. |
| 27 CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*, | 46 CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*, |
| 28 const ScriptState*, | 47 const ScriptState*, |
| 29 v8::Local<v8::Object>, | 48 v8::Local<v8::Object>, |
| 30 v8::Local<v8::Function>); | 49 v8::Local<v8::Function>); |
| 31 | 50 |
| 32 // Sets the function to be called by |installConditionalFeatures|. The function | |
| 33 // is initially set to the private |installConditionalFeaturesCore| function, | |
| 34 // but can be overridden by this function. A pointer to the previously set | |
| 35 // function is returned, so that functions can be chained. | |
| 36 CORE_EXPORT InstallConditionalFeaturesFunction | |
| 37 setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction); | |
| 38 | |
| 39 // Installs all of the conditionally enabled V8 bindings on the Window object. | 51 // Installs all of the conditionally enabled V8 bindings on the Window object. |
| 40 // This is called separately from other objects so that attributes and | 52 // This is called separately from other objects so that attributes and |
| 41 // interfaces which need to be visible on the global object are installed even | 53 // interfaces which need to be visible on the global object are installed even |
| 42 // when the V8 context is reused (i.e., after navigation) | 54 // when the V8 context is reused (i.e., after navigation) |
| 43 CORE_EXPORT void installPendingConditionalFeaturesOnWindow(const ScriptState*); | 55 CORE_EXPORT void installPendingConditionalFeaturesOnWindow(const ScriptState*); |
| 44 | 56 |
| 57 // 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 | |
| 59 // 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 | |
| 61 // (avoids forcing the creation of objects prematurely). | |
| 62 CORE_EXPORT void installPendingConditionalFeature(const String&, | |
| 63 const ScriptState*); | |
| 64 | |
| 65 // Gets the constructor and prototype for a type, if they have already been | |
| 66 // created. Returns true if they exist, and sets the existing values in | |
| 67 // |prototypeObject| and |interfaceObject|. Otherwise, returns false, and the | |
| 68 // values are set to empty objects (non-null). | |
| 69 CORE_EXPORT bool getExistingConstructorAndPrototypeForType( | |
|
iclelland
2017/01/26 20:14:11
Should this be in ConditionalFeatures, or is it mo
chasej
2017/01/27 17:22:36
Moved to V8PerContextData, as the method is also c
| |
| 70 const WrapperTypeInfo*, | |
| 71 const ScriptState*, | |
| 72 v8::Local<v8::Object>* prototypeObject, | |
| 73 v8::Local<v8::Function>* interfaceObject); | |
| 74 | |
| 45 CORE_EXPORT bool isFeatureEnabledInFrame(const FeaturePolicy::Feature&, | 75 CORE_EXPORT bool isFeatureEnabledInFrame(const FeaturePolicy::Feature&, |
| 46 const LocalFrame*); | 76 const LocalFrame*); |
| 47 | 77 |
| 48 } // namespace blink | 78 } // namespace blink |
| 49 | 79 |
| 50 #endif // ConditionalFeatures_h | 80 #endif // ConditionalFeatures_h |
| OLD | NEW |