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 #include "bindings/modules/v8/ConditionalFeaturesForModules.h" | 5 #include "bindings/modules/v8/ConditionalFeaturesForModules.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
8 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" | 8 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" |
9 #include "bindings/core/v8/V8Navigator.h" | 9 #include "bindings/core/v8/V8Navigator.h" |
10 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" | 10 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" |
11 #include "bindings/core/v8/V8Window.h" | 11 #include "bindings/core/v8/V8Window.h" |
12 #include "bindings/core/v8/V8WorkerNavigator.h" | 12 #include "bindings/core/v8/V8WorkerNavigator.h" |
13 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h" | 13 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h" |
| 14 #include "bindings/modules/v8/V8FetchEvent.h" |
14 #include "bindings/modules/v8/V8Gamepad.h" | 15 #include "bindings/modules/v8/V8Gamepad.h" |
15 #include "bindings/modules/v8/V8GamepadButton.h" | 16 #include "bindings/modules/v8/V8GamepadButton.h" |
16 #include "bindings/modules/v8/V8InstallEvent.h" | 17 #include "bindings/modules/v8/V8InstallEvent.h" |
17 #include "bindings/modules/v8/V8NavigatorPartial.h" | 18 #include "bindings/modules/v8/V8NavigatorPartial.h" |
18 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" | 19 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" |
| 20 #include "bindings/modules/v8/V8ServiceWorkerRegistration.h" |
19 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" | 21 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" |
20 #include "bindings/modules/v8/V8WindowPartial.h" | 22 #include "bindings/modules/v8/V8WindowPartial.h" |
21 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" | 23 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" |
22 #include "core/dom/ExecutionContext.h" | 24 #include "core/dom/ExecutionContext.h" |
23 #include "core/origin_trials/OriginTrials.h" | 25 #include "core/origin_trials/OriginTrials.h" |
24 | 26 |
25 namespace blink { | 27 namespace blink { |
26 | 28 |
27 namespace { | 29 namespace { |
28 InstallConditionalFeaturesFunction | 30 InstallConditionalFeaturesFunction |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 prototypeObject, interfaceObject); | 72 prototypeObject, interfaceObject); |
71 } | 73 } |
72 if (OriginTrials::webVREnabled(executionContext)) { | 74 if (OriginTrials::webVREnabled(executionContext)) { |
73 V8WindowPartial::installWebVR(isolate, world, instanceObject, | 75 V8WindowPartial::installWebVR(isolate, world, instanceObject, |
74 prototypeObject, interfaceObject); | 76 prototypeObject, interfaceObject); |
75 } | 77 } |
76 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { | 78 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { |
77 V8WindowPartial::installGamepadExtensions( | 79 V8WindowPartial::installGamepadExtensions( |
78 isolate, world, instanceObject, prototypeObject, interfaceObject); | 80 isolate, world, instanceObject, prototypeObject, interfaceObject); |
79 } | 81 } |
| 82 if (OriginTrials::serviceWorkerNavigationPreloadEnabled(executionContext)) { |
| 83 V8WindowPartial::installServiceWorkerNavigationPreload( |
| 84 isolate, world, instanceObject, prototypeObject, interfaceObject); |
| 85 } |
| 86 } else if (wrapperTypeInfo == |
| 87 &V8DedicatedWorkerGlobalScope::wrapperTypeInfo) { |
| 88 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); |
| 89 if (OriginTrials::serviceWorkerNavigationPreloadEnabled(executionContext)) { |
| 90 V8DedicatedWorkerGlobalScopePartial:: |
| 91 installServiceWorkerNavigationPreload( |
| 92 isolate, world, instanceObject, prototypeObject, interfaceObject); |
| 93 } |
| 94 } else if (wrapperTypeInfo == &V8SharedWorkerGlobalScope::wrapperTypeInfo) { |
| 95 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); |
| 96 if (OriginTrials::serviceWorkerNavigationPreloadEnabled(executionContext)) { |
| 97 V8SharedWorkerGlobalScopePartial::installServiceWorkerNavigationPreload( |
| 98 isolate, world, instanceObject, prototypeObject, interfaceObject); |
| 99 } |
80 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { | 100 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { |
81 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); | 101 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); |
82 if (OriginTrials::foreignFetchEnabled(executionContext)) { | 102 if (OriginTrials::foreignFetchEnabled(executionContext)) { |
83 V8ServiceWorkerGlobalScope::installForeignFetch( | 103 V8ServiceWorkerGlobalScope::installForeignFetch( |
84 isolate, world, instanceObject, prototypeObject, interfaceObject); | 104 isolate, world, instanceObject, prototypeObject, interfaceObject); |
85 } | 105 } |
| 106 if (OriginTrials::serviceWorkerNavigationPreloadEnabled(executionContext)) { |
| 107 V8ServiceWorkerGlobalScope::installServiceWorkerNavigationPreload( |
| 108 isolate, world, instanceObject, prototypeObject, interfaceObject); |
| 109 } |
| 110 } else if (wrapperTypeInfo == &V8ServiceWorkerRegistration::wrapperTypeInfo) { |
| 111 if (OriginTrials::serviceWorkerNavigationPreloadEnabled(executionContext)) { |
| 112 V8ServiceWorkerRegistration::installServiceWorkerNavigationPreload( |
| 113 isolate, world, v8::Local<v8::Object>(), prototypeObject, |
| 114 interfaceObject); |
| 115 } |
| 116 } else if (wrapperTypeInfo == &V8FetchEvent::wrapperTypeInfo) { |
| 117 if (OriginTrials::serviceWorkerNavigationPreloadEnabled(executionContext)) { |
| 118 V8FetchEvent::installServiceWorkerNavigationPreload( |
| 119 isolate, world, v8::Local<v8::Object>(), prototypeObject, |
| 120 interfaceObject); |
| 121 } |
86 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) { | 122 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) { |
87 if (OriginTrials::foreignFetchEnabled(executionContext)) { | 123 if (OriginTrials::foreignFetchEnabled(executionContext)) { |
88 V8InstallEvent::installForeignFetch(isolate, world, | 124 V8InstallEvent::installForeignFetch(isolate, world, |
89 v8::Local<v8::Object>(), | 125 v8::Local<v8::Object>(), |
90 prototypeObject, interfaceObject); | 126 prototypeObject, interfaceObject); |
91 } | 127 } |
92 } else if (wrapperTypeInfo == &V8Gamepad::wrapperTypeInfo) { | 128 } else if (wrapperTypeInfo == &V8Gamepad::wrapperTypeInfo) { |
93 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { | 129 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { |
94 V8Gamepad::installGamepadExtensions(isolate, world, | 130 V8Gamepad::installGamepadExtensions(isolate, world, |
95 v8::Local<v8::Object>(), | 131 v8::Local<v8::Object>(), |
96 prototypeObject, interfaceObject); | 132 prototypeObject, interfaceObject); |
97 } | 133 } |
98 } else if (wrapperTypeInfo == &V8GamepadButton::wrapperTypeInfo) { | 134 } else if (wrapperTypeInfo == &V8GamepadButton::wrapperTypeInfo) { |
99 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { | 135 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { |
100 V8GamepadButton::installGamepadExtensions( | 136 V8GamepadButton::installGamepadExtensions( |
101 isolate, world, v8::Local<v8::Object>(), prototypeObject, | 137 isolate, world, v8::Local<v8::Object>(), prototypeObject, |
102 interfaceObject); | 138 interfaceObject); |
103 } | 139 } |
104 } | 140 } |
105 } | 141 } |
106 | 142 |
107 void registerInstallConditionalFeaturesForModules() { | 143 void registerInstallConditionalFeaturesForModules() { |
108 s_originalInstallConditionalFeaturesFunction = | 144 s_originalInstallConditionalFeaturesFunction = |
109 setInstallConditionalFeaturesFunction( | 145 setInstallConditionalFeaturesFunction( |
110 &installConditionalFeaturesForModules); | 146 &installConditionalFeaturesForModules); |
111 } | 147 } |
112 | 148 |
113 } // namespace blink | 149 } // namespace blink |
OLD | NEW |