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