| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 (*s_originalInstallConditionalFeaturesFunction)( | 40 (*s_originalInstallConditionalFeaturesFunction)( |
| 41 wrapperTypeInfo, scriptState, prototypeObject, interfaceObject); | 41 wrapperTypeInfo, scriptState, prototypeObject, interfaceObject); |
| 42 | 42 |
| 43 ExecutionContext* executionContext = scriptState->getExecutionContext(); | 43 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 44 if (!executionContext) | 44 if (!executionContext) |
| 45 return; | 45 return; |
| 46 v8::Isolate* isolate = scriptState->isolate(); | 46 v8::Isolate* isolate = scriptState->isolate(); |
| 47 const DOMWrapperWorld& world = scriptState->world(); | 47 const DOMWrapperWorld& world = scriptState->world(); |
| 48 v8::Local<v8::Object> global = scriptState->context()->Global(); | 48 v8::Local<v8::Object> global = scriptState->context()->Global(); |
| 49 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { | 49 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { |
| 50 if (OriginTrials::webBluetoothEnabled(executionContext)) { | |
| 51 V8NavigatorPartial::installWebBluetooth(isolate, world, | |
| 52 v8::Local<v8::Object>(), | |
| 53 prototypeObject, interfaceObject); | |
| 54 } | |
| 55 if (OriginTrials::webShareEnabled(executionContext)) { | 50 if (OriginTrials::webShareEnabled(executionContext)) { |
| 56 V8NavigatorPartial::installWebShare(isolate, world, | 51 V8NavigatorPartial::installWebShare(isolate, world, |
| 57 v8::Local<v8::Object>(), | 52 v8::Local<v8::Object>(), |
| 58 prototypeObject, interfaceObject); | 53 prototypeObject, interfaceObject); |
| 59 } | 54 } |
| 60 if (OriginTrials::webUSBEnabled(executionContext)) { | 55 if (OriginTrials::webUSBEnabled(executionContext)) { |
| 61 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), | 56 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), |
| 62 prototypeObject, interfaceObject); | 57 prototypeObject, interfaceObject); |
| 63 } | 58 } |
| 64 if (OriginTrials::webVREnabled(executionContext)) { | 59 if (OriginTrials::webVREnabled(executionContext)) { |
| 65 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject, | 60 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject, |
| 66 interfaceObject); | 61 interfaceObject); |
| 67 } | 62 } |
| 68 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { | 63 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { |
| 69 if (OriginTrials::webBluetoothEnabled(executionContext)) { | |
| 70 V8WindowPartial::installWebBluetooth(isolate, world, global, | |
| 71 prototypeObject, interfaceObject); | |
| 72 } | |
| 73 if (OriginTrials::webUSBEnabled(executionContext)) { | 64 if (OriginTrials::webUSBEnabled(executionContext)) { |
| 74 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, | 65 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, |
| 75 interfaceObject); | 66 interfaceObject); |
| 76 } | 67 } |
| 77 if (OriginTrials::webVREnabled(executionContext)) { | 68 if (OriginTrials::webVREnabled(executionContext)) { |
| 78 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject, | 69 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject, |
| 79 interfaceObject); | 70 interfaceObject); |
| 80 } | 71 } |
| 81 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { | 72 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { |
| 82 V8WindowPartial::installGamepadExtensions( | 73 V8WindowPartial::installGamepadExtensions( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 106 } | 97 } |
| 107 } | 98 } |
| 108 | 99 |
| 109 void registerInstallConditionalFeaturesForModules() { | 100 void registerInstallConditionalFeaturesForModules() { |
| 110 s_originalInstallConditionalFeaturesFunction = | 101 s_originalInstallConditionalFeaturesFunction = |
| 111 setInstallConditionalFeaturesFunction( | 102 setInstallConditionalFeaturesFunction( |
| 112 &installConditionalFeaturesForModules); | 103 &installConditionalFeaturesForModules); |
| 113 } | 104 } |
| 114 | 105 |
| 115 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |