| 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/ConditionalFeatures.h" | 7 #include "bindings/core/v8/ConditionalFeatures.h" |
| 8 #include "bindings/core/v8/ConditionalFeaturesForCore.h" | 8 #include "bindings/core/v8/ConditionalFeaturesForCore.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" | 10 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" |
| 11 #include "bindings/core/v8/V8Navigator.h" | 11 #include "bindings/core/v8/V8Navigator.h" |
| 12 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" | 12 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" |
| 13 #include "bindings/core/v8/V8Window.h" | 13 #include "bindings/core/v8/V8Window.h" |
| 14 #include "bindings/core/v8/V8WorkerNavigator.h" | 14 #include "bindings/core/v8/V8WorkerNavigator.h" |
| 15 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h" | 15 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h" |
| 16 #include "bindings/modules/v8/V8FetchEvent.h" | |
| 17 #include "bindings/modules/v8/V8Gamepad.h" | 16 #include "bindings/modules/v8/V8Gamepad.h" |
| 18 #include "bindings/modules/v8/V8GamepadButton.h" | 17 #include "bindings/modules/v8/V8GamepadButton.h" |
| 19 #include "bindings/modules/v8/V8InstallEvent.h" | 18 #include "bindings/modules/v8/V8InstallEvent.h" |
| 20 #include "bindings/modules/v8/V8NavigatorPartial.h" | 19 #include "bindings/modules/v8/V8NavigatorPartial.h" |
| 21 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" | 20 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" |
| 22 #include "bindings/modules/v8/V8ServiceWorkerRegistration.h" | |
| 23 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" | 21 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" |
| 24 #include "bindings/modules/v8/V8WindowPartial.h" | 22 #include "bindings/modules/v8/V8WindowPartial.h" |
| 25 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" | 23 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" |
| 26 #include "core/dom/ExecutionContext.h" | 24 #include "core/dom/ExecutionContext.h" |
| 27 #include "core/origin_trials/OriginTrials.h" | 25 #include "core/origin_trials/OriginTrials.h" |
| 28 | 26 |
| 29 namespace blink { | 27 namespace blink { |
| 30 | 28 |
| 31 namespace { | 29 namespace { |
| 32 InstallConditionalFeaturesFunction | 30 InstallConditionalFeaturesFunction |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 prototype_object, interface_object); | 85 prototype_object, interface_object); |
| 88 } | 86 } |
| 89 if (OriginTrials::webVREnabled(execution_context)) { | 87 if (OriginTrials::webVREnabled(execution_context)) { |
| 90 V8WindowPartial::installWebVR(isolate, world, instance_object, | 88 V8WindowPartial::installWebVR(isolate, world, instance_object, |
| 91 prototype_object, interface_object); | 89 prototype_object, interface_object); |
| 92 } | 90 } |
| 93 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) { | 91 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) { |
| 94 V8WindowPartial::installGamepadExtensions( | 92 V8WindowPartial::installGamepadExtensions( |
| 95 isolate, world, instance_object, prototype_object, interface_object); | 93 isolate, world, instance_object, prototype_object, interface_object); |
| 96 } | 94 } |
| 97 if (OriginTrials::serviceWorkerNavigationPreloadEnabled( | |
| 98 execution_context)) { | |
| 99 V8WindowPartial::installServiceWorkerNavigationPreload( | |
| 100 isolate, world, instance_object, prototype_object, interface_object); | |
| 101 } | |
| 102 } else if (wrapper_type_info == | |
| 103 &V8DedicatedWorkerGlobalScope::wrapperTypeInfo) { | |
| 104 v8::Local<v8::Object> instance_object = | |
| 105 script_state->GetContext()->Global(); | |
| 106 if (OriginTrials::serviceWorkerNavigationPreloadEnabled( | |
| 107 execution_context)) { | |
| 108 V8DedicatedWorkerGlobalScopePartial:: | |
| 109 installServiceWorkerNavigationPreload(isolate, world, instance_object, | |
| 110 prototype_object, | |
| 111 interface_object); | |
| 112 } | |
| 113 } else if (wrapper_type_info == &V8SharedWorkerGlobalScope::wrapperTypeInfo) { | |
| 114 v8::Local<v8::Object> instance_object = | |
| 115 script_state->GetContext()->Global(); | |
| 116 if (OriginTrials::serviceWorkerNavigationPreloadEnabled( | |
| 117 execution_context)) { | |
| 118 V8SharedWorkerGlobalScopePartial::installServiceWorkerNavigationPreload( | |
| 119 isolate, world, instance_object, prototype_object, interface_object); | |
| 120 } | |
| 121 } else if (wrapper_type_info == | 95 } else if (wrapper_type_info == |
| 122 &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { | 96 &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { |
| 123 v8::Local<v8::Object> instance_object = | 97 v8::Local<v8::Object> instance_object = |
| 124 script_state->GetContext()->Global(); | 98 script_state->GetContext()->Global(); |
| 125 if (OriginTrials::foreignFetchEnabled(execution_context)) { | 99 if (OriginTrials::foreignFetchEnabled(execution_context)) { |
| 126 V8ServiceWorkerGlobalScope::installForeignFetch( | 100 V8ServiceWorkerGlobalScope::installForeignFetch( |
| 127 isolate, world, instance_object, prototype_object, interface_object); | 101 isolate, world, instance_object, prototype_object, interface_object); |
| 128 } | 102 } |
| 129 if (OriginTrials::serviceWorkerNavigationPreloadEnabled( | |
| 130 execution_context)) { | |
| 131 V8ServiceWorkerGlobalScope::installServiceWorkerNavigationPreload( | |
| 132 isolate, world, instance_object, prototype_object, interface_object); | |
| 133 } | |
| 134 } else if (wrapper_type_info == | |
| 135 &V8ServiceWorkerRegistration::wrapperTypeInfo) { | |
| 136 if (OriginTrials::serviceWorkerNavigationPreloadEnabled( | |
| 137 execution_context)) { | |
| 138 V8ServiceWorkerRegistration::installServiceWorkerNavigationPreload( | |
| 139 isolate, world, v8::Local<v8::Object>(), prototype_object, | |
| 140 interface_object); | |
| 141 } | |
| 142 } else if (wrapper_type_info == &V8FetchEvent::wrapperTypeInfo) { | |
| 143 if (OriginTrials::serviceWorkerNavigationPreloadEnabled( | |
| 144 execution_context)) { | |
| 145 V8FetchEvent::installServiceWorkerNavigationPreload( | |
| 146 isolate, world, v8::Local<v8::Object>(), prototype_object, | |
| 147 interface_object); | |
| 148 } | |
| 149 } else if (wrapper_type_info == &V8InstallEvent::wrapperTypeInfo) { | 103 } else if (wrapper_type_info == &V8InstallEvent::wrapperTypeInfo) { |
| 150 if (OriginTrials::foreignFetchEnabled(execution_context)) { | 104 if (OriginTrials::foreignFetchEnabled(execution_context)) { |
| 151 V8InstallEvent::installForeignFetch(isolate, world, | 105 V8InstallEvent::installForeignFetch(isolate, world, |
| 152 v8::Local<v8::Object>(), | 106 v8::Local<v8::Object>(), |
| 153 prototype_object, interface_object); | 107 prototype_object, interface_object); |
| 154 } | 108 } |
| 155 } else if (wrapper_type_info == &V8Gamepad::wrapperTypeInfo) { | 109 } else if (wrapper_type_info == &V8Gamepad::wrapperTypeInfo) { |
| 156 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) { | 110 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) { |
| 157 V8Gamepad::installGamepadExtensions(isolate, world, | 111 V8Gamepad::installGamepadExtensions(isolate, world, |
| 158 v8::Local<v8::Object>(), | 112 v8::Local<v8::Object>(), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (feature == "InstalledApp") { | 148 if (feature == "InstalledApp") { |
| 195 if (context_data->GetExistingConstructorAndPrototypeForType( | 149 if (context_data->GetExistingConstructorAndPrototypeForType( |
| 196 &V8Navigator::wrapperTypeInfo, &prototype_object, | 150 &V8Navigator::wrapperTypeInfo, &prototype_object, |
| 197 &interface_object)) { | 151 &interface_object)) { |
| 198 V8NavigatorPartial::installInstalledApp( | 152 V8NavigatorPartial::installInstalledApp( |
| 199 isolate, world, v8::Local<v8::Object>(), prototype_object, | 153 isolate, world, v8::Local<v8::Object>(), prototype_object, |
| 200 interface_object); | 154 interface_object); |
| 201 } | 155 } |
| 202 return; | 156 return; |
| 203 } | 157 } |
| 204 if (feature == "ServiceWorkerNavigationPreload") { | |
| 205 global_instance_object = script_state->GetContext()->Global(); | |
| 206 V8WindowPartial::installServiceWorkerNavigationPreload( | |
| 207 isolate, world, global_instance_object, v8::Local<v8::Object>(), | |
| 208 v8::Local<v8::Function>()); | |
| 209 if (context_data->GetExistingConstructorAndPrototypeForType( | |
| 210 &V8FetchEvent::wrapperTypeInfo, &prototype_object, | |
| 211 &interface_object)) { | |
| 212 V8FetchEvent::installServiceWorkerNavigationPreload( | |
| 213 isolate, world, v8::Local<v8::Object>(), prototype_object, | |
| 214 interface_object); | |
| 215 } | |
| 216 if (context_data->GetExistingConstructorAndPrototypeForType( | |
| 217 &V8ServiceWorkerRegistration::wrapperTypeInfo, &prototype_object, | |
| 218 &interface_object)) { | |
| 219 V8ServiceWorkerRegistration::installServiceWorkerNavigationPreload( | |
| 220 isolate, world, v8::Local<v8::Object>(), prototype_object, | |
| 221 interface_object); | |
| 222 } | |
| 223 return; | |
| 224 } | |
| 225 if (feature == "WebShare") { | 158 if (feature == "WebShare") { |
| 226 if (context_data->GetExistingConstructorAndPrototypeForType( | 159 if (context_data->GetExistingConstructorAndPrototypeForType( |
| 227 &V8Navigator::wrapperTypeInfo, &prototype_object, | 160 &V8Navigator::wrapperTypeInfo, &prototype_object, |
| 228 &interface_object)) { | 161 &interface_object)) { |
| 229 V8NavigatorPartial::installWebShare(isolate, world, | 162 V8NavigatorPartial::installWebShare(isolate, world, |
| 230 v8::Local<v8::Object>(), | 163 v8::Local<v8::Object>(), |
| 231 prototype_object, interface_object); | 164 prototype_object, interface_object); |
| 232 } | 165 } |
| 233 return; | 166 return; |
| 234 } | 167 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 RegisterInstallConditionalFeaturesForCore(); | 214 RegisterInstallConditionalFeaturesForCore(); |
| 282 g_original_install_conditional_features_function = | 215 g_original_install_conditional_features_function = |
| 283 SetInstallConditionalFeaturesFunction( | 216 SetInstallConditionalFeaturesFunction( |
| 284 &InstallConditionalFeaturesForModules); | 217 &InstallConditionalFeaturesForModules); |
| 285 g_original_install_pending_conditional_feature_function = | 218 g_original_install_pending_conditional_feature_function = |
| 286 SetInstallPendingConditionalFeatureFunction( | 219 SetInstallPendingConditionalFeatureFunction( |
| 287 &InstallPendingConditionalFeatureForModules); | 220 &InstallPendingConditionalFeatureForModules); |
| 288 } | 221 } |
| 289 | 222 |
| 290 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |