| 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/core/v8/ConditionalFeatures.h" | 5 #include "bindings/core/v8/ConditionalFeatures.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Document.h" | 8 #include "bindings/core/v8/V8Document.h" |
| 9 #include "bindings/core/v8/V8HTMLLinkElement.h" | 9 #include "bindings/core/v8/V8HTMLLinkElement.h" |
| 10 #include "bindings/core/v8/V8Navigator.h" | 10 #include "bindings/core/v8/V8Navigator.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 V8HTMLLinkElement::installLinkServiceWorker( | 32 V8HTMLLinkElement::installLinkServiceWorker( |
| 33 isolate, world, v8::Local<v8::Object>(), prototypeObject, | 33 isolate, world, v8::Local<v8::Object>(), prototypeObject, |
| 34 interfaceObject); | 34 interfaceObject); |
| 35 } | 35 } |
| 36 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { | 36 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { |
| 37 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); | 37 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); |
| 38 if (OriginTrials::longTaskObserverEnabled(executionContext)) { | 38 if (OriginTrials::longTaskObserverEnabled(executionContext)) { |
| 39 V8Window::installLongTaskObserver(isolate, world, instanceObject, | 39 V8Window::installLongTaskObserver(isolate, world, instanceObject, |
| 40 prototypeObject, interfaceObject); | 40 prototypeObject, interfaceObject); |
| 41 } | 41 } |
| 42 } else if (wrapperTypeInfo == &V8Document::wrapperTypeInfo) { | |
| 43 if (OriginTrials::setRootScrollerEnabled(executionContext)) { | |
| 44 V8Document::installRootScroller(isolate, world, v8::Local<v8::Object>(), | |
| 45 prototypeObject, interfaceObject); | |
| 46 } | |
| 47 } | 42 } |
| 48 } | 43 } |
| 49 | 44 |
| 50 void installPendingConditionalFeatureCore(const String& feature, | 45 void installPendingConditionalFeatureCore(const String& feature, |
| 51 const ScriptState* scriptState) { | 46 const ScriptState* scriptState) { |
| 52 // TODO(iclelland): Generate all of this logic at compile-time, based on the | 47 // TODO(iclelland): Generate all of this logic at compile-time, based on the |
| 53 // configuration of origin trial enabled attributes and interfaces in IDL | 48 // configuration of origin trial enabled attributes and interfaces in IDL |
| 54 // files. (crbug.com/615060) | 49 // files. (crbug.com/615060) |
| 55 v8::Local<v8::Object> prototypeObject; | 50 v8::Local<v8::Object> prototypeObject; |
| 56 v8::Local<v8::Function> interfaceObject; | 51 v8::Local<v8::Function> interfaceObject; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 } | 62 } |
| 68 return; | 63 return; |
| 69 } | 64 } |
| 70 if (feature == "LongTaskObserver") { | 65 if (feature == "LongTaskObserver") { |
| 71 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); | 66 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); |
| 72 V8Window::installLongTaskObserver(isolate, world, instanceObject, | 67 V8Window::installLongTaskObserver(isolate, world, instanceObject, |
| 73 v8::Local<v8::Object>(), | 68 v8::Local<v8::Object>(), |
| 74 v8::Local<v8::Function>()); | 69 v8::Local<v8::Function>()); |
| 75 return; | 70 return; |
| 76 } | 71 } |
| 77 if (feature == "RootScroller") { | |
| 78 if (contextData->getExistingConstructorAndPrototypeForType( | |
| 79 &V8Document::wrapperTypeInfo, &prototypeObject, &interfaceObject)) { | |
| 80 V8Document::installRootScroller(isolate, world, v8::Local<v8::Object>(), | |
| 81 prototypeObject, interfaceObject); | |
| 82 } | |
| 83 return; | |
| 84 } | |
| 85 } | 72 } |
| 86 | 73 |
| 87 namespace { | 74 namespace { |
| 88 | 75 |
| 89 InstallConditionalFeaturesFunction s_installConditionalFeaturesFunction = | 76 InstallConditionalFeaturesFunction s_installConditionalFeaturesFunction = |
| 90 &installConditionalFeaturesCore; | 77 &installConditionalFeaturesCore; |
| 91 | 78 |
| 92 InstallPendingConditionalFeatureFunction | 79 InstallPendingConditionalFeatureFunction |
| 93 s_installPendingConditionalFeatureFunction = | 80 s_installPendingConditionalFeatureFunction = |
| 94 &installPendingConditionalFeatureCore; | 81 &installPendingConditionalFeatureCore; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy(); | 140 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy(); |
| 154 // The policy should always be initialized before checking it to ensure we | 141 // The policy should always be initialized before checking it to ensure we |
| 155 // properly inherit the parent policy. | 142 // properly inherit the parent policy. |
| 156 DCHECK(featurePolicy); | 143 DCHECK(featurePolicy); |
| 157 | 144 |
| 158 // Otherwise, check policy. | 145 // Otherwise, check policy. |
| 159 return featurePolicy->isFeatureEnabled(feature); | 146 return featurePolicy->isFeatureEnabled(feature); |
| 160 } | 147 } |
| 161 | 148 |
| 162 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |