| 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/ConditionalFeaturesForCore.h" | 7 #include "bindings/core/v8/ConditionalFeaturesForCore.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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // files. (crbug.com/615060) | 43 // files. (crbug.com/615060) |
| 44 (*g_original_install_conditional_features_function)( | 44 (*g_original_install_conditional_features_function)( |
| 45 wrapper_type_info, script_state, prototype_object, interface_object); | 45 wrapper_type_info, script_state, prototype_object, interface_object); |
| 46 | 46 |
| 47 ExecutionContext* execution_context = ExecutionContext::From(script_state); | 47 ExecutionContext* execution_context = ExecutionContext::From(script_state); |
| 48 if (!execution_context) | 48 if (!execution_context) |
| 49 return; | 49 return; |
| 50 v8::Isolate* isolate = script_state->GetIsolate(); | 50 v8::Isolate* isolate = script_state->GetIsolate(); |
| 51 const DOMWrapperWorld& world = script_state->World(); | 51 const DOMWrapperWorld& world = script_state->World(); |
| 52 if (wrapper_type_info == &V8Navigator::wrapperTypeInfo) { | 52 if (wrapper_type_info == &V8Navigator::wrapperTypeInfo) { |
| 53 // Mimics the [SecureContext] extended attribute. Work-around for | 53 if (OriginTrials::installedAppEnabled(execution_context)) { |
| 54 // https://crbug.com/695123. | |
| 55 if (OriginTrials::installedAppEnabled(execution_context) && | |
| 56 execution_context->IsSecureContext()) { | |
| 57 V8NavigatorPartial::installInstalledApp( | 54 V8NavigatorPartial::installInstalledApp( |
| 58 isolate, world, v8::Local<v8::Object>(), prototype_object, | 55 isolate, world, v8::Local<v8::Object>(), prototype_object, |
| 59 interface_object); | 56 interface_object); |
| 60 } | 57 } |
| 61 if (OriginTrials::webShareEnabled(execution_context)) { | 58 if (OriginTrials::webShareEnabled(execution_context)) { |
| 62 V8NavigatorPartial::installWebShare(isolate, world, | 59 V8NavigatorPartial::installWebShare(isolate, world, |
| 63 v8::Local<v8::Object>(), | 60 v8::Local<v8::Object>(), |
| 64 prototype_object, interface_object); | 61 prototype_object, interface_object); |
| 65 } | 62 } |
| 66 // Mimics the [SecureContext] extended attribute. Work-around for | 63 if (OriginTrials::webUSBEnabled(execution_context)) { |
| 67 // https://crbug.com/695123. | |
| 68 if (OriginTrials::webUSBEnabled(execution_context) && | |
| 69 execution_context->IsSecureContext()) { | |
| 70 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), | 64 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), |
| 71 prototype_object, interface_object); | 65 prototype_object, interface_object); |
| 72 } | 66 } |
| 73 if (OriginTrials::webVREnabled(execution_context)) { | 67 if (OriginTrials::webVREnabled(execution_context)) { |
| 74 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), | 68 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), |
| 75 prototype_object, interface_object); | 69 prototype_object, interface_object); |
| 76 } | 70 } |
| 77 } else if (wrapper_type_info == &V8Window::wrapperTypeInfo) { | 71 } else if (wrapper_type_info == &V8Window::wrapperTypeInfo) { |
| 78 v8::Local<v8::Object> instance_object = | 72 v8::Local<v8::Object> instance_object = |
| 79 script_state->GetContext()->Global(); | 73 script_state->GetContext()->Global(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 RegisterInstallConditionalFeaturesForCore(); | 208 RegisterInstallConditionalFeaturesForCore(); |
| 215 g_original_install_conditional_features_function = | 209 g_original_install_conditional_features_function = |
| 216 SetInstallConditionalFeaturesFunction( | 210 SetInstallConditionalFeaturesFunction( |
| 217 &InstallConditionalFeaturesForModules); | 211 &InstallConditionalFeaturesForModules); |
| 218 g_original_install_pending_conditional_feature_function = | 212 g_original_install_pending_conditional_feature_function = |
| 219 SetInstallPendingConditionalFeatureFunction( | 213 SetInstallPendingConditionalFeatureFunction( |
| 220 &InstallPendingConditionalFeatureForModules); | 214 &InstallPendingConditionalFeatureForModules); |
| 221 } | 215 } |
| 222 | 216 |
| 223 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |