initial import
[vuplus_webkit] / Source / WebCore / bindings / generic / RuntimeEnabledFeatures.h
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 #ifndef RuntimeEnabledFeatures_h
32 #define RuntimeEnabledFeatures_h
33
34 namespace WebCore {
35
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.
39
40 class RuntimeEnabledFeatures {
41 public:
42     static void setLocalStorageEnabled(bool isEnabled) { isLocalStorageEnabled = isEnabled; }
43     static bool localStorageEnabled() { return isLocalStorageEnabled; }
44
45     static void setSessionStorageEnabled(bool isEnabled) { isSessionStorageEnabled = isEnabled; }
46     static bool sessionStorageEnabled() { return isSessionStorageEnabled; }
47
48     static void setWebkitNotificationsEnabled(bool isEnabled) { isWebkitNotificationsEnabled = isEnabled; }
49     static bool webkitNotificationsEnabled() { return isWebkitNotificationsEnabled; }
50
51     static void setApplicationCacheEnabled(bool isEnabled) { isApplicationCacheEnabled = isEnabled; }
52     static bool applicationCacheEnabled() { return isApplicationCacheEnabled; }
53
54     static void setDataTransferItemsEnabled(bool isEnabled) { isDataTransferItemsEnabled = isEnabled; }
55     static bool dataTransferItemsEnabled() { return isDataTransferItemsEnabled; }
56
57     static void setGeolocationEnabled(bool isEnabled) { isGeolocationEnabled = isEnabled; }
58     static bool geolocationEnabled() { return isGeolocationEnabled; }
59
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; }
72
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; }
81 #endif
82
83 #if ENABLE(VIDEO)
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();
91 #endif
92
93 #if ENABLE(SHARED_WORKERS)
94     static bool sharedWorkerEnabled();
95 #endif
96
97 #if ENABLE(WEB_SOCKETS)
98     static bool webSocketEnabled();
99 #endif
100
101 #if ENABLE(DATABASE)
102     static bool openDatabaseEnabled();
103     static bool openDatabaseSyncEnabled();
104 #endif
105
106 #if ENABLE(WEB_AUDIO)
107     static void setWebkitAudioContextEnabled(bool isEnabled) { isWebAudioEnabled = isEnabled; }
108     static bool webkitAudioContextEnabled() { return isWebAudioEnabled; }
109 #endif
110
111     static void setPushStateEnabled(bool isEnabled) { isPushStateEnabled = isEnabled; }
112     static bool pushStateEnabled() { return isPushStateEnabled; }
113     static bool replaceStateEnabled() { return isPushStateEnabled; }
114
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; }
124 #endif
125
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; }
130     
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; }
135
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; }
140
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; }
146 #endif
147
148 #if ENABLE(FILE_SYSTEM)
149     static bool fileSystemEnabled();
150     static void setFileSystemEnabled(bool isEnabled) { isFileSystemEnabled = isEnabled; }
151 #endif
152
153 #if ENABLE(JAVASCRIPT_I18N_API)
154     static bool javaScriptI18NAPIEnabled();
155     static void setJavaScriptI18NAPIEnabled(bool isEnabled) { isJavaScriptI18NAPIEnabled = isEnabled; }
156 #endif
157
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; }
163 #endif
164
165 #if ENABLE(QUOTA)
166     static bool quotaEnabled() { return isQuotaEnabled; }
167     static void setQuotaEnabled(bool isEnabled) { isQuotaEnabled = isEnabled; }
168 #endif
169
170 #if ENABLE(MEDIA_SOURCE)
171     static bool webkitMediaSourceEnabled() { return isMediaSourceEnabled; }
172     static void setWebkitMediaSourceEnabled(bool isEnabled) { isMediaSourceEnabled = isEnabled; }
173 #endif
174
175 private:
176     // Never instantiate.
177     RuntimeEnabledFeatures() { }
178
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;
194 #endif
195
196 #if ENABLE(FILE_SYSTEM)
197     static bool isFileSystemEnabled;
198 #endif
199
200 #if ENABLE(JAVASCRIPT_I18N_API)
201     static bool isJavaScriptI18NAPIEnabled;
202 #endif
203
204 #if ENABLE(MEDIA_STREAM)
205     static bool isMediaStreamEnabled;
206 #endif
207
208 #if ENABLE(QUOTA)
209     static bool isQuotaEnabled;
210 #endif
211
212 #if ENABLE(FULLSCREEN_API)
213     static bool isFullScreenAPIEnabled;
214 #endif
215
216 #if ENABLE(MEDIA_SOURCE)
217     static bool isMediaSourceEnabled;
218 #endif
219 };
220
221 } // namespace WebCore
222
223 #endif // RuntimeEnabledFeatures_h