c7c19bfed41e769de3bdc3d045d08364b873c1fd
[WebKit-https.git] / Source / WebCore / bindings / generic / RuntimeEnabledFeatures.cpp
1 /*
2  * Copyright (C) 2009 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 "RuntimeEnabledFeatures.h"
33
34 #include "DatabaseManager.h"
35 #include "MediaPlayer.h"
36 #include "SharedWorkerRepository.h"
37 #include "WebSocket.h"
38
39 #if ENABLE(FILE_SYSTEM)
40 #include "AsyncFileSystem.h"
41 #endif
42
43 namespace WebCore {
44
45 bool RuntimeEnabledFeatures::isLocalStorageEnabled = true;
46 bool RuntimeEnabledFeatures::isSessionStorageEnabled = true;
47 bool RuntimeEnabledFeatures::isWebkitNotificationsEnabled = false;
48 bool RuntimeEnabledFeatures::isApplicationCacheEnabled = true;
49 bool RuntimeEnabledFeatures::isDataTransferItemsEnabled = true;
50 bool RuntimeEnabledFeatures::isGeolocationEnabled = true;
51 bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
52 bool RuntimeEnabledFeatures::isWebAudioEnabled = false;
53 bool RuntimeEnabledFeatures::isTouchEnabled = true;
54 bool RuntimeEnabledFeatures::isDeviceMotionEnabled = true;
55 bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true;
56 bool RuntimeEnabledFeatures::isSpeechInputEnabled = true;
57 bool RuntimeEnabledFeatures::isCanvasPathEnabled = false;
58 bool RuntimeEnabledFeatures::isCSSExclusionsEnabled = false;
59 bool RuntimeEnabledFeatures::isCSSRegionsEnabled = false;
60 bool RuntimeEnabledFeatures::isCSSCompositingEnabled = false;
61 bool RuntimeEnabledFeatures::isLangAttributeAwareFormControlUIEnabled = false;
62
63 #if ENABLE(SCRIPTED_SPEECH)
64 bool RuntimeEnabledFeatures::isScriptedSpeechEnabled = false;
65 #endif
66
67 #if ENABLE(MEDIA_STREAM)
68 bool RuntimeEnabledFeatures::isMediaStreamEnabled = true;
69 bool RuntimeEnabledFeatures::isPeerConnectionEnabled = true;
70 #endif
71
72 #if ENABLE(LEGACY_CSS_VENDOR_PREFIXES)
73 bool RuntimeEnabledFeatures::isLegacyCSSVendorPrefixesEnabled = false;
74 #endif
75
76 #if ENABLE(GAMEPAD)
77 bool RuntimeEnabledFeatures::isGamepadEnabled = false;
78 #endif
79
80 #if ENABLE(FILE_SYSTEM)
81 bool RuntimeEnabledFeatures::isFileSystemEnabled = false;
82
83 bool RuntimeEnabledFeatures::fileSystemEnabled()
84 {
85     return isFileSystemEnabled && AsyncFileSystem::isAvailable();
86 }
87 #endif
88
89 #if ENABLE(JAVASCRIPT_I18N_API)
90 bool RuntimeEnabledFeatures::isJavaScriptI18NAPIEnabled = false;
91
92 bool RuntimeEnabledFeatures::javaScriptI18NAPIEnabled()
93 {
94     return isJavaScriptI18NAPIEnabled;
95 }
96 #endif
97
98 #if ENABLE(VIDEO)
99
100 bool RuntimeEnabledFeatures::audioEnabled()
101 {
102     return MediaPlayer::isAvailable();
103 }
104
105 bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
106 {
107     return MediaPlayer::isAvailable();
108 }
109
110 bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
111 {
112     return MediaPlayer::isAvailable();
113 }
114
115 bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
116 {
117     return MediaPlayer::isAvailable();
118 }
119
120 bool RuntimeEnabledFeatures::htmlSourceElementEnabled()
121 {
122     return MediaPlayer::isAvailable();
123 }
124
125 bool RuntimeEnabledFeatures::mediaControllerEnabled()
126 {
127     return MediaPlayer::isAvailable();
128 }
129
130 bool RuntimeEnabledFeatures::mediaErrorEnabled()
131 {
132     return MediaPlayer::isAvailable();
133 }
134
135 bool RuntimeEnabledFeatures::timeRangesEnabled()
136 {
137     return MediaPlayer::isAvailable();
138 }
139
140 #endif
141
142 #if ENABLE(SHARED_WORKERS)
143 bool RuntimeEnabledFeatures::sharedWorkerEnabled()
144 {
145     return SharedWorkerRepository::isAvailable();
146 }
147 #endif
148
149 #if ENABLE(WEB_SOCKETS)
150 bool RuntimeEnabledFeatures::webSocketEnabled()
151 {
152     return WebSocket::isAvailable();
153 }
154 #endif
155
156 #if ENABLE(SQL_DATABASE)
157 bool RuntimeEnabledFeatures::openDatabaseEnabled()
158 {
159     return DatabaseManager::manager().isAvailable();
160 }
161
162 bool RuntimeEnabledFeatures::openDatabaseSyncEnabled()
163 {
164     return DatabaseManager::manager().isAvailable();
165 }
166 #endif
167
168 #if ENABLE(QUOTA)
169 bool RuntimeEnabledFeatures::isQuotaEnabled = false;
170 #endif
171
172 #if ENABLE(FULLSCREEN_API)
173 bool RuntimeEnabledFeatures::isFullScreenAPIEnabled = true;
174 #endif
175
176 #if ENABLE(MEDIA_SOURCE)
177 bool RuntimeEnabledFeatures::isMediaSourceEnabled = false;
178 #endif
179
180 #if ENABLE(VIDEO_TRACK)
181 #if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) || PLATFORM(WIN)
182     bool RuntimeEnabledFeatures::isVideoTrackEnabled = true;
183 #else
184     bool RuntimeEnabledFeatures::isVideoTrackEnabled = false;
185 #endif
186 #endif
187
188 #if ENABLE(ENCRYPTED_MEDIA)
189 bool RuntimeEnabledFeatures::isEncryptedMediaEnabled = false;
190 #endif
191
192 #if ENABLE(SHADOW_DOM)
193 bool RuntimeEnabledFeatures::isShadowDOMEnabled = false;
194
195 bool RuntimeEnabledFeatures::isAuthorShadowDOMForAnyElementEnabled = false;
196 #endif
197
198 #if ENABLE(CUSTOM_ELEMENTS)
199 bool RuntimeEnabledFeatures::isCustomDOMElementsEnabled = false;
200 #endif
201
202 #if ENABLE(STYLE_SCOPED)
203 bool RuntimeEnabledFeatures::isStyleScopedEnabled = false;
204 #endif
205
206 #if ENABLE(INPUT_TYPE_DATE)
207 bool RuntimeEnabledFeatures::isInputTypeDateEnabled = true;
208 #endif
209
210 #if ENABLE(INPUT_TYPE_DATETIME_INCOMPLETE)
211 bool RuntimeEnabledFeatures::isInputTypeDateTimeEnabled = false;
212 #endif
213
214 #if ENABLE(INPUT_TYPE_DATETIMELOCAL)
215 bool RuntimeEnabledFeatures::isInputTypeDateTimeLocalEnabled = true;
216 #endif
217
218 #if ENABLE(INPUT_TYPE_MONTH)
219 bool RuntimeEnabledFeatures::isInputTypeMonthEnabled = true;
220 #endif
221
222 #if ENABLE(INPUT_TYPE_TIME)
223 bool RuntimeEnabledFeatures::isInputTypeTimeEnabled = true;
224 #endif
225
226 #if ENABLE(INPUT_TYPE_WEEK)
227 bool RuntimeEnabledFeatures::isInputTypeWeekEnabled = true;
228 #endif
229
230 #if ENABLE(DIALOG_ELEMENT)
231 bool RuntimeEnabledFeatures::isDialogElementEnabled = false;
232 #endif
233
234 #if ENABLE(REQUEST_AUTOCOMPLETE)
235 bool RuntimeEnabledFeatures::isRequestAutocompleteEnabled = false;
236 #endif
237
238 #if ENABLE(CSP_NEXT)
239 bool RuntimeEnabledFeatures::areExperimentalContentSecurityPolicyFeaturesEnabled = false;
240 #endif
241
242 #if ENABLE(IFRAME_SEAMLESS)
243 bool RuntimeEnabledFeatures::areSeamlessIFramesEnabled = false;
244 #endif
245
246 #if ENABLE(FONT_LOAD_EVENTS)
247 bool RuntimeEnabledFeatures::isFontLoadEventsEnabled = false;
248 #endif
249
250 } // namespace WebCore