b894eb2c49d9b7f8f333ed2d0dbff7dd233779ed
[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 "AbstractDatabase.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::isPushStateEnabled = false;
54 bool RuntimeEnabledFeatures::isTouchEnabled = true;
55 bool RuntimeEnabledFeatures::isDeviceMotionEnabled = true;
56 bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true;
57 bool RuntimeEnabledFeatures::isSpeechInputEnabled = true;
58
59 #if ENABLE(SCRIPTED_SPEECH)
60 bool RuntimeEnabledFeatures::isScriptedSpeechEnabled = false;
61 #endif
62
63 #if ENABLE(MEDIA_STREAM)
64 bool RuntimeEnabledFeatures::isMediaStreamEnabled = true;
65 #endif
66
67 #if ENABLE(GAMEPAD)
68 bool RuntimeEnabledFeatures::isGamepadEnabled = false;
69 #endif
70
71 #if ENABLE(XHR_RESPONSE_BLOB)
72 bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false;
73 #endif
74
75 #if ENABLE(FILE_SYSTEM)
76 bool RuntimeEnabledFeatures::isFileSystemEnabled = false;
77
78 bool RuntimeEnabledFeatures::fileSystemEnabled()
79 {
80     return isFileSystemEnabled && AsyncFileSystem::isAvailable();
81 }
82 #endif
83
84 #if ENABLE(JAVASCRIPT_I18N_API)
85 bool RuntimeEnabledFeatures::isJavaScriptI18NAPIEnabled = false;
86
87 bool RuntimeEnabledFeatures::javaScriptI18NAPIEnabled()
88 {
89     return isJavaScriptI18NAPIEnabled;
90 }
91 #endif
92
93 #if ENABLE(VIDEO)
94
95 bool RuntimeEnabledFeatures::audioEnabled()
96 {
97     return MediaPlayer::isAvailable();
98 }
99
100 bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
101 {
102     return MediaPlayer::isAvailable();
103 }
104
105 bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
106 {
107     return MediaPlayer::isAvailable();
108 }
109
110 bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
111 {
112     return MediaPlayer::isAvailable();
113 }
114
115 bool RuntimeEnabledFeatures::htmlSourceElementEnabled()
116 {
117     return MediaPlayer::isAvailable();
118 }
119
120 bool RuntimeEnabledFeatures::mediaControllerEnabled()
121 {
122     return MediaPlayer::isAvailable();
123 }
124
125 bool RuntimeEnabledFeatures::mediaErrorEnabled()
126 {
127     return MediaPlayer::isAvailable();
128 }
129
130 bool RuntimeEnabledFeatures::timeRangesEnabled()
131 {
132     return MediaPlayer::isAvailable();
133 }
134
135 #endif
136
137 #if ENABLE(SHARED_WORKERS)
138 bool RuntimeEnabledFeatures::sharedWorkerEnabled()
139 {
140     return SharedWorkerRepository::isAvailable();
141 }
142 #endif
143
144 #if ENABLE(WEB_SOCKETS)
145 bool RuntimeEnabledFeatures::webSocketEnabled()
146 {
147     return WebSocket::isAvailable();
148 }
149 #endif
150
151 #if ENABLE(SQL_DATABASE)
152 bool RuntimeEnabledFeatures::openDatabaseEnabled()
153 {
154     return AbstractDatabase::isAvailable();
155 }
156
157 bool RuntimeEnabledFeatures::openDatabaseSyncEnabled()
158 {
159     return AbstractDatabase::isAvailable();
160 }
161 #endif
162
163 #if ENABLE(QUOTA)
164 bool RuntimeEnabledFeatures::isQuotaEnabled = false;
165 #endif
166
167 #if ENABLE(FULLSCREEN_API)
168 bool RuntimeEnabledFeatures::isFullScreenAPIEnabled = true;
169 #endif
170
171 #if ENABLE(POINTER_LOCK)
172 bool RuntimeEnabledFeatures::isPointerLockEnabled = false;
173 #endif
174
175 #if ENABLE(MEDIA_SOURCE)
176 bool RuntimeEnabledFeatures::isMediaSourceEnabled = false;
177 #endif
178
179 #if ENABLE(VIDEO_TRACK)
180 #if PLATFORM(MAC) || PLATFORM(GTK)
181     bool RuntimeEnabledFeatures::isVideoTrackEnabled = true;
182 #else
183     bool RuntimeEnabledFeatures::isVideoTrackEnabled = false;
184 #endif
185 #endif
186
187 #if ENABLE(ENCRYPTED_MEDIA)
188 bool RuntimeEnabledFeatures::isEncryptedMediaEnabled = false;
189 #endif
190
191 #if ENABLE(SHADOW_DOM)
192 bool RuntimeEnabledFeatures::isShadowDOMEnabled = false;
193 #endif
194
195 #if ENABLE(STYLE_SCOPED)
196 bool RuntimeEnabledFeatures::isStyleScopedEnabled = false;
197 #endif
198
199 } // namespace WebCore