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(XHR_RESPONSE_BLOB)
64 bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false;
65 #endif
66
67 #if ENABLE(FILE_SYSTEM)
68 bool RuntimeEnabledFeatures::isFileSystemEnabled = false;
69
fileSystemEnabled()70 bool RuntimeEnabledFeatures::fileSystemEnabled()
71 {
72 return isFileSystemEnabled && AsyncFileSystem::isAvailable();
73 }
74 #endif
75
76 #if ENABLE(JAVASCRIPT_I18N_API)
77 bool RuntimeEnabledFeatures::isJavaScriptI18NAPIEnabled = false;
78
javaScriptI18NAPIEnabled()79 bool RuntimeEnabledFeatures::javaScriptI18NAPIEnabled()
80 {
81 return isJavaScriptI18NAPIEnabled;
82 }
83 #endif
84
85 #if ENABLE(VIDEO)
86
audioEnabled()87 bool RuntimeEnabledFeatures::audioEnabled()
88 {
89 return MediaPlayer::isAvailable();
90 }
91
htmlMediaElementEnabled()92 bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
93 {
94 return MediaPlayer::isAvailable();
95 }
96
htmlAudioElementEnabled()97 bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
98 {
99 return MediaPlayer::isAvailable();
100 }
101
htmlVideoElementEnabled()102 bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
103 {
104 return MediaPlayer::isAvailable();
105 }
106
mediaErrorEnabled()107 bool RuntimeEnabledFeatures::mediaErrorEnabled()
108 {
109 return MediaPlayer::isAvailable();
110 }
111
timeRangesEnabled()112 bool RuntimeEnabledFeatures::timeRangesEnabled()
113 {
114 return MediaPlayer::isAvailable();
115 }
116
117 #endif
118
119 #if ENABLE(SHARED_WORKERS)
sharedWorkerEnabled()120 bool RuntimeEnabledFeatures::sharedWorkerEnabled()
121 {
122 return SharedWorkerRepository::isAvailable();
123 }
124 #endif
125
126 #if ENABLE(WEB_SOCKETS)
webSocketEnabled()127 bool RuntimeEnabledFeatures::webSocketEnabled()
128 {
129 return WebSocket::isAvailable();
130 }
131 #endif
132
133 #if ENABLE(DATABASE)
openDatabaseEnabled()134 bool RuntimeEnabledFeatures::openDatabaseEnabled()
135 {
136 return AbstractDatabase::isAvailable();
137 }
138
openDatabaseSyncEnabled()139 bool RuntimeEnabledFeatures::openDatabaseSyncEnabled()
140 {
141 return AbstractDatabase::isAvailable();
142 }
143 #endif
144
145 #if ENABLE(QUOTA)
146 bool RuntimeEnabledFeatures::isQuotaEnabled = false;
147 #endif
148
149 } // namespace WebCore
150