OLD | NEW |
| (Empty) |
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 "WebRuntimeFeatures.h" | |
33 | |
34 #include "RuntimeEnabledFeatures.h" | |
35 #include "WebMediaPlayerClientImpl.h" | |
36 #include "WebSocket.h" | |
37 | |
38 using namespace WebCore; | |
39 | |
40 namespace WebKit { | |
41 | |
42 void WebRuntimeFeatures::enableDatabase(bool enable) | |
43 { | |
44 #if ENABLE(DATABASE) | |
45 RuntimeEnabledFeatures::setDatabaseEnabled(enable); | |
46 #endif | |
47 } | |
48 | |
49 bool WebRuntimeFeatures::isDatabaseEnabled() | |
50 { | |
51 #if ENABLE(DATABASE) | |
52 return RuntimeEnabledFeatures::databaseEnabled(); | |
53 #else | |
54 return false; | |
55 #endif | |
56 } | |
57 | |
58 void WebRuntimeFeatures::enableLocalStorage(bool enable) | |
59 { | |
60 #if ENABLE(DOM_STORAGE) | |
61 RuntimeEnabledFeatures::setLocalStorageEnabled(enable); | |
62 #endif | |
63 } | |
64 | |
65 bool WebRuntimeFeatures::isLocalStorageEnabled() | |
66 { | |
67 #if ENABLE(DOM_STORAGE) | |
68 return RuntimeEnabledFeatures::localStorageEnabled(); | |
69 #else | |
70 return false; | |
71 #endif | |
72 } | |
73 | |
74 void WebRuntimeFeatures::enableSessionStorage(bool enable) | |
75 { | |
76 #if ENABLE(DOM_STORAGE) | |
77 RuntimeEnabledFeatures::setSessionStorageEnabled(enable); | |
78 #endif | |
79 } | |
80 | |
81 bool WebRuntimeFeatures::isSessionStorageEnabled() | |
82 { | |
83 #if ENABLE(DOM_STORAGE) | |
84 return RuntimeEnabledFeatures::sessionStorageEnabled(); | |
85 #else | |
86 return false; | |
87 #endif | |
88 } | |
89 | |
90 void WebRuntimeFeatures::enableMediaPlayer(bool enable) | |
91 { | |
92 #if ENABLE(VIDEO) | |
93 WebMediaPlayerClientImpl::setIsEnabled(enable); | |
94 #endif | |
95 } | |
96 | |
97 bool WebRuntimeFeatures::isMediaPlayerEnabled() | |
98 { | |
99 #if ENABLE(VIDEO) | |
100 return WebMediaPlayerClientImpl::isEnabled(); | |
101 #else | |
102 return false; | |
103 #endif | |
104 } | |
105 | |
106 void WebRuntimeFeatures::enableSockets(bool enable) | |
107 { | |
108 #if ENABLE(WEB_SOCKETS) | |
109 WebSocket::setIsAvailable(enable); | |
110 #endif | |
111 } | |
112 | |
113 bool WebRuntimeFeatures::isSocketsEnabled() | |
114 { | |
115 #if ENABLE(WEB_SOCKETS) | |
116 return WebSocket::isAvailable(); | |
117 #else | |
118 return false; | |
119 #endif | |
120 } | |
121 | |
122 void WebRuntimeFeatures::enableNotifications(bool enable) | |
123 { | |
124 #if ENABLE(NOTIFICATIONS) | |
125 RuntimeEnabledFeatures::setNotificationsEnabled(enable); | |
126 #endif | |
127 } | |
128 | |
129 bool WebRuntimeFeatures::isNotificationsEnabled() | |
130 { | |
131 #if ENABLE(NOTIFICATIONS) | |
132 return RuntimeEnabledFeatures::notificationsEnabled(); | |
133 #else | |
134 return false; | |
135 #endif | |
136 } | |
137 | |
138 void WebRuntimeFeatures::enableApplicationCache(bool enable) | |
139 { | |
140 #if ENABLE(OFFLINE_WEB_APPLICATIONS) | |
141 RuntimeEnabledFeatures::setApplicationCacheEnabled(enable); | |
142 #endif | |
143 } | |
144 | |
145 bool WebRuntimeFeatures::isApplicationCacheEnabled() | |
146 { | |
147 #if ENABLE(OFFLINE_WEB_APPLICATIONS) | |
148 return RuntimeEnabledFeatures::applicationCacheEnabled(); | |
149 #else | |
150 return false; | |
151 #endif | |
152 } | |
153 | |
154 } // namespace WebKit | |
OLD | NEW |