• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:
setLocalStorageEnabled(bool isEnabled)42     static void setLocalStorageEnabled(bool isEnabled) { isLocalStorageEnabled = isEnabled; }
localStorageEnabled()43     static bool localStorageEnabled() { return isLocalStorageEnabled; }
44 
setSessionStorageEnabled(bool isEnabled)45     static void setSessionStorageEnabled(bool isEnabled) { isSessionStorageEnabled = isEnabled; }
sessionStorageEnabled()46     static bool sessionStorageEnabled() { return isSessionStorageEnabled; }
47 
setWebkitNotificationsEnabled(bool isEnabled)48     static void setWebkitNotificationsEnabled(bool isEnabled) { isWebkitNotificationsEnabled = isEnabled; }
webkitNotificationsEnabled()49     static bool webkitNotificationsEnabled() { return isWebkitNotificationsEnabled; }
50 
setApplicationCacheEnabled(bool isEnabled)51     static void setApplicationCacheEnabled(bool isEnabled) { isApplicationCacheEnabled = isEnabled; }
applicationCacheEnabled()52     static bool applicationCacheEnabled() { return isApplicationCacheEnabled; }
53 
setGeolocationEnabled(bool isEnabled)54     static void setGeolocationEnabled(bool isEnabled) { isGeolocationEnabled = isEnabled; }
geolocationEnabled()55     static bool geolocationEnabled() { return isGeolocationEnabled; }
56 
setIndexedDBEnabled(bool isEnabled)57     static void setIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
indexedDBEnabled()58     static bool indexedDBEnabled() { return isIndexedDBEnabled; }
59 
60 #if ENABLE(VIDEO)
61     static bool audioEnabled();
62     static bool htmlMediaElementEnabled();
63     static bool htmlAudioElementEnabled();
64     static bool htmlVideoElementEnabled();
65     static bool mediaErrorEnabled();
66 #endif
67 
68 #if ENABLE(SHARED_WORKERS)
69     static bool sharedWorkerEnabled();
70 #endif
71 
72 #if ENABLE(WEB_SOCKETS)
73     static bool webSocketEnabled();
74 #endif
75 
76 #if ENABLE(DATABASE)
77     static bool openDatabaseEnabled();
78 #endif
79 
80 private:
81     // Never instantiate.
RuntimeEnabledFeatures()82     RuntimeEnabledFeatures() { }
83 
84     static bool isLocalStorageEnabled;
85     static bool isSessionStorageEnabled;
86     static bool isWebkitNotificationsEnabled;
87     static bool isApplicationCacheEnabled;
88     static bool isGeolocationEnabled;
89     static bool isIndexedDBEnabled;
90 };
91 
92 } // namespace WebCore
93 
94 #endif // RuntimeEnabledFeatures_h
95