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