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