1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include "config.h"
32 #include "WebRuntimeFeatures.h"
33
34 #include "RuntimeEnabledFeatures.h"
35 #include "WebMediaPlayerClientImpl.h"
36
37 using namespace WebCore;
38
39 namespace blink {
40
enableStableFeatures(bool enable)41 void WebRuntimeFeatures::enableStableFeatures(bool enable)
42 {
43 RuntimeEnabledFeatures::setStableFeaturesEnabled(enable);
44 // FIXME: enableMediaPlayer does not use RuntimeEnabledFeatures
45 // and does not belong as part of WebRuntimeFeatures.
46 enableMediaPlayer(enable);
47 }
48
enableExperimentalFeatures(bool enable)49 void WebRuntimeFeatures::enableExperimentalFeatures(bool enable)
50 {
51 RuntimeEnabledFeatures::setExperimentalFeaturesEnabled(enable);
52 }
53
enableTestOnlyFeatures(bool enable)54 void WebRuntimeFeatures::enableTestOnlyFeatures(bool enable)
55 {
56 RuntimeEnabledFeatures::setTestFeaturesEnabled(enable);
57 }
58
enableApplicationCache(bool enable)59 void WebRuntimeFeatures::enableApplicationCache(bool enable)
60 {
61 RuntimeEnabledFeatures::setApplicationCacheEnabled(enable);
62 }
63
isApplicationCacheEnabled()64 bool WebRuntimeFeatures::isApplicationCacheEnabled()
65 {
66 return RuntimeEnabledFeatures::applicationCacheEnabled();
67 }
68
enableDatabase(bool enable)69 void WebRuntimeFeatures::enableDatabase(bool enable)
70 {
71 RuntimeEnabledFeatures::setDatabaseEnabled(enable);
72 }
73
isDatabaseEnabled()74 bool WebRuntimeFeatures::isDatabaseEnabled()
75 {
76 return RuntimeEnabledFeatures::databaseEnabled();
77 }
78
enableDeviceMotion(bool enable)79 void WebRuntimeFeatures::enableDeviceMotion(bool enable)
80 {
81 RuntimeEnabledFeatures::setDeviceMotionEnabled(enable);
82 }
83
isDeviceMotionEnabled()84 bool WebRuntimeFeatures::isDeviceMotionEnabled()
85 {
86 return RuntimeEnabledFeatures::deviceMotionEnabled();
87 }
88
enableDeviceOrientation(bool enable)89 void WebRuntimeFeatures::enableDeviceOrientation(bool enable)
90 {
91 RuntimeEnabledFeatures::setDeviceOrientationEnabled(enable);
92 }
93
isDeviceOrientationEnabled()94 bool WebRuntimeFeatures::isDeviceOrientationEnabled()
95 {
96 return RuntimeEnabledFeatures::deviceOrientationEnabled();
97 }
98
enableDialogElement(bool enable)99 void WebRuntimeFeatures::enableDialogElement(bool enable)
100 {
101 RuntimeEnabledFeatures::setDialogElementEnabled(enable);
102 }
103
isDialogElementEnabled()104 bool WebRuntimeFeatures::isDialogElementEnabled()
105 {
106 return RuntimeEnabledFeatures::dialogElementEnabled();
107 }
108
enableEncryptedMedia(bool enable)109 void WebRuntimeFeatures::enableEncryptedMedia(bool enable)
110 {
111 RuntimeEnabledFeatures::setEncryptedMediaEnabled(enable);
112 // FIXME: Hack to allow MediaKeyError to be enabled for either version.
113 RuntimeEnabledFeatures::setEncryptedMediaAnyVersionEnabled(
114 RuntimeEnabledFeatures::encryptedMediaEnabled()
115 || RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled());
116 }
117
isEncryptedMediaEnabled()118 bool WebRuntimeFeatures::isEncryptedMediaEnabled()
119 {
120 return RuntimeEnabledFeatures::encryptedMediaEnabled();
121 }
122
enablePrefixedEncryptedMedia(bool enable)123 void WebRuntimeFeatures::enablePrefixedEncryptedMedia(bool enable)
124 {
125 RuntimeEnabledFeatures::setPrefixedEncryptedMediaEnabled(enable);
126 // FIXME: Hack to allow MediaKeyError to be enabled for either version.
127 RuntimeEnabledFeatures::setEncryptedMediaAnyVersionEnabled(
128 RuntimeEnabledFeatures::encryptedMediaEnabled()
129 || RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled());
130 }
131
isPrefixedEncryptedMediaEnabled()132 bool WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled()
133 {
134 return RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled();
135 }
136
enableDirectWrite(bool enable)137 void WebRuntimeFeatures::enableDirectWrite(bool enable)
138 {
139 RuntimeEnabledFeatures::setDirectWriteEnabled(enable);
140 RuntimeEnabledFeatures::setSubpixelFontScalingEnabled(enable || RuntimeEnabledFeatures::subpixelFontScalingEnabled());
141 }
142
isDirectWriteEnabled()143 bool WebRuntimeFeatures::isDirectWriteEnabled()
144 {
145 return RuntimeEnabledFeatures::directWriteEnabled();
146 }
147
enableExperimentalCanvasFeatures(bool enable)148 void WebRuntimeFeatures::enableExperimentalCanvasFeatures(bool enable)
149 {
150 RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(enable);
151 }
152
isExperimentalCanvasFeaturesEnabled()153 bool WebRuntimeFeatures::isExperimentalCanvasFeaturesEnabled()
154 {
155 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled();
156 }
157
enableFastTextAutosizing(bool enable)158 void WebRuntimeFeatures::enableFastTextAutosizing(bool enable)
159 {
160 RuntimeEnabledFeatures::setFastTextAutosizingEnabled(enable);
161 }
162
isFastTextAutosizingEnabled()163 bool WebRuntimeFeatures::isFastTextAutosizingEnabled()
164 {
165 return RuntimeEnabledFeatures::fastTextAutosizingEnabled();
166 }
167
enableFileSystem(bool enable)168 void WebRuntimeFeatures::enableFileSystem(bool enable)
169 {
170 RuntimeEnabledFeatures::setFileSystemEnabled(enable);
171 }
172
isFileSystemEnabled()173 bool WebRuntimeFeatures::isFileSystemEnabled()
174 {
175 return RuntimeEnabledFeatures::fileSystemEnabled();
176 }
177
enableFullscreen(bool enable)178 void WebRuntimeFeatures::enableFullscreen(bool enable)
179 {
180 RuntimeEnabledFeatures::setFullscreenEnabled(enable);
181 }
182
isFullscreenEnabled()183 bool WebRuntimeFeatures::isFullscreenEnabled()
184 {
185 return RuntimeEnabledFeatures::fullscreenEnabled();
186 }
187
enableGamepad(bool enable)188 void WebRuntimeFeatures::enableGamepad(bool enable)
189 {
190 RuntimeEnabledFeatures::setGamepadEnabled(enable);
191 }
192
isGamepadEnabled()193 bool WebRuntimeFeatures::isGamepadEnabled()
194 {
195 return RuntimeEnabledFeatures::gamepadEnabled();
196 }
197
enableGeolocation(bool enable)198 void WebRuntimeFeatures::enableGeolocation(bool enable)
199 {
200 RuntimeEnabledFeatures::setGeolocationEnabled(enable);
201 }
202
isGeolocationEnabled()203 bool WebRuntimeFeatures::isGeolocationEnabled()
204 {
205 return RuntimeEnabledFeatures::geolocationEnabled();
206 }
207
enableLazyLayout(bool enable)208 void WebRuntimeFeatures::enableLazyLayout(bool enable)
209 {
210 // FIXME: Remove this once Chromium stops calling this.
211 }
212
enableLocalStorage(bool enable)213 void WebRuntimeFeatures::enableLocalStorage(bool enable)
214 {
215 RuntimeEnabledFeatures::setLocalStorageEnabled(enable);
216 }
217
isLocalStorageEnabled()218 bool WebRuntimeFeatures::isLocalStorageEnabled()
219 {
220 return RuntimeEnabledFeatures::localStorageEnabled();
221 }
222
enableMediaPlayer(bool enable)223 void WebRuntimeFeatures::enableMediaPlayer(bool enable)
224 {
225 RuntimeEnabledFeatures::setMediaEnabled(enable);
226 }
227
isMediaPlayerEnabled()228 bool WebRuntimeFeatures::isMediaPlayerEnabled()
229 {
230 return RuntimeEnabledFeatures::mediaEnabled();
231 }
232
enableWebKitMediaSource(bool enable)233 void WebRuntimeFeatures::enableWebKitMediaSource(bool enable)
234 {
235 RuntimeEnabledFeatures::setWebKitMediaSourceEnabled(enable);
236 }
237
isWebKitMediaSourceEnabled()238 bool WebRuntimeFeatures::isWebKitMediaSourceEnabled()
239 {
240 return RuntimeEnabledFeatures::webKitMediaSourceEnabled();
241 }
242
enableMediaSource(bool enable)243 void WebRuntimeFeatures::enableMediaSource(bool enable)
244 {
245 RuntimeEnabledFeatures::setMediaSourceEnabled(enable);
246 }
247
isMediaSourceEnabled()248 bool WebRuntimeFeatures::isMediaSourceEnabled()
249 {
250 return RuntimeEnabledFeatures::mediaSourceEnabled();
251 }
252
enableMediaStream(bool enable)253 void WebRuntimeFeatures::enableMediaStream(bool enable)
254 {
255 RuntimeEnabledFeatures::setMediaStreamEnabled(enable);
256 }
257
isMediaStreamEnabled()258 bool WebRuntimeFeatures::isMediaStreamEnabled()
259 {
260 return RuntimeEnabledFeatures::mediaStreamEnabled();
261 }
262
enableNotifications(bool enable)263 void WebRuntimeFeatures::enableNotifications(bool enable)
264 {
265 RuntimeEnabledFeatures::setNotificationsEnabled(enable);
266 }
267
isNotificationsEnabled()268 bool WebRuntimeFeatures::isNotificationsEnabled()
269 {
270 return RuntimeEnabledFeatures::notificationsEnabled();
271 }
272
enableNavigatorContentUtils(bool enable)273 void WebRuntimeFeatures::enableNavigatorContentUtils(bool enable)
274 {
275 RuntimeEnabledFeatures::setNavigatorContentUtilsEnabled(enable);
276 }
277
isNavigatorContentUtilsEnabled()278 bool WebRuntimeFeatures::isNavigatorContentUtilsEnabled()
279 {
280 return RuntimeEnabledFeatures::navigatorContentUtilsEnabled();
281 }
282
enablePagePopup(bool enable)283 void WebRuntimeFeatures::enablePagePopup(bool enable)
284 {
285 RuntimeEnabledFeatures::setPagePopupEnabled(enable);
286 }
287
isPagePopupEnabled()288 bool WebRuntimeFeatures::isPagePopupEnabled()
289 {
290 return RuntimeEnabledFeatures::pagePopupEnabled();
291 }
292
enablePeerConnection(bool enable)293 void WebRuntimeFeatures::enablePeerConnection(bool enable)
294 {
295 RuntimeEnabledFeatures::setPeerConnectionEnabled(enable);
296 }
297
isPeerConnectionEnabled()298 bool WebRuntimeFeatures::isPeerConnectionEnabled()
299 {
300 return RuntimeEnabledFeatures::peerConnectionEnabled();
301 }
302
enableRequestAutocomplete(bool enable)303 void WebRuntimeFeatures::enableRequestAutocomplete(bool enable)
304 {
305 RuntimeEnabledFeatures::setRequestAutocompleteEnabled(enable);
306 }
307
isRequestAutocompleteEnabled()308 bool WebRuntimeFeatures::isRequestAutocompleteEnabled()
309 {
310 return RuntimeEnabledFeatures::requestAutocompleteEnabled();
311 }
312
enableScriptedSpeech(bool enable)313 void WebRuntimeFeatures::enableScriptedSpeech(bool enable)
314 {
315 RuntimeEnabledFeatures::setScriptedSpeechEnabled(enable);
316 }
317
isScriptedSpeechEnabled()318 bool WebRuntimeFeatures::isScriptedSpeechEnabled()
319 {
320 return RuntimeEnabledFeatures::scriptedSpeechEnabled();
321 }
322
enableServiceWorker(bool enable)323 void WebRuntimeFeatures::enableServiceWorker(bool enable)
324 {
325 RuntimeEnabledFeatures::setServiceWorkerEnabled(enable);
326 }
327
isServiceWorkerEnabled()328 bool WebRuntimeFeatures::isServiceWorkerEnabled()
329 {
330 return RuntimeEnabledFeatures::serviceWorkerEnabled();
331 }
332
enableSessionStorage(bool enable)333 void WebRuntimeFeatures::enableSessionStorage(bool enable)
334 {
335 RuntimeEnabledFeatures::setSessionStorageEnabled(enable);
336 }
337
isSessionStorageEnabled()338 bool WebRuntimeFeatures::isSessionStorageEnabled()
339 {
340 return RuntimeEnabledFeatures::sessionStorageEnabled();
341 }
342
enableSpeechInput(bool enable)343 void WebRuntimeFeatures::enableSpeechInput(bool enable)
344 {
345 RuntimeEnabledFeatures::setSpeechInputEnabled(enable);
346 }
347
isSpeechInputEnabled()348 bool WebRuntimeFeatures::isSpeechInputEnabled()
349 {
350 return RuntimeEnabledFeatures::speechInputEnabled();
351 }
352
enableSpeechSynthesis(bool enable)353 void WebRuntimeFeatures::enableSpeechSynthesis(bool enable)
354 {
355 RuntimeEnabledFeatures::setSpeechSynthesisEnabled(enable);
356 }
357
isSpeechSynthesisEnabled()358 bool WebRuntimeFeatures::isSpeechSynthesisEnabled()
359 {
360 return RuntimeEnabledFeatures::speechSynthesisEnabled();
361 }
362
enableTouch(bool enable)363 void WebRuntimeFeatures::enableTouch(bool enable)
364 {
365 RuntimeEnabledFeatures::setTouchEnabled(enable);
366 }
367
isTouchEnabled()368 bool WebRuntimeFeatures::isTouchEnabled()
369 {
370 return RuntimeEnabledFeatures::touchEnabled();
371 }
372
enableWebAnimationsCSS(bool enable)373 void WebRuntimeFeatures::enableWebAnimationsCSS(bool enable)
374 {
375 RuntimeEnabledFeatures::setWebAnimationsCSSEnabled(enable);
376 }
377
enableWebAnimationsSVG(bool enable)378 void WebRuntimeFeatures::enableWebAnimationsSVG(bool enable)
379 {
380 RuntimeEnabledFeatures::setWebAnimationsSVGEnabled(enable);
381 }
382
enableWebAudio(bool enable)383 void WebRuntimeFeatures::enableWebAudio(bool enable)
384 {
385 RuntimeEnabledFeatures::setWebAudioEnabled(enable);
386 }
387
isWebAudioEnabled()388 bool WebRuntimeFeatures::isWebAudioEnabled()
389 {
390 return RuntimeEnabledFeatures::webAudioEnabled();
391 }
392
enableWebGLDraftExtensions(bool enable)393 void WebRuntimeFeatures::enableWebGLDraftExtensions(bool enable)
394 {
395 RuntimeEnabledFeatures::setWebGLDraftExtensionsEnabled(enable);
396 }
397
isWebGLDraftExtensionsEnabled()398 bool WebRuntimeFeatures::isWebGLDraftExtensionsEnabled()
399 {
400 return RuntimeEnabledFeatures::webGLDraftExtensionsEnabled();
401 }
402
enableWebMIDI(bool enable)403 void WebRuntimeFeatures::enableWebMIDI(bool enable)
404 {
405 return RuntimeEnabledFeatures::setWebMIDIEnabled(enable);
406 }
407
isWebMIDIEnabled()408 bool WebRuntimeFeatures::isWebMIDIEnabled()
409 {
410 return RuntimeEnabledFeatures::webMIDIEnabled();
411 }
412
enableDataListElement(bool enable)413 void WebRuntimeFeatures::enableDataListElement(bool enable)
414 {
415 RuntimeEnabledFeatures::setDataListElementEnabled(enable);
416 }
417
isDataListElementEnabled()418 bool WebRuntimeFeatures::isDataListElementEnabled()
419 {
420 return RuntimeEnabledFeatures::dataListElementEnabled();
421 }
422
enableHTMLImports(bool enable)423 void WebRuntimeFeatures::enableHTMLImports(bool enable)
424 {
425 RuntimeEnabledFeatures::setHTMLImportsEnabled(enable);
426 }
427
isHTMLImportsEnabled()428 bool WebRuntimeFeatures::isHTMLImportsEnabled()
429 {
430 return RuntimeEnabledFeatures::htmlImportsEnabled();
431 }
432
enableXSLT(bool enable)433 void WebRuntimeFeatures::enableXSLT(bool enable)
434 {
435 RuntimeEnabledFeatures::setXSLTEnabled(enable);
436 }
437
enableEmbedderCustomElements(bool enable)438 void WebRuntimeFeatures::enableEmbedderCustomElements(bool enable)
439 {
440 RuntimeEnabledFeatures::setEmbedderCustomElementsEnabled(enable);
441 }
442
enableOverlayScrollbars(bool enable)443 void WebRuntimeFeatures::enableOverlayScrollbars(bool enable)
444 {
445 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(enable);
446 }
447
enableInputModeAttribute(bool enable)448 void WebRuntimeFeatures::enableInputModeAttribute(bool enable)
449 {
450 RuntimeEnabledFeatures::setInputModeAttributeEnabled(enable);
451 }
452
enableOverlayFullscreenVideo(bool enable)453 void WebRuntimeFeatures::enableOverlayFullscreenVideo(bool enable)
454 {
455 RuntimeEnabledFeatures::setOverlayFullscreenVideoEnabled(enable);
456 }
457
enableSharedWorker(bool enable)458 void WebRuntimeFeatures::enableSharedWorker(bool enable)
459 {
460 RuntimeEnabledFeatures::setSharedWorkerEnabled(enable);
461 }
462
enableRepaintAfterLayout(bool enable)463 void WebRuntimeFeatures::enableRepaintAfterLayout(bool enable)
464 {
465 RuntimeEnabledFeatures::setRepaintAfterLayoutEnabled(enable);
466 }
467
468 } // namespace blink
469