| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 ExecutionContext* executionContext = scriptState->getExecutionContext(); | 43 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 44 if (!executionContext) | 44 if (!executionContext) |
| 45 return; | 45 return; |
| 46 OriginTrialContext* originTrialContext = OriginTrialContext::from( | 46 OriginTrialContext* originTrialContext = OriginTrialContext::from( |
| 47 executionContext, OriginTrialContext::DontCreateIfNotExists); | 47 executionContext, OriginTrialContext::DontCreateIfNotExists); |
| 48 v8::Isolate* isolate = scriptState->isolate(); | 48 v8::Isolate* isolate = scriptState->isolate(); |
| 49 const DOMWrapperWorld& world = scriptState->world(); | 49 const DOMWrapperWorld& world = scriptState->world(); |
| 50 v8::Local<v8::Object> global = scriptState->context()->Global(); | 50 v8::Local<v8::Object> global = scriptState->context()->Global(); |
| 51 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { | 51 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { |
| 52 if (RuntimeEnabledFeatures::webBluetoothEnabled() || | |
| 53 (originTrialContext && | |
| 54 originTrialContext->isTrialEnabled("WebBluetooth"))) { | |
| 55 V8NavigatorPartial::installWebBluetooth(isolate, world, | |
| 56 v8::Local<v8::Object>(), | |
| 57 prototypeObject, interfaceObject); | |
| 58 } | |
| 59 if (RuntimeEnabledFeatures::webShareEnabled() || | 52 if (RuntimeEnabledFeatures::webShareEnabled() || |
| 60 (originTrialContext && | 53 (originTrialContext && |
| 61 originTrialContext->isTrialEnabled("WebShare"))) { | 54 originTrialContext->isTrialEnabled("WebShare"))) { |
| 62 V8NavigatorPartial::installWebShare(isolate, world, | 55 V8NavigatorPartial::installWebShare(isolate, world, |
| 63 v8::Local<v8::Object>(), | 56 v8::Local<v8::Object>(), |
| 64 prototypeObject, interfaceObject); | 57 prototypeObject, interfaceObject); |
| 65 } | 58 } |
| 66 if (RuntimeEnabledFeatures::webUSBEnabled() || | 59 if (RuntimeEnabledFeatures::webUSBEnabled() || |
| 67 (originTrialContext && originTrialContext->isTrialEnabled("WebUSB"))) { | 60 (originTrialContext && originTrialContext->isTrialEnabled("WebUSB"))) { |
| 68 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), | 61 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), |
| 69 prototypeObject, interfaceObject); | 62 prototypeObject, interfaceObject); |
| 70 } | 63 } |
| 71 if (RuntimeEnabledFeatures::webVREnabled() || | 64 if (RuntimeEnabledFeatures::webVREnabled() || |
| 72 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) { | 65 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) { |
| 73 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject, | 66 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject, |
| 74 interfaceObject); | 67 interfaceObject); |
| 75 } | 68 } |
| 76 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { | 69 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { |
| 77 if (RuntimeEnabledFeatures::webBluetoothEnabled() || | |
| 78 (originTrialContext && | |
| 79 originTrialContext->isTrialEnabled("WebBluetooth"))) { | |
| 80 V8WindowPartial::installWebBluetooth(isolate, world, global, | |
| 81 prototypeObject, interfaceObject); | |
| 82 } | |
| 83 if (RuntimeEnabledFeatures::webUSBEnabled() || | 70 if (RuntimeEnabledFeatures::webUSBEnabled() || |
| 84 (originTrialContext && originTrialContext->isTrialEnabled("WebUSB"))) { | 71 (originTrialContext && originTrialContext->isTrialEnabled("WebUSB"))) { |
| 85 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, | 72 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, |
| 86 interfaceObject); | 73 interfaceObject); |
| 87 } | 74 } |
| 88 if (RuntimeEnabledFeatures::webVREnabled() || | 75 if (RuntimeEnabledFeatures::webVREnabled() || |
| 89 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) { | 76 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) { |
| 90 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject, | 77 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject, |
| 91 interfaceObject); | 78 interfaceObject); |
| 92 } | 79 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 112 } |
| 126 } | 113 } |
| 127 | 114 |
| 128 void registerInstallConditionalFeaturesForModules() { | 115 void registerInstallConditionalFeaturesForModules() { |
| 129 s_originalInstallConditionalFeaturesFunction = | 116 s_originalInstallConditionalFeaturesFunction = |
| 130 setInstallConditionalFeaturesFunction( | 117 setInstallConditionalFeaturesFunction( |
| 131 &installConditionalFeaturesForModules); | 118 &installConditionalFeaturesForModules); |
| 132 } | 119 } |
| 133 | 120 |
| 134 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |