APIObject.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * Copyright (C) 2010 Apple 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
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  14. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  17. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  23. * THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef APIObject_h
  26. #define APIObject_h
  27. #include <wtf/RefCounted.h>
  28. namespace WebKit {
  29. class APIObject : public ThreadSafeRefCounted<APIObject> {
  30. public:
  31. enum Type {
  32. // Base types
  33. TypeNull = 0,
  34. TypeArray,
  35. TypeAuthenticationChallenge,
  36. TypeAuthenticationDecisionListener,
  37. TypeCertificateInfo,
  38. TypeConnection,
  39. TypeContextMenuItem,
  40. TypeCredential,
  41. TypeData,
  42. TypeDictionary,
  43. TypeError,
  44. TypeGraphicsContext,
  45. TypeImage,
  46. TypeProtectionSpace,
  47. TypeRenderLayer,
  48. TypeRenderObject,
  49. TypeSecurityOrigin,
  50. TypeSerializedScriptValue,
  51. TypeString,
  52. TypeURL,
  53. TypeURLRequest,
  54. TypeURLResponse,
  55. TypeUserContentURLPattern,
  56. TypeWebArchive,
  57. TypeWebArchiveResource,
  58. // Base numeric types
  59. TypeBoolean,
  60. TypeDouble,
  61. TypeUInt64,
  62. // Geometry types
  63. TypePoint,
  64. TypeSize,
  65. TypeRect,
  66. // UIProcess types
  67. TypeApplicationCacheManager,
  68. TypeBackForwardList,
  69. TypeBackForwardListItem,
  70. TypeBatteryManager,
  71. TypeBatteryStatus,
  72. TypeCacheManager,
  73. TypeColorPickerResultListener,
  74. TypeContext,
  75. TypeCookieManager,
  76. TypeDatabaseManager,
  77. TypeDownload,
  78. TypeFormSubmissionListener,
  79. TypeFrame,
  80. TypeFramePolicyListener,
  81. TypeFullScreenManager,
  82. TypeGeolocationManager,
  83. TypeGeolocationPermissionRequest,
  84. TypeHitTestResult,
  85. TypeGeolocationPosition,
  86. TypeGrammarDetail,
  87. TypeIconDatabase,
  88. TypeInspector,
  89. TypeKeyValueStorageManager,
  90. TypeMediaCacheManager,
  91. TypeNavigationData,
  92. TypeNetworkInfo,
  93. TypeNetworkInfoManager,
  94. TypeNotification,
  95. TypeNotificationManager,
  96. TypeNotificationPermissionRequest,
  97. TypeOpenPanelParameters,
  98. TypeOpenPanelResultListener,
  99. TypePage,
  100. TypePageGroup,
  101. TypePluginSiteDataManager,
  102. TypePreferences,
  103. TypeTextChecker,
  104. TypeVibration,
  105. TypeViewportAttributes,
  106. // Bundle types
  107. TypeBundle,
  108. TypeBundleBackForwardList,
  109. TypeBundleBackForwardListItem,
  110. TypeBundleDOMWindowExtension,
  111. TypeBundleFrame,
  112. TypeBundleHitTestResult,
  113. TypeBundleInspector,
  114. TypeBundleNavigationAction,
  115. TypeBundleNodeHandle,
  116. TypeBundlePage,
  117. TypeBundlePageBanner,
  118. TypeBundlePageGroup,
  119. TypeBundlePageOverlay,
  120. TypeBundleRangeHandle,
  121. TypeBundleScriptWorld,
  122. // Platform specific
  123. TypeEditCommandProxy,
  124. TypeObjCObjectGraph,
  125. TypeView,
  126. #if USE(SOUP)
  127. TypeSoupRequestManager,
  128. #endif
  129. #if PLATFORM(EFL) || PLATFORM(MANX)
  130. TypePopupMenuItem,
  131. #endif
  132. };
  133. virtual ~APIObject()
  134. {
  135. }
  136. virtual Type type() const = 0;
  137. protected:
  138. APIObject();
  139. };
  140. template <APIObject::Type ArgumentType>
  141. class TypedAPIObject : public APIObject {
  142. public:
  143. static const Type APIType = ArgumentType;
  144. virtual ~TypedAPIObject()
  145. {
  146. }
  147. protected:
  148. TypedAPIObject()
  149. {
  150. }
  151. virtual Type type() const OVERRIDE { return APIType; }
  152. };
  153. } // namespace WebKit
  154. #endif // APIObject_h