Move WebCore into Source
[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::isGeolocationEnabled = true;
50 bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
51 bool RuntimeEnabledFeatures::isWebGLEnabled = false;
52 bool RuntimeEnabledFeatures::isPushStateEnabled = false;
53 bool RuntimeEnabledFeatures::isTouchEnabled = true;
54 bool RuntimeEnabledFeatures::isDeviceMotionEnabled = true;
55 bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true;
56 bool RuntimeEnabledFeatures::isSpeechInputEnabled = true;
57
58 #if ENABLE(XHR_RESPONSE_BLOB)
59 bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false;
60 #endif
61
62 #if ENABLE(FILE_SYSTEM)
63 bool RuntimeEnabledFeatures::isFileSystemEnabled = false;
64
65 bool RuntimeEnabledFeatures::fileSystemEnabled()
66 {
67     return isFileSystemEnabled && AsyncFileSystem::isAvailable();
68 }
69 #endif
70
71 #if ENABLE(VIDEO)
72
73 bool RuntimeEnabledFeatures::audioEnabled()
74 {
75     return MediaPlayer::isAvailable();
76 }
77
78 bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
79 {
80     return MediaPlayer::isAvailable();
81 }
82
83 bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
84 {
85     return MediaPlayer::isAvailable();
86 }
87
88 bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
89 {
90     return MediaPlayer::isAvailable();
91 }
92
93 bool RuntimeEnabledFeatures::mediaErrorEnabled()
94 {
95     return MediaPlayer::isAvailable();
96 }
97
98 bool RuntimeEnabledFeatures::timeRangesEnabled()
99 {
100     return MediaPlayer::isAvailable();
101 }
102
103 #endif
104
105 #if ENABLE(SHARED_WORKERS)
106 bool RuntimeEnabledFeatures::sharedWorkerEnabled()
107 {
108     return SharedWorkerRepository::isAvailable();
109 }
110 #endif
111
112 #if ENABLE(WEB_SOCKETS)
113 bool RuntimeEnabledFeatures::webSocketEnabled()
114 {
115     return WebSocket::isAvailable();
116 }
117 #endif
118
119 #if ENABLE(DATABASE)
120 bool RuntimeEnabledFeatures::openDatabaseEnabled()
121 {
122     return AbstractDatabase::isAvailable();
123 }
124
125 bool RuntimeEnabledFeatures::openDatabaseSyncEnabled()
126 {
127     return AbstractDatabase::isAvailable();
128 }
129 #endif
130
131 } // namespace WebCore