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/V8BudgetService.h" |
15 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h" | 16 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h" |
16 #include "bindings/modules/v8/V8Gamepad.h" | 17 #include "bindings/modules/v8/V8Gamepad.h" |
17 #include "bindings/modules/v8/V8GamepadButton.h" | 18 #include "bindings/modules/v8/V8GamepadButton.h" |
18 #include "bindings/modules/v8/V8InstallEvent.h" | 19 #include "bindings/modules/v8/V8InstallEvent.h" |
19 #include "bindings/modules/v8/V8NavigatorPartial.h" | 20 #include "bindings/modules/v8/V8NavigatorPartial.h" |
20 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" | 21 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" |
21 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" | 22 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" |
22 #include "bindings/modules/v8/V8WindowPartial.h" | 23 #include "bindings/modules/v8/V8WindowPartial.h" |
23 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" | 24 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" |
24 #include "core/dom/ExecutionContext.h" | 25 #include "core/dom/ExecutionContext.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // https://crbug.com/695123. | 68 // https://crbug.com/695123. |
68 if (OriginTrials::webUSBEnabled(execution_context) && | 69 if (OriginTrials::webUSBEnabled(execution_context) && |
69 execution_context->IsSecureContext()) { | 70 execution_context->IsSecureContext()) { |
70 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), | 71 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), |
71 prototype_object, interface_object); | 72 prototype_object, interface_object); |
72 } | 73 } |
73 if (OriginTrials::webVREnabled(execution_context)) { | 74 if (OriginTrials::webVREnabled(execution_context)) { |
74 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), | 75 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), |
75 prototype_object, interface_object); | 76 prototype_object, interface_object); |
76 } | 77 } |
| 78 } else if (wrapper_type_info == &V8BudgetService::wrapperTypeInfo) { |
| 79 if (OriginTrials::budgetQueryEnabled(execution_context)) { |
| 80 V8BudgetService::installBudgetQuery(isolate, world, |
| 81 v8::Local<v8::Object>(), |
| 82 prototype_object, interface_object); |
| 83 } |
77 } else if (wrapper_type_info == &V8Window::wrapperTypeInfo) { | 84 } else if (wrapper_type_info == &V8Window::wrapperTypeInfo) { |
78 v8::Local<v8::Object> instance_object = | 85 v8::Local<v8::Object> instance_object = |
79 script_state->GetContext()->Global(); | 86 script_state->GetContext()->Global(); |
80 // Mimics the [SecureContext] extended attribute. Work-around for | 87 // Mimics the [SecureContext] extended attribute. Work-around for |
81 // https://crbug.com/695123. | 88 // https://crbug.com/695123. |
82 if (OriginTrials::webUSBEnabled(execution_context) && | 89 if (OriginTrials::webUSBEnabled(execution_context) && |
83 execution_context->IsSecureContext()) { | 90 execution_context->IsSecureContext()) { |
84 V8WindowPartial::installWebUSB(isolate, world, instance_object, | 91 V8WindowPartial::installWebUSB(isolate, world, instance_object, |
85 prototype_object, interface_object); | 92 prototype_object, interface_object); |
86 } | 93 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 interface_object); | 208 interface_object); |
202 } | 209 } |
203 if (context_data->GetExistingConstructorAndPrototypeForType( | 210 if (context_data->GetExistingConstructorAndPrototypeForType( |
204 &V8Navigator::wrapperTypeInfo, &prototype_object, | 211 &V8Navigator::wrapperTypeInfo, &prototype_object, |
205 &interface_object)) { | 212 &interface_object)) { |
206 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), | 213 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), |
207 prototype_object, interface_object); | 214 prototype_object, interface_object); |
208 } | 215 } |
209 return; | 216 return; |
210 } | 217 } |
| 218 if (feature == "BudgetQuery") { |
| 219 if (context_data->GetExistingConstructorAndPrototypeForType( |
| 220 &V8BudgetService::wrapperTypeInfo, &prototype_object, |
| 221 &interface_object)) { |
| 222 V8BudgetService::installBudgetQuery(isolate, world, |
| 223 v8::Local<v8::Object>(), |
| 224 prototype_object, interface_object); |
| 225 } |
| 226 return; |
| 227 } |
211 } | 228 } |
212 | 229 |
213 void RegisterInstallConditionalFeaturesForModules() { | 230 void RegisterInstallConditionalFeaturesForModules() { |
214 RegisterInstallConditionalFeaturesForCore(); | 231 RegisterInstallConditionalFeaturesForCore(); |
215 g_original_install_conditional_features_function = | 232 g_original_install_conditional_features_function = |
216 SetInstallConditionalFeaturesFunction( | 233 SetInstallConditionalFeaturesFunction( |
217 &InstallConditionalFeaturesForModules); | 234 &InstallConditionalFeaturesForModules); |
218 g_original_install_pending_conditional_feature_function = | 235 g_original_install_pending_conditional_feature_function = |
219 SetInstallPendingConditionalFeatureFunction( | 236 SetInstallPendingConditionalFeatureFunction( |
220 &InstallPendingConditionalFeatureForModules); | 237 &InstallPendingConditionalFeatureForModules); |
221 } | 238 } |
222 | 239 |
223 } // namespace blink | 240 } // namespace blink |
OLD | NEW |