Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h

Issue 2640823004: Allow origin trials to be enabled by script (Closed)
Patch Set: Address nit Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h
index 0c9a6040f5926955d921af4e7dd5f5d96e57caba..10dc7a0cb4c89e7c63546beb1687885e339f0f91 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.h
@@ -5,21 +5,40 @@
#ifndef ConditionalFeatures_h
#define ConditionalFeatures_h
-#include "bindings/core/v8/DOMWrapperWorld.h"
#include "core/CoreExport.h"
#include "platform/feature_policy/FeaturePolicy.h"
+#include "wtf/text/WTFString.h"
#include <v8.h>
namespace blink {
-class ScriptState;
class LocalFrame;
+class ScriptState;
+struct WrapperTypeInfo;
using InstallConditionalFeaturesFunction = void (*)(const WrapperTypeInfo*,
const ScriptState*,
v8::Local<v8::Object>,
v8::Local<v8::Function>);
+using InstallPendingConditionalFeatureFunction = void (*)(const String&,
+ const ScriptState*);
+
+// Sets the function to be called by |installConditionalFeatures|. The function
+// is initially set to the private |installConditionalFeaturesCore| function,
+// but can be overridden by this function. A pointer to the previously set
+// function is returned, so that functions can be chained.
+CORE_EXPORT InstallConditionalFeaturesFunction
+ setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction);
+
+// Sets the function to be called by |installPendingConditionalFeature|. This
+// Initially set to the private |installPendingConditionalFeatureCore| function,
+// but can be overridden by this function. A pointer to the previously set
+// function is returned, so that functions can be chained.
+CORE_EXPORT InstallPendingConditionalFeatureFunction
+ setInstallPendingConditionalFeatureFunction(
+ InstallPendingConditionalFeatureFunction);
+
// Installs all of the conditionally enabled V8 bindings for the given type, in
// a specific context. This is called in V8PerContextData, after the constructor
// and prototype for the type have been created. It indirectly calls the
@@ -29,18 +48,19 @@ CORE_EXPORT void installConditionalFeatures(const WrapperTypeInfo*,
v8::Local<v8::Object>,
v8::Local<v8::Function>);
-// Sets the function to be called by |installConditionalFeatures|. The function
-// is initially set to the private |installConditionalFeaturesCore| function,
-// but can be overridden by this function. A pointer to the previously set
-// function is returned, so that functions can be chained.
-CORE_EXPORT InstallConditionalFeaturesFunction
- setInstallConditionalFeaturesFunction(InstallConditionalFeaturesFunction);
-
// Installs all of the conditionally enabled V8 bindings on the Window object.
// This is called separately from other objects so that attributes and
// interfaces which need to be visible on the global object are installed even
// when the V8 context is reused (i.e., after navigation)
-CORE_EXPORT void installPendingConditionalFeaturesOnWindow(const ScriptState*);
+CORE_EXPORT void installConditionalFeaturesOnWindow(const ScriptState*);
+
+// Installs all of the conditionally enabled V8 bindings for a feature, if
+// needed. This is called to install a newly-enabled feature on any existing
+// objects. If the target object hasn't been created, nothing is installed. The
+// enabled feature will be instead be installed when the object is created
+// (avoids forcing the creation of objects prematurely).
+CORE_EXPORT void installPendingConditionalFeature(const String&,
+ const ScriptState*);
CORE_EXPORT bool isFeatureEnabledInFrame(const FeaturePolicy::Feature&,
const LocalFrame*);

Powered by Google App Engine
This is Rietveld 408576698