2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
31 #ifndef RuntimeEnabledFeatures_h
32 #define RuntimeEnabledFeatures_h
36 // A class that stores static enablers for all experimental features. Note that
37 // the method names must line up with the JavaScript method they enable for code
38 // generation to work properly.
40 class RuntimeEnabledFeatures {
42 static void setLocalStorageEnabled(bool isEnabled) { isLocalStorageEnabled = isEnabled; }
43 static bool localStorageEnabled() { return isLocalStorageEnabled; }
45 static void setSessionStorageEnabled(bool isEnabled) { isSessionStorageEnabled = isEnabled; }
46 static bool sessionStorageEnabled() { return isSessionStorageEnabled; }
48 static void setWebkitNotificationsEnabled(bool isEnabled) { isWebkitNotificationsEnabled = isEnabled; }
49 static bool webkitNotificationsEnabled() { return isWebkitNotificationsEnabled; }
51 static void setApplicationCacheEnabled(bool isEnabled) { isApplicationCacheEnabled = isEnabled; }
52 static bool applicationCacheEnabled() { return isApplicationCacheEnabled; }
54 static void setDataTransferItemsEnabled(bool isEnabled) { isDataTransferItemsEnabled = isEnabled; }
55 static bool dataTransferItemsEnabled() { return isDataTransferItemsEnabled; }
57 static void setGeolocationEnabled(bool isEnabled) { isGeolocationEnabled = isEnabled; }
58 static bool geolocationEnabled() { return isGeolocationEnabled; }
60 static void setWebkitIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
61 static bool webkitIndexedDBEnabled() { return isIndexedDBEnabled; }
62 static bool webkitIDBCursorEnabled() { return isIndexedDBEnabled; }
63 static bool webkitIDBDatabaseEnabled() { return isIndexedDBEnabled; }
64 static bool webkitIDBDatabaseErrorEnabled() { return isIndexedDBEnabled; }
65 static bool webkitIDBDatabaseExceptionEnabled() { return isIndexedDBEnabled; }
66 static bool webkitIDBFactoryEnabled() { return isIndexedDBEnabled; }
67 static bool webkitIDBIndexEnabled() { return isIndexedDBEnabled; }
68 static bool webkitIDBKeyRangeEnabled() { return isIndexedDBEnabled; }
69 static bool webkitIDBObjectStoreEnabled() { return isIndexedDBEnabled; }
70 static bool webkitIDBRequestEnabled() { return isIndexedDBEnabled; }
71 static bool webkitIDBTransactionEnabled() { return isIndexedDBEnabled; }
73 #if ENABLE(FULLSCREEN_API)
74 static bool webkitFullScreenAPIEnabled() { return isFullScreenAPIEnabled; }
75 static void setWebkitFullScreenAPIEnabled(bool isEnabled) { isFullScreenAPIEnabled = isEnabled; }
76 static bool webkitRequestFullScreenEnabled() { return isFullScreenAPIEnabled; }
77 static bool webkitIsFullScreenEnabled() { return isFullScreenAPIEnabled; }
78 static bool webkitFullScreenKeyboardInputAllowedEnabled() { return isFullScreenAPIEnabled; }
79 static bool webkitCurrentFullScreenElementEnabled() { return isFullScreenAPIEnabled; }
80 static bool webkitCancelFullScreenEnabled() { return isFullScreenAPIEnabled; }
84 static bool audioEnabled();
85 static bool htmlMediaElementEnabled();
86 static bool htmlAudioElementEnabled();
87 static bool htmlVideoElementEnabled();
88 static bool htmlSourceElementEnabled();
89 static bool mediaErrorEnabled();
90 static bool timeRangesEnabled();
93 #if ENABLE(SHARED_WORKERS)
94 static bool sharedWorkerEnabled();
97 #if ENABLE(WEB_SOCKETS)
98 static bool webSocketEnabled();
102 static bool openDatabaseEnabled();
103 static bool openDatabaseSyncEnabled();
106 #if ENABLE(WEB_AUDIO)
107 static void setWebkitAudioContextEnabled(bool isEnabled) { isWebAudioEnabled = isEnabled; }
108 static bool webkitAudioContextEnabled() { return isWebAudioEnabled; }
111 static void setPushStateEnabled(bool isEnabled) { isPushStateEnabled = isEnabled; }
112 static bool pushStateEnabled() { return isPushStateEnabled; }
113 static bool replaceStateEnabled() { return isPushStateEnabled; }
115 #if ENABLE(TOUCH_EVENTS)
116 static bool touchEnabled() { return isTouchEnabled; }
117 static void setTouchEnabled(bool isEnabled) { isTouchEnabled = isEnabled; }
118 static bool ontouchstartEnabled() { return isTouchEnabled; }
119 static bool ontouchmoveEnabled() { return isTouchEnabled; }
120 static bool ontouchendEnabled() { return isTouchEnabled; }
121 static bool ontouchcancelEnabled() { return isTouchEnabled; }
122 static bool createTouchEnabled() { return isTouchEnabled; }
123 static bool createTouchListEnabled() { return isTouchEnabled; }
126 static void setDeviceMotionEnabled(bool isEnabled) { isDeviceMotionEnabled = isEnabled; }
127 static bool deviceMotionEnabled() { return isDeviceMotionEnabled; }
128 static bool deviceMotionEventEnabled() { return isDeviceMotionEnabled; }
129 static bool ondevicemotionEnabled() { return isDeviceMotionEnabled; }
131 static void setDeviceOrientationEnabled(bool isEnabled) { isDeviceOrientationEnabled = isEnabled; }
132 static bool deviceOrientationEnabled() { return isDeviceOrientationEnabled; }
133 static bool deviceOrientationEventEnabled() { return isDeviceOrientationEnabled; }
134 static bool ondeviceorientationEnabled() { return isDeviceOrientationEnabled; }
136 static void setSpeechInputEnabled(bool isEnabled) { isSpeechInputEnabled = isEnabled; }
137 static bool speechInputEnabled() { return isSpeechInputEnabled; }
138 static bool webkitSpeechEnabled() { return isSpeechInputEnabled; }
139 static bool webkitGrammarEnabled() { return isSpeechInputEnabled; }
141 #if ENABLE(XHR_RESPONSE_BLOB)
142 static bool xhrResponseBlobEnabled() { return isXHRResponseBlobEnabled; }
143 static void setXHRResponseBlobEnabled(bool isEnabled) { isXHRResponseBlobEnabled = isEnabled; }
144 static bool responseBlobEnabled() { return isXHRResponseBlobEnabled; }
145 static bool asBlobEnabled() { return isXHRResponseBlobEnabled; }
148 #if ENABLE(FILE_SYSTEM)
149 static bool fileSystemEnabled();
150 static void setFileSystemEnabled(bool isEnabled) { isFileSystemEnabled = isEnabled; }
153 #if ENABLE(JAVASCRIPT_I18N_API)
154 static bool javaScriptI18NAPIEnabled();
155 static void setJavaScriptI18NAPIEnabled(bool isEnabled) { isJavaScriptI18NAPIEnabled = isEnabled; }
158 #if ENABLE(MEDIA_STREAM)
159 static bool mediaStreamEnabled() { return isMediaStreamEnabled; }
160 static void setMediaStreamEnabled(bool isEnabled) { isMediaStreamEnabled = isEnabled; }
161 static bool webkitGetUserMediaEnabled() { return isMediaStreamEnabled; }
162 static bool webkitPeerConnectionEnabled() { return isMediaStreamEnabled; }
166 static bool quotaEnabled() { return isQuotaEnabled; }
167 static void setQuotaEnabled(bool isEnabled) { isQuotaEnabled = isEnabled; }
170 #if ENABLE(MEDIA_SOURCE)
171 static bool webkitMediaSourceEnabled() { return isMediaSourceEnabled; }
172 static void setWebkitMediaSourceEnabled(bool isEnabled) { isMediaSourceEnabled = isEnabled; }
176 // Never instantiate.
177 RuntimeEnabledFeatures() { }
179 static bool isLocalStorageEnabled;
180 static bool isSessionStorageEnabled;
181 static bool isWebkitNotificationsEnabled;
182 static bool isApplicationCacheEnabled;
183 static bool isDataTransferItemsEnabled;
184 static bool isGeolocationEnabled;
185 static bool isIndexedDBEnabled;
186 static bool isWebAudioEnabled;
187 static bool isPushStateEnabled;
188 static bool isTouchEnabled;
189 static bool isDeviceMotionEnabled;
190 static bool isDeviceOrientationEnabled;
191 static bool isSpeechInputEnabled;
192 #if ENABLE(XHR_RESPONSE_BLOB)
193 static bool isXHRResponseBlobEnabled;
196 #if ENABLE(FILE_SYSTEM)
197 static bool isFileSystemEnabled;
200 #if ENABLE(JAVASCRIPT_I18N_API)
201 static bool isJavaScriptI18NAPIEnabled;
204 #if ENABLE(MEDIA_STREAM)
205 static bool isMediaStreamEnabled;
209 static bool isQuotaEnabled;
212 #if ENABLE(FULLSCREEN_API)
213 static bool isFullScreenAPIEnabled;
216 #if ENABLE(MEDIA_SOURCE)
217 static bool isMediaSourceEnabled;
221 } // namespace WebCore
223 #endif // RuntimeEnabledFeatures_h