/platform/external/webkit/WebCore/bindings/generic/RuntimeEnabledFeatures.h

https://github.com/aharish/totoro-gb-opensource-update2 · C Header · 94 lines · 44 code · 17 blank · 33 comment · 0 complexity · 7406e4eb278410bf36a3b9cd7d424527 MD5 · raw file

  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. #ifndef RuntimeEnabledFeatures_h
  31. #define RuntimeEnabledFeatures_h
  32. namespace WebCore {
  33. // A class that stores static enablers for all experimental features. Note that
  34. // the method names must line up with the JavaScript method they enable for code
  35. // generation to work properly.
  36. class RuntimeEnabledFeatures {
  37. public:
  38. static void setLocalStorageEnabled(bool isEnabled) { isLocalStorageEnabled = isEnabled; }
  39. static bool localStorageEnabled() { return isLocalStorageEnabled; }
  40. static void setSessionStorageEnabled(bool isEnabled) { isSessionStorageEnabled = isEnabled; }
  41. static bool sessionStorageEnabled() { return isSessionStorageEnabled; }
  42. static void setWebkitNotificationsEnabled(bool isEnabled) { isWebkitNotificationsEnabled = isEnabled; }
  43. static bool webkitNotificationsEnabled() { return isWebkitNotificationsEnabled; }
  44. static void setApplicationCacheEnabled(bool isEnabled) { isApplicationCacheEnabled = isEnabled; }
  45. static bool applicationCacheEnabled() { return isApplicationCacheEnabled; }
  46. static void setGeolocationEnabled(bool isEnabled) { isGeolocationEnabled = isEnabled; }
  47. static bool geolocationEnabled() { return isGeolocationEnabled; }
  48. static void setIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
  49. static bool indexedDBEnabled() { return isIndexedDBEnabled; }
  50. #if ENABLE(VIDEO)
  51. static bool audioEnabled();
  52. static bool htmlMediaElementEnabled();
  53. static bool htmlAudioElementEnabled();
  54. static bool htmlVideoElementEnabled();
  55. static bool mediaErrorEnabled();
  56. #endif
  57. #if ENABLE(SHARED_WORKERS)
  58. static bool sharedWorkerEnabled();
  59. #endif
  60. #if ENABLE(WEB_SOCKETS)
  61. static bool webSocketEnabled();
  62. #endif
  63. #if ENABLE(DATABASE)
  64. static bool openDatabaseEnabled();
  65. #endif
  66. private:
  67. // Never instantiate.
  68. RuntimeEnabledFeatures() { }
  69. static bool isLocalStorageEnabled;
  70. static bool isSessionStorageEnabled;
  71. static bool isWebkitNotificationsEnabled;
  72. static bool isApplicationCacheEnabled;
  73. static bool isGeolocationEnabled;
  74. static bool isIndexedDBEnabled;
  75. };
  76. } // namespace WebCore
  77. #endif // RuntimeEnabledFeatures_h