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

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

Issue 2640823004: Allow origin trials to be enabled by script (Closed)
Patch Set: Address comments Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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"
9 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
10 #include "platform/feature_policy/FeaturePolicy.h" 9 #include "platform/feature_policy/FeaturePolicy.h"
10 #include "wtf/text/WTFString.h"
11 #include <v8.h> 11 #include <v8.h>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class LocalFrame;
15 class ScriptState; 16 class ScriptState;
16 class LocalFrame; 17 struct WrapperTypeInfo;
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)
haraken 2017/01/28 02:25:20 Not related to this CL, would you again help me un
chasej 2017/01/30 19:15:56 This method is called in LocalWindowProxy::initial
iclelland 2017/01/30 20:37:39 As I recall, when navigating between documents (no
haraken 2017/01/31 08:19:35 Hmm, I'm a bit confused. When we navigate from on
iclelland 2017/01/31 15:29:17 The original issue that prompted that code was htt
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
45 CORE_EXPORT bool isFeatureEnabledInFrame(const FeaturePolicy::Feature&, 65 CORE_EXPORT bool isFeatureEnabledInFrame(const FeaturePolicy::Feature&,
46 const LocalFrame*); 66 const LocalFrame*);
47 67
48 } // namespace blink 68 } // namespace blink
49 69
50 #endif // ConditionalFeatures_h 70 #endif // ConditionalFeatures_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698