| 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/V8Gamepad.h" |
| 15 #include "bindings/modules/v8/V8GamepadButton.h" |
| 14 #include "bindings/modules/v8/V8InstallEvent.h" | 16 #include "bindings/modules/v8/V8InstallEvent.h" |
| 15 #include "bindings/modules/v8/V8NavigatorPartial.h" | 17 #include "bindings/modules/v8/V8NavigatorPartial.h" |
| 16 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" | 18 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" |
| 17 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" | 19 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" |
| 18 #include "bindings/modules/v8/V8WindowPartial.h" | 20 #include "bindings/modules/v8/V8WindowPartial.h" |
| 19 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" | 21 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" |
| 20 #include "core/dom/ExecutionContext.h" | 22 #include "core/dom/ExecutionContext.h" |
| 21 #include "core/origin_trials/OriginTrialContext.h" | 23 #include "core/origin_trials/OriginTrialContext.h" |
| 22 | 24 |
| 23 namespace blink { | 25 namespace blink { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 V8NavigatorPartial::installWebShare(isolate, world, | 62 V8NavigatorPartial::installWebShare(isolate, world, |
| 61 v8::Local<v8::Object>(), | 63 v8::Local<v8::Object>(), |
| 62 prototypeObject, interfaceObject); | 64 prototypeObject, interfaceObject); |
| 63 } | 65 } |
| 64 if (RuntimeEnabledFeatures::webUSBEnabled() || | 66 if (RuntimeEnabledFeatures::webUSBEnabled() || |
| 65 (originTrialContext && | 67 (originTrialContext && |
| 66 originTrialContext->isFeatureEnabled("WebUSB"))) { | 68 originTrialContext->isFeatureEnabled("WebUSB"))) { |
| 67 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), | 69 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), |
| 68 prototypeObject, interfaceObject); | 70 prototypeObject, interfaceObject); |
| 69 } | 71 } |
| 72 if (RuntimeEnabledFeatures::webVREnabled() || |
| 73 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { |
| 74 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject, |
| 75 interfaceObject); |
| 76 } |
| 70 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { | 77 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { |
| 71 if (RuntimeEnabledFeatures::webBluetoothEnabled() || | 78 if (RuntimeEnabledFeatures::webBluetoothEnabled() || |
| 72 (originTrialContext && | 79 (originTrialContext && |
| 73 originTrialContext->isFeatureEnabled("WebBluetooth"))) { | 80 originTrialContext->isFeatureEnabled("WebBluetooth"))) { |
| 74 V8WindowPartial::installWebBluetooth(isolate, world, global, | 81 V8WindowPartial::installWebBluetooth(isolate, world, global, |
| 75 prototypeObject, interfaceObject); | 82 prototypeObject, interfaceObject); |
| 76 } | 83 } |
| 77 if (RuntimeEnabledFeatures::webUSBEnabled() || | 84 if (RuntimeEnabledFeatures::webUSBEnabled() || |
| 78 (originTrialContext && | 85 (originTrialContext && |
| 79 originTrialContext->isFeatureEnabled("WebUSB"))) { | 86 originTrialContext->isFeatureEnabled("WebUSB"))) { |
| 80 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, | 87 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, |
| 81 interfaceObject); | 88 interfaceObject); |
| 82 } | 89 } |
| 90 if (RuntimeEnabledFeatures::webVREnabled() || |
| 91 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { |
| 92 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject, |
| 93 interfaceObject); |
| 94 } |
| 95 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() || |
| 96 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { |
| 97 V8WindowPartial::installGamepadExtensions( |
| 98 isolate, world, global, prototypeObject, interfaceObject); |
| 99 } |
| 83 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { | 100 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { |
| 84 if (RuntimeEnabledFeatures::foreignFetchEnabled() || | 101 if (RuntimeEnabledFeatures::foreignFetchEnabled() || |
| 85 (originTrialContext && | 102 (originTrialContext && |
| 86 originTrialContext->isFeatureEnabled("ForeignFetch"))) { | 103 originTrialContext->isFeatureEnabled("ForeignFetch"))) { |
| 87 V8ServiceWorkerGlobalScope::installForeignFetch( | 104 V8ServiceWorkerGlobalScope::installForeignFetch( |
| 88 isolate, world, global, prototypeObject, interfaceObject); | 105 isolate, world, global, prototypeObject, interfaceObject); |
| 89 } | 106 } |
| 90 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) { | 107 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) { |
| 91 if (RuntimeEnabledFeatures::foreignFetchEnabled() || | 108 if (RuntimeEnabledFeatures::foreignFetchEnabled() || |
| 92 (originTrialContext && | 109 (originTrialContext && |
| 93 originTrialContext->isFeatureEnabled("ForeignFetch"))) { | 110 originTrialContext->isFeatureEnabled("ForeignFetch"))) { |
| 94 V8InstallEvent::installForeignFetch(isolate, world, | 111 V8InstallEvent::installForeignFetch(isolate, world, |
| 95 v8::Local<v8::Object>(), | 112 v8::Local<v8::Object>(), |
| 96 prototypeObject, interfaceObject); | 113 prototypeObject, interfaceObject); |
| 97 } | 114 } |
| 115 } else if (wrapperTypeInfo == &V8Gamepad::wrapperTypeInfo) { |
| 116 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() || |
| 117 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { |
| 118 V8Gamepad::installGamepadExtensions(isolate, world, global, |
| 119 prototypeObject, interfaceObject); |
| 120 } |
| 121 } else if (wrapperTypeInfo == &V8GamepadButton::wrapperTypeInfo) { |
| 122 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() || |
| 123 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { |
| 124 V8GamepadButton::installGamepadExtensions( |
| 125 isolate, world, global, prototypeObject, interfaceObject); |
| 126 } |
| 98 } | 127 } |
| 99 } | 128 } |
| 100 | 129 |
| 101 void registerInstallConditionalFeaturesForModules() { | 130 void registerInstallConditionalFeaturesForModules() { |
| 102 s_originalInstallConditionalFeaturesFunction = | 131 s_originalInstallConditionalFeaturesFunction = |
| 103 setInstallConditionalFeaturesFunction( | 132 setInstallConditionalFeaturesFunction( |
| 104 &installConditionalFeaturesForModules); | 133 &installConditionalFeaturesForModules); |
| 105 } | 134 } |
| 106 | 135 |
| 107 } // namespace blink | 136 } // namespace blink |
| OLD | NEW |