Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/ConditionalFeaturesForModules.cpp

Issue 2785913003: Add an Origin Trial for Navigator.getInstalledRelatedApps. (Closed)
Patch Set: Fix tests and make non-Android-specific. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // files. (crbug.com/615060) 45 // files. (crbug.com/615060)
46 (*s_originalInstallConditionalFeaturesFunction)( 46 (*s_originalInstallConditionalFeaturesFunction)(
47 wrapperTypeInfo, scriptState, prototypeObject, interfaceObject); 47 wrapperTypeInfo, scriptState, prototypeObject, interfaceObject);
48 48
49 ExecutionContext* executionContext = scriptState->getExecutionContext(); 49 ExecutionContext* executionContext = scriptState->getExecutionContext();
50 if (!executionContext) 50 if (!executionContext)
51 return; 51 return;
52 v8::Isolate* isolate = scriptState->isolate(); 52 v8::Isolate* isolate = scriptState->isolate();
53 const DOMWrapperWorld& world = scriptState->world(); 53 const DOMWrapperWorld& world = scriptState->world();
54 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { 54 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) {
55 // Mimics the [SecureContext] extended attribute. Work-around for
56 // https://crbug.com/695123.
57 if (OriginTrials::installedAppEnabled(executionContext) &&
58 executionContext->isSecureContext()) {
59 V8NavigatorPartial::installInstalledApp(isolate, world,
60 v8::Local<v8::Object>(),
61 prototypeObject, interfaceObject);
62 }
55 if (OriginTrials::webShareEnabled(executionContext)) { 63 if (OriginTrials::webShareEnabled(executionContext)) {
56 V8NavigatorPartial::installWebShare(isolate, world, 64 V8NavigatorPartial::installWebShare(isolate, world,
57 v8::Local<v8::Object>(), 65 v8::Local<v8::Object>(),
58 prototypeObject, interfaceObject); 66 prototypeObject, interfaceObject);
59 } 67 }
60 // Mimics the [SecureContext] extended attribute. 68 // Mimics the [SecureContext] extended attribute.
61 if (OriginTrials::webUSBEnabled(executionContext) && 69 if (OriginTrials::webUSBEnabled(executionContext) &&
62 executionContext->isSecureContext()) { 70 executionContext->isSecureContext()) {
63 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), 71 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(),
64 prototypeObject, interfaceObject); 72 prototypeObject, interfaceObject);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 179 }
172 return; 180 return;
173 } 181 }
174 if (feature == "ImageCapture") { 182 if (feature == "ImageCapture") {
175 globalInstanceObject = scriptState->context()->Global(); 183 globalInstanceObject = scriptState->context()->Global();
176 V8WindowPartial::installImageCapture(isolate, world, globalInstanceObject, 184 V8WindowPartial::installImageCapture(isolate, world, globalInstanceObject,
177 v8::Local<v8::Object>(), 185 v8::Local<v8::Object>(),
178 v8::Local<v8::Function>()); 186 v8::Local<v8::Function>());
179 return; 187 return;
180 } 188 }
189 if (feature == "InstalledApp") {
190 if (contextData->getExistingConstructorAndPrototypeForType(
191 &V8Navigator::wrapperTypeInfo, &prototypeObject,
192 &interfaceObject)) {
193 V8NavigatorPartial::installInstalledApp(isolate, world,
194 v8::Local<v8::Object>(),
195 prototypeObject, interfaceObject);
196 }
197 return;
198 }
181 if (feature == "ServiceWorkerNavigationPreload") { 199 if (feature == "ServiceWorkerNavigationPreload") {
182 globalInstanceObject = scriptState->context()->Global(); 200 globalInstanceObject = scriptState->context()->Global();
183 V8WindowPartial::installServiceWorkerNavigationPreload( 201 V8WindowPartial::installServiceWorkerNavigationPreload(
184 isolate, world, globalInstanceObject, v8::Local<v8::Object>(), 202 isolate, world, globalInstanceObject, v8::Local<v8::Object>(),
185 v8::Local<v8::Function>()); 203 v8::Local<v8::Function>());
186 if (contextData->getExistingConstructorAndPrototypeForType( 204 if (contextData->getExistingConstructorAndPrototypeForType(
187 &V8FetchEvent::wrapperTypeInfo, &prototypeObject, 205 &V8FetchEvent::wrapperTypeInfo, &prototypeObject,
188 &interfaceObject)) { 206 &interfaceObject)) {
189 V8FetchEvent::installServiceWorkerNavigationPreload( 207 V8FetchEvent::installServiceWorkerNavigationPreload(
190 isolate, world, v8::Local<v8::Object>(), prototypeObject, 208 isolate, world, v8::Local<v8::Object>(), prototypeObject,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 registerInstallConditionalFeaturesForCore(); 275 registerInstallConditionalFeaturesForCore();
258 s_originalInstallConditionalFeaturesFunction = 276 s_originalInstallConditionalFeaturesFunction =
259 setInstallConditionalFeaturesFunction( 277 setInstallConditionalFeaturesFunction(
260 &installConditionalFeaturesForModules); 278 &installConditionalFeaturesForModules);
261 s_originalInstallPendingConditionalFeatureFunction = 279 s_originalInstallPendingConditionalFeatureFunction =
262 setInstallPendingConditionalFeatureFunction( 280 setInstallPendingConditionalFeatureFunction(
263 &installPendingConditionalFeatureForModules); 281 &installPendingConditionalFeatureForModules);
264 } 282 }
265 283
266 } // namespace blink 284 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698