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 "public/web/WebRuntimeFeatures.h" 33 34 #include "platform/RuntimeEnabledFeatures.h" 35 #include "web/WebMediaPlayerClientImpl.h" 36 37 namespace blink { 38 39 void WebRuntimeFeatures::enableExperimentalFeatures(bool enable) 40 { 41 RuntimeEnabledFeatures::setExperimentalFeaturesEnabled(enable); 42 } 43 44 void WebRuntimeFeatures::enableBleedingEdgeFastPaths(bool enable) 45 { 46 ASSERT(enable); 47 RuntimeEnabledFeatures::setBleedingEdgeFastPathsEnabled(enable); 48 RuntimeEnabledFeatures::setSubpixelFontScalingEnabled(enable || RuntimeEnabledFeatures::subpixelFontScalingEnabled()); 49 RuntimeEnabledFeatures::setWebAnimationsAPIEnabled(enable); 50 } 51 52 void WebRuntimeFeatures::enableTestOnlyFeatures(bool enable) 53 { 54 RuntimeEnabledFeatures::setTestFeaturesEnabled(enable); 55 } 56 57 void WebRuntimeFeatures::enableApplicationCache(bool enable) 58 { 59 RuntimeEnabledFeatures::setApplicationCacheEnabled(enable); 60 } 61 62 63 void WebRuntimeFeatures::enableCompositedSelectionUpdate(bool enable) 64 { 65 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(enable); 66 } 67 68 bool WebRuntimeFeatures::isCompositedSelectionUpdateEnabled() 69 { 70 return RuntimeEnabledFeatures::compositedSelectionUpdateEnabled(); 71 } 72 73 void WebRuntimeFeatures::enableDatabase(bool enable) 74 { 75 RuntimeEnabledFeatures::setDatabaseEnabled(enable); 76 } 77 78 void WebRuntimeFeatures::enableDecodeToYUV(bool enable) 79 { 80 RuntimeEnabledFeatures::setDecodeToYUVEnabled(enable); 81 } 82 83 void WebRuntimeFeatures::enableDisplayList2dCanvas(bool enable) 84 { 85 RuntimeEnabledFeatures::setDisplayList2dCanvasEnabled(enable); 86 } 87 88 void WebRuntimeFeatures::enableEncryptedMedia(bool enable) 89 { 90 RuntimeEnabledFeatures::setEncryptedMediaEnabled(enable); 91 // FIXME: Hack to allow MediaKeyError to be enabled for either version. 92 RuntimeEnabledFeatures::setEncryptedMediaAnyVersionEnabled( 93 RuntimeEnabledFeatures::encryptedMediaEnabled() 94 || RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled()); 95 } 96 97 bool WebRuntimeFeatures::isEncryptedMediaEnabled() 98 { 99 return RuntimeEnabledFeatures::encryptedMediaEnabled(); 100 } 101 102 void WebRuntimeFeatures::enablePrefixedEncryptedMedia(bool enable) 103 { 104 RuntimeEnabledFeatures::setPrefixedEncryptedMediaEnabled(enable); 105 // FIXME: Hack to allow MediaKeyError to be enabled for either version. 106 RuntimeEnabledFeatures::setEncryptedMediaAnyVersionEnabled( 107 RuntimeEnabledFeatures::encryptedMediaEnabled() 108 || RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled()); 109 } 110 111 bool WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled() 112 { 113 return RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled(); 114 } 115 116 void WebRuntimeFeatures::enableExperimentalCanvasFeatures(bool enable) 117 { 118 RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(enable); 119 } 120 121 void WebRuntimeFeatures::enableFastMobileScrolling(bool enable) 122 { 123 RuntimeEnabledFeatures::setFastMobileScrollingEnabled(enable); 124 } 125 126 void WebRuntimeFeatures::enableFileSystem(bool enable) 127 { 128 RuntimeEnabledFeatures::setFileSystemEnabled(enable); 129 } 130 131 void WebRuntimeFeatures::enableGamepad(bool enable) 132 { 133 RuntimeEnabledFeatures::setGamepadEnabled(enable); 134 } 135 136 void WebRuntimeFeatures::enableLocalStorage(bool enable) 137 { 138 RuntimeEnabledFeatures::setLocalStorageEnabled(enable); 139 } 140 141 void WebRuntimeFeatures::enableMediaPlayer(bool enable) 142 { 143 RuntimeEnabledFeatures::setMediaEnabled(enable); 144 } 145 146 void WebRuntimeFeatures::enableSubpixelFontScaling(bool enable) 147 { 148 RuntimeEnabledFeatures::setSubpixelFontScalingEnabled(enable); 149 } 150 151 void WebRuntimeFeatures::enableMediaCapture(bool enable) 152 { 153 RuntimeEnabledFeatures::setMediaCaptureEnabled(enable); 154 } 155 156 void WebRuntimeFeatures::enableMediaSource(bool enable) 157 { 158 RuntimeEnabledFeatures::setMediaSourceEnabled(enable); 159 } 160 161 void WebRuntimeFeatures::enableMediaStream(bool enable) 162 { 163 RuntimeEnabledFeatures::setMediaStreamEnabled(enable); 164 } 165 166 void WebRuntimeFeatures::enableNotifications(bool enable) 167 { 168 RuntimeEnabledFeatures::setNotificationsEnabled(enable); 169 } 170 171 void WebRuntimeFeatures::enableNavigatorContentUtils(bool enable) 172 { 173 RuntimeEnabledFeatures::setNavigatorContentUtilsEnabled(enable); 174 } 175 176 void WebRuntimeFeatures::enableNavigationTransitions(bool enable) 177 { 178 RuntimeEnabledFeatures::setNavigationTransitionsEnabled(enable); 179 } 180 181 void WebRuntimeFeatures::enableNetworkInformation(bool enable) 182 { 183 RuntimeEnabledFeatures::setNetworkInformationEnabled(enable); 184 } 185 186 void WebRuntimeFeatures::enableOrientationEvent(bool enable) 187 { 188 RuntimeEnabledFeatures::setOrientationEventEnabled(enable); 189 } 190 191 void WebRuntimeFeatures::enablePagePopup(bool enable) 192 { 193 RuntimeEnabledFeatures::setPagePopupEnabled(enable); 194 } 195 196 void WebRuntimeFeatures::enablePeerConnection(bool enable) 197 { 198 RuntimeEnabledFeatures::setPeerConnectionEnabled(enable); 199 } 200 201 void WebRuntimeFeatures::enableRequestAutocomplete(bool enable) 202 { 203 RuntimeEnabledFeatures::setRequestAutocompleteEnabled(enable); 204 } 205 206 void WebRuntimeFeatures::enableScreenOrientation(bool enable) 207 { 208 RuntimeEnabledFeatures::setScreenOrientationEnabled(enable); 209 } 210 211 void WebRuntimeFeatures::enableScriptedSpeech(bool enable) 212 { 213 RuntimeEnabledFeatures::setScriptedSpeechEnabled(enable); 214 } 215 216 void WebRuntimeFeatures::enableServiceWorker(bool enable) 217 { 218 RuntimeEnabledFeatures::setServiceWorkerEnabled(enable); 219 } 220 221 void WebRuntimeFeatures::enableSessionStorage(bool enable) 222 { 223 RuntimeEnabledFeatures::setSessionStorageEnabled(enable); 224 } 225 226 void WebRuntimeFeatures::enableTouch(bool enable) 227 { 228 RuntimeEnabledFeatures::setTouchEnabled(enable); 229 } 230 231 void WebRuntimeFeatures::enableTouchIconLoading(bool enable) 232 { 233 RuntimeEnabledFeatures::setTouchIconLoadingEnabled(enable); 234 } 235 236 void WebRuntimeFeatures::enableWebAudio(bool enable) 237 { 238 RuntimeEnabledFeatures::setWebAudioEnabled(enable); 239 } 240 241 void WebRuntimeFeatures::enableWebGLDraftExtensions(bool enable) 242 { 243 RuntimeEnabledFeatures::setWebGLDraftExtensionsEnabled(enable); 244 } 245 246 void WebRuntimeFeatures::enableWebGLImageChromium(bool enable) 247 { 248 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(enable); 249 } 250 251 void WebRuntimeFeatures::enableWebMIDI(bool enable) 252 { 253 return RuntimeEnabledFeatures::setWebMIDIEnabled(enable); 254 } 255 256 void WebRuntimeFeatures::enableXSLT(bool enable) 257 { 258 RuntimeEnabledFeatures::setXSLTEnabled(enable); 259 } 260 261 void WebRuntimeFeatures::enableOverlayScrollbars(bool enable) 262 { 263 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(enable); 264 } 265 266 void WebRuntimeFeatures::enableOverlayFullscreenVideo(bool enable) 267 { 268 RuntimeEnabledFeatures::setOverlayFullscreenVideoEnabled(enable); 269 } 270 271 void WebRuntimeFeatures::enableSharedWorker(bool enable) 272 { 273 RuntimeEnabledFeatures::setSharedWorkerEnabled(enable); 274 } 275 276 void WebRuntimeFeatures::enablePreciseMemoryInfo(bool enable) 277 { 278 RuntimeEnabledFeatures::setPreciseMemoryInfoEnabled(enable); 279 } 280 281 void WebRuntimeFeatures::enableLayerSquashing(bool enable) 282 { 283 RuntimeEnabledFeatures::setLayerSquashingEnabled(enable); 284 } 285 286 void WebRuntimeFeatures::enableShowModalDialog(bool enable) 287 { 288 RuntimeEnabledFeatures::setShowModalDialogEnabled(enable); 289 } 290 291 void WebRuntimeFeatures::enableLaxMixedContentChecking(bool enable) 292 { 293 RuntimeEnabledFeatures::setLaxMixedContentCheckingEnabled(enable); 294 } 295 296 } // namespace blink 297