Mouse Lock: Renaming to 'Pointer Lock': ENABLE Flags
[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(MEDIA_STREAM)
60 bool RuntimeEnabledFeatures::isMediaStreamEnabled = true;
61 #endif
62
63 #if ENABLE(GAMEPAD)
64 bool RuntimeEnabledFeatures::isGamepadEnabled = false;
65 #endif
66
67 #if ENABLE(XHR_RESPONSE_BLOB)
68 bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false;
69 #endif
70
71 #if ENABLE(FILE_SYSTEM)
72 bool RuntimeEnabledFeatures::isFileSystemEnabled = false;
73
74 bool RuntimeEnabledFeatures::fileSystemEnabled()
75 {
76     return isFileSystemEnabled && AsyncFileSystem::isAvailable();
77 }
78 #endif
79
80 #if ENABLE(JAVASCRIPT_I18N_API)
81 bool RuntimeEnabledFeatures::isJavaScriptI18NAPIEnabled = false;
82
83 bool RuntimeEnabledFeatures::javaScriptI18NAPIEnabled()
84 {
85     return isJavaScriptI18NAPIEnabled;
86 }
87 #endif
88
89 #if ENABLE(VIDEO)
90
91 bool RuntimeEnabledFeatures::audioEnabled()
92 {
93     return MediaPlayer::isAvailable();
94 }
95
96 bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
97 {
98     return MediaPlayer::isAvailable();
99 }
100
101 bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
102 {
103     return MediaPlayer::isAvailable();
104 }
105
106 bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
107 {
108     return MediaPlayer::isAvailable();
109 }
110
111 bool RuntimeEnabledFeatures::htmlSourceElementEnabled()
112 {
113     return MediaPlayer::isAvailable();
114 }
115
116 bool RuntimeEnabledFeatures::mediaControllerEnabled()
117 {
118     return MediaPlayer::isAvailable();
119 }
120
121 bool RuntimeEnabledFeatures::mediaErrorEnabled()
122 {
123     return MediaPlayer::isAvailable();
124 }
125
126 bool RuntimeEnabledFeatures::timeRangesEnabled()
127 {
128     return MediaPlayer::isAvailable();
129 }
130
131 #endif
132
133 #if ENABLE(SHARED_WORKERS)
134 bool RuntimeEnabledFeatures::sharedWorkerEnabled()
135 {
136     return SharedWorkerRepository::isAvailable();
137 }
138 #endif
139
140 #if ENABLE(WEB_SOCKETS)
141 bool RuntimeEnabledFeatures::webSocketEnabled()
142 {
143     return WebSocket::isAvailable();
144 }
145 #endif
146
147 #if ENABLE(SQL_DATABASE)
148 bool RuntimeEnabledFeatures::openDatabaseEnabled()
149 {
150     return AbstractDatabase::isAvailable();
151 }
152
153 bool RuntimeEnabledFeatures::openDatabaseSyncEnabled()
154 {
155     return AbstractDatabase::isAvailable();
156 }
157 #endif
158
159 #if ENABLE(QUOTA)
160 bool RuntimeEnabledFeatures::isQuotaEnabled = false;
161 #endif
162
163 #if ENABLE(FULLSCREEN_API)
164 bool RuntimeEnabledFeatures::isFullScreenAPIEnabled = true;
165 #endif
166
167 #if ENABLE(POINTER_LOCK)
168 bool RuntimeEnabledFeatures::isMouseLockAPIEnabled = false;
169 #endif
170
171 #if ENABLE(MEDIA_SOURCE)
172 bool RuntimeEnabledFeatures::isMediaSourceEnabled = false;
173 #endif
174
175 #if ENABLE(VIDEO_TRACK)
176 bool RuntimeEnabledFeatures::isVideoTrackEnabled = false;
177 #endif
178
179 } // namespace WebCore