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 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 49 void WebRuntimeFeatures::enableExperimentalFeatures(bool enable) 50 { 51 RuntimeEnabledFeatures::setExperimentalFeaturesEnabled(enable); 52 } 53 54 void WebRuntimeFeatures::enableTestOnlyFeatures(bool enable) 55 { 56 RuntimeEnabledFeatures::setTestFeaturesEnabled(enable); 57 } 58 59 void WebRuntimeFeatures::enableApplicationCache(bool enable) 60 { 61 RuntimeEnabledFeatures::setApplicationCacheEnabled(enable); 62 } 63 64 bool WebRuntimeFeatures::isApplicationCacheEnabled() 65 { 66 return RuntimeEnabledFeatures::applicationCacheEnabled(); 67 } 68 69 void WebRuntimeFeatures::enableDatabase(bool enable) 70 { 71 RuntimeEnabledFeatures::setDatabaseEnabled(enable); 72 } 73 74 bool WebRuntimeFeatures::isDatabaseEnabled() 75 { 76 return RuntimeEnabledFeatures::databaseEnabled(); 77 } 78 79 void WebRuntimeFeatures::enableDeviceMotion(bool enable) 80 { 81 RuntimeEnabledFeatures::setDeviceMotionEnabled(enable); 82 } 83 84 bool WebRuntimeFeatures::isDeviceMotionEnabled() 85 { 86 return RuntimeEnabledFeatures::deviceMotionEnabled(); 87 } 88 89 void WebRuntimeFeatures::enableDeviceOrientation(bool enable) 90 { 91 RuntimeEnabledFeatures::setDeviceOrientationEnabled(enable); 92 } 93 94 bool WebRuntimeFeatures::isDeviceOrientationEnabled() 95 { 96 return RuntimeEnabledFeatures::deviceOrientationEnabled(); 97 } 98 99 void WebRuntimeFeatures::enableDialogElement(bool enable) 100 { 101 RuntimeEnabledFeatures::setDialogElementEnabled(enable); 102 } 103 104 bool WebRuntimeFeatures::isDialogElementEnabled() 105 { 106 return RuntimeEnabledFeatures::dialogElementEnabled(); 107 } 108 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 118 bool WebRuntimeFeatures::isEncryptedMediaEnabled() 119 { 120 return RuntimeEnabledFeatures::encryptedMediaEnabled(); 121 } 122 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 132 bool WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled() 133 { 134 return RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled(); 135 } 136 137 void WebRuntimeFeatures::enableDirectWrite(bool enable) 138 { 139 RuntimeEnabledFeatures::setDirectWriteEnabled(enable); 140 RuntimeEnabledFeatures::setSubpixelFontScalingEnabled(enable || RuntimeEnabledFeatures::subpixelFontScalingEnabled()); 141 } 142 143 bool WebRuntimeFeatures::isDirectWriteEnabled() 144 { 145 return RuntimeEnabledFeatures::directWriteEnabled(); 146 } 147 148 void WebRuntimeFeatures::enableExperimentalCanvasFeatures(bool enable) 149 { 150 RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(enable); 151 } 152 153 bool WebRuntimeFeatures::isExperimentalCanvasFeaturesEnabled() 154 { 155 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); 156 } 157 158 void WebRuntimeFeatures::enableFastTextAutosizing(bool enable) 159 { 160 RuntimeEnabledFeatures::setFastTextAutosizingEnabled(enable); 161 } 162 163 bool WebRuntimeFeatures::isFastTextAutosizingEnabled() 164 { 165 return RuntimeEnabledFeatures::fastTextAutosizingEnabled(); 166 } 167 168 void WebRuntimeFeatures::enableFileSystem(bool enable) 169 { 170 RuntimeEnabledFeatures::setFileSystemEnabled(enable); 171 } 172 173 bool WebRuntimeFeatures::isFileSystemEnabled() 174 { 175 return RuntimeEnabledFeatures::fileSystemEnabled(); 176 } 177 178 void WebRuntimeFeatures::enableFullscreen(bool enable) 179 { 180 RuntimeEnabledFeatures::setFullscreenEnabled(enable); 181 } 182 183 bool WebRuntimeFeatures::isFullscreenEnabled() 184 { 185 return RuntimeEnabledFeatures::fullscreenEnabled(); 186 } 187 188 void WebRuntimeFeatures::enableGamepad(bool enable) 189 { 190 RuntimeEnabledFeatures::setGamepadEnabled(enable); 191 } 192 193 bool WebRuntimeFeatures::isGamepadEnabled() 194 { 195 return RuntimeEnabledFeatures::gamepadEnabled(); 196 } 197 198 void WebRuntimeFeatures::enableGeolocation(bool enable) 199 { 200 RuntimeEnabledFeatures::setGeolocationEnabled(enable); 201 } 202 203 bool WebRuntimeFeatures::isGeolocationEnabled() 204 { 205 return RuntimeEnabledFeatures::geolocationEnabled(); 206 } 207 208 void WebRuntimeFeatures::enableLazyLayout(bool enable) 209 { 210 // FIXME: Remove this once Chromium stops calling this. 211 } 212 213 void WebRuntimeFeatures::enableLocalStorage(bool enable) 214 { 215 RuntimeEnabledFeatures::setLocalStorageEnabled(enable); 216 } 217 218 bool WebRuntimeFeatures::isLocalStorageEnabled() 219 { 220 return RuntimeEnabledFeatures::localStorageEnabled(); 221 } 222 223 void WebRuntimeFeatures::enableMediaPlayer(bool enable) 224 { 225 RuntimeEnabledFeatures::setMediaEnabled(enable); 226 } 227 228 bool WebRuntimeFeatures::isMediaPlayerEnabled() 229 { 230 return RuntimeEnabledFeatures::mediaEnabled(); 231 } 232 233 void WebRuntimeFeatures::enableWebKitMediaSource(bool enable) 234 { 235 RuntimeEnabledFeatures::setWebKitMediaSourceEnabled(enable); 236 } 237 238 bool WebRuntimeFeatures::isWebKitMediaSourceEnabled() 239 { 240 return RuntimeEnabledFeatures::webKitMediaSourceEnabled(); 241 } 242 243 void WebRuntimeFeatures::enableMediaSource(bool enable) 244 { 245 RuntimeEnabledFeatures::setMediaSourceEnabled(enable); 246 } 247 248 bool WebRuntimeFeatures::isMediaSourceEnabled() 249 { 250 return RuntimeEnabledFeatures::mediaSourceEnabled(); 251 } 252 253 void WebRuntimeFeatures::enableMediaStream(bool enable) 254 { 255 RuntimeEnabledFeatures::setMediaStreamEnabled(enable); 256 } 257 258 bool WebRuntimeFeatures::isMediaStreamEnabled() 259 { 260 return RuntimeEnabledFeatures::mediaStreamEnabled(); 261 } 262 263 void WebRuntimeFeatures::enableNotifications(bool enable) 264 { 265 RuntimeEnabledFeatures::setNotificationsEnabled(enable); 266 } 267 268 bool WebRuntimeFeatures::isNotificationsEnabled() 269 { 270 return RuntimeEnabledFeatures::notificationsEnabled(); 271 } 272 273 void WebRuntimeFeatures::enableNavigatorContentUtils(bool enable) 274 { 275 RuntimeEnabledFeatures::setNavigatorContentUtilsEnabled(enable); 276 } 277 278 bool WebRuntimeFeatures::isNavigatorContentUtilsEnabled() 279 { 280 return RuntimeEnabledFeatures::navigatorContentUtilsEnabled(); 281 } 282 283 void WebRuntimeFeatures::enablePagePopup(bool enable) 284 { 285 RuntimeEnabledFeatures::setPagePopupEnabled(enable); 286 } 287 288 bool WebRuntimeFeatures::isPagePopupEnabled() 289 { 290 return RuntimeEnabledFeatures::pagePopupEnabled(); 291 } 292 293 void WebRuntimeFeatures::enablePeerConnection(bool enable) 294 { 295 RuntimeEnabledFeatures::setPeerConnectionEnabled(enable); 296 } 297 298 bool WebRuntimeFeatures::isPeerConnectionEnabled() 299 { 300 return RuntimeEnabledFeatures::peerConnectionEnabled(); 301 } 302 303 void WebRuntimeFeatures::enableRequestAutocomplete(bool enable) 304 { 305 RuntimeEnabledFeatures::setRequestAutocompleteEnabled(enable); 306 } 307 308 bool WebRuntimeFeatures::isRequestAutocompleteEnabled() 309 { 310 return RuntimeEnabledFeatures::requestAutocompleteEnabled(); 311 } 312 313 void WebRuntimeFeatures::enableScriptedSpeech(bool enable) 314 { 315 RuntimeEnabledFeatures::setScriptedSpeechEnabled(enable); 316 } 317 318 bool WebRuntimeFeatures::isScriptedSpeechEnabled() 319 { 320 return RuntimeEnabledFeatures::scriptedSpeechEnabled(); 321 } 322 323 void WebRuntimeFeatures::enableServiceWorker(bool enable) 324 { 325 RuntimeEnabledFeatures::setServiceWorkerEnabled(enable); 326 } 327 328 bool WebRuntimeFeatures::isServiceWorkerEnabled() 329 { 330 return RuntimeEnabledFeatures::serviceWorkerEnabled(); 331 } 332 333 void WebRuntimeFeatures::enableSessionStorage(bool enable) 334 { 335 RuntimeEnabledFeatures::setSessionStorageEnabled(enable); 336 } 337 338 bool WebRuntimeFeatures::isSessionStorageEnabled() 339 { 340 return RuntimeEnabledFeatures::sessionStorageEnabled(); 341 } 342 343 void WebRuntimeFeatures::enableSpeechInput(bool enable) 344 { 345 RuntimeEnabledFeatures::setSpeechInputEnabled(enable); 346 } 347 348 bool WebRuntimeFeatures::isSpeechInputEnabled() 349 { 350 return RuntimeEnabledFeatures::speechInputEnabled(); 351 } 352 353 void WebRuntimeFeatures::enableSpeechSynthesis(bool enable) 354 { 355 RuntimeEnabledFeatures::setSpeechSynthesisEnabled(enable); 356 } 357 358 bool WebRuntimeFeatures::isSpeechSynthesisEnabled() 359 { 360 return RuntimeEnabledFeatures::speechSynthesisEnabled(); 361 } 362 363 void WebRuntimeFeatures::enableTouch(bool enable) 364 { 365 RuntimeEnabledFeatures::setTouchEnabled(enable); 366 } 367 368 bool WebRuntimeFeatures::isTouchEnabled() 369 { 370 return RuntimeEnabledFeatures::touchEnabled(); 371 } 372 373 void WebRuntimeFeatures::enableWebAnimationsCSS(bool enable) 374 { 375 RuntimeEnabledFeatures::setWebAnimationsCSSEnabled(enable); 376 } 377 378 void WebRuntimeFeatures::enableWebAnimationsSVG(bool enable) 379 { 380 RuntimeEnabledFeatures::setWebAnimationsSVGEnabled(enable); 381 } 382 383 void WebRuntimeFeatures::enableWebAudio(bool enable) 384 { 385 RuntimeEnabledFeatures::setWebAudioEnabled(enable); 386 } 387 388 bool WebRuntimeFeatures::isWebAudioEnabled() 389 { 390 return RuntimeEnabledFeatures::webAudioEnabled(); 391 } 392 393 void WebRuntimeFeatures::enableWebGLDraftExtensions(bool enable) 394 { 395 RuntimeEnabledFeatures::setWebGLDraftExtensionsEnabled(enable); 396 } 397 398 bool WebRuntimeFeatures::isWebGLDraftExtensionsEnabled() 399 { 400 return RuntimeEnabledFeatures::webGLDraftExtensionsEnabled(); 401 } 402 403 void WebRuntimeFeatures::enableWebMIDI(bool enable) 404 { 405 return RuntimeEnabledFeatures::setWebMIDIEnabled(enable); 406 } 407 408 bool WebRuntimeFeatures::isWebMIDIEnabled() 409 { 410 return RuntimeEnabledFeatures::webMIDIEnabled(); 411 } 412 413 void WebRuntimeFeatures::enableDataListElement(bool enable) 414 { 415 RuntimeEnabledFeatures::setDataListElementEnabled(enable); 416 } 417 418 bool WebRuntimeFeatures::isDataListElementEnabled() 419 { 420 return RuntimeEnabledFeatures::dataListElementEnabled(); 421 } 422 423 void WebRuntimeFeatures::enableHTMLImports(bool enable) 424 { 425 RuntimeEnabledFeatures::setHTMLImportsEnabled(enable); 426 } 427 428 bool WebRuntimeFeatures::isHTMLImportsEnabled() 429 { 430 return RuntimeEnabledFeatures::htmlImportsEnabled(); 431 } 432 433 void WebRuntimeFeatures::enableXSLT(bool enable) 434 { 435 RuntimeEnabledFeatures::setXSLTEnabled(enable); 436 } 437 438 void WebRuntimeFeatures::enableEmbedderCustomElements(bool enable) 439 { 440 RuntimeEnabledFeatures::setEmbedderCustomElementsEnabled(enable); 441 } 442 443 void WebRuntimeFeatures::enableOverlayScrollbars(bool enable) 444 { 445 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(enable); 446 } 447 448 void WebRuntimeFeatures::enableInputModeAttribute(bool enable) 449 { 450 RuntimeEnabledFeatures::setInputModeAttributeEnabled(enable); 451 } 452 453 void WebRuntimeFeatures::enableOverlayFullscreenVideo(bool enable) 454 { 455 RuntimeEnabledFeatures::setOverlayFullscreenVideoEnabled(enable); 456 } 457 458 void WebRuntimeFeatures::enableSharedWorker(bool enable) 459 { 460 RuntimeEnabledFeatures::setSharedWorkerEnabled(enable); 461 } 462 463 void WebRuntimeFeatures::enableRepaintAfterLayout(bool enable) 464 { 465 RuntimeEnabledFeatures::setRepaintAfterLayoutEnabled(enable); 466 } 467 468 } // namespace blink 469