PageRenderTime 60ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/gecko_api/include/nsIURIContentListener.h

http://firefox-mac-pdf.googlecode.com/
C Header | 276 lines | 107 code | 39 blank | 130 comment | 0 complexity | f55080c3fa9dc8a0786b69dd20e4eb3a MD5 | raw file
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/mozilla/uriloader/base/nsIURIContentListener.idl
  3. */
  4. #ifndef __gen_nsIURIContentListener_h__
  5. #define __gen_nsIURIContentListener_h__
  6. #ifndef __gen_nsISupports_h__
  7. #include "nsISupports.h"
  8. #endif
  9. /* For IDL files that don't want to include root IDL files. */
  10. #ifndef NS_NO_VTABLE
  11. #define NS_NO_VTABLE
  12. #endif
  13. class nsIRequest; /* forward declaration */
  14. class nsIStreamListener; /* forward declaration */
  15. class nsIURI; /* forward declaration */
  16. /* starting interface: nsIURIContentListener */
  17. #define NS_IURICONTENTLISTENER_IID_STR "94928ab3-8b63-11d3-989d-001083010e9b"
  18. #define NS_IURICONTENTLISTENER_IID \
  19. {0x94928ab3, 0x8b63, 0x11d3, \
  20. { 0x98, 0x9d, 0x00, 0x10, 0x83, 0x01, 0x0e, 0x9b }}
  21. /**
  22. * nsIURIContentListener is an interface used by components which
  23. * want to know (and have a chance to handle) a particular content type.
  24. * Typical usage scenarios will include running applications which register
  25. * a nsIURIContentListener for each of its content windows with the uri
  26. * dispatcher service.
  27. *
  28. * @status FROZEN
  29. */
  30. class NS_NO_VTABLE NS_SCRIPTABLE nsIURIContentListener : public nsISupports {
  31. public:
  32. NS_DECLARE_STATIC_IID_ACCESSOR(NS_IURICONTENTLISTENER_IID)
  33. /**
  34. * Gives the original content listener first crack at stopping a load before
  35. * it happens.
  36. *
  37. * @param aURI URI that is being opened.
  38. *
  39. * @return <code>false</code> if the load can continue;
  40. * <code>true</code> if the open should be aborted.
  41. */
  42. /* boolean onStartURIOpen (in nsIURI aURI); */
  43. NS_SCRIPTABLE NS_IMETHOD OnStartURIOpen(nsIURI *aURI, PRBool *_retval) = 0;
  44. /**
  45. * Notifies the content listener to hook up an nsIStreamListener capable of
  46. * consuming the data stream.
  47. *
  48. * @param aContentType Content type of the data.
  49. * @param aIsContentPreferred Indicates whether the content should be
  50. * preferred by this listener.
  51. * @param aRequest Request that is providing the data.
  52. * @param aContentHandler nsIStreamListener that will consume the data.
  53. * This should be set to <code>nsnull</code> if
  54. * this content listener can't handle the content
  55. * type.
  56. *
  57. * @return <code>true</code> if the consumer wants to
  58. * handle the load completely by itself. This
  59. * causes the URI Loader do nothing else...
  60. * <code>false</code> if the URI Loader should
  61. * continue handling the load and call the
  62. * returned streamlistener's methods.
  63. */
  64. /* boolean doContent (in string aContentType, in boolean aIsContentPreferred, in nsIRequest aRequest, out nsIStreamListener aContentHandler); */
  65. NS_SCRIPTABLE NS_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval) = 0;
  66. /**
  67. * When given a uri to dispatch, if the URI is specified as 'preferred
  68. * content' then the uri loader tries to find a preferred content handler
  69. * for the content type. The thought is that many content listeners may
  70. * be able to handle the same content type if they have to. i.e. the mail
  71. * content window can handle text/html just like a browser window content
  72. * listener. However, if the user clicks on a link with text/html content,
  73. * then the browser window should handle that content and not the mail
  74. * window where the user may have clicked the link. This is the difference
  75. * between isPreferred and canHandleContent.
  76. *
  77. * @param aContentType Content type of the data.
  78. * @param aDesiredContentType Indicates that aContentType must be converted
  79. * to aDesiredContentType before processing the
  80. * data. This causes a stream converted to be
  81. * inserted into the nsIStreamListener chain.
  82. * This argument can be <code>nsnull</code> if
  83. * the content should be consumed directly as
  84. * aContentType.
  85. *
  86. * @return <code>true</code> if this is a preferred
  87. * content handler for aContentType;
  88. * <code>false<code> otherwise.
  89. */
  90. /* boolean isPreferred (in string aContentType, out string aDesiredContentType); */
  91. NS_SCRIPTABLE NS_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval) = 0;
  92. /**
  93. * When given a uri to dispatch, if the URI is not specified as 'preferred
  94. * content' then the uri loader calls canHandleContent to see if the content
  95. * listener is capable of handling the content.
  96. *
  97. * @param aContentType Content type of the data.
  98. * @param aIsContentPreferred Indicates whether the content should be
  99. * preferred by this listener.
  100. * @param aDesiredContentType Indicates that aContentType must be converted
  101. * to aDesiredContentType before processing the
  102. * data. This causes a stream converted to be
  103. * inserted into the nsIStreamListener chain.
  104. * This argument can be <code>nsnull</code> if
  105. * the content should be consumed directly as
  106. * aContentType.
  107. *
  108. * @return <code>true</code> if the data can be consumed.
  109. * <code>false</code> otherwise.
  110. *
  111. * Note: I really envision canHandleContent as a method implemented
  112. * by the docshell as the implementation is generic to all doc
  113. * shells. The isPreferred decision is a decision made by a top level
  114. * application content listener that sits at the top of the docshell
  115. * hierarchy.
  116. */
  117. /* boolean canHandleContent (in string aContentType, in boolean aIsContentPreferred, out string aDesiredContentType); */
  118. NS_SCRIPTABLE NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) = 0;
  119. /**
  120. * The load context associated with a particular content listener.
  121. * The URI Loader stores and accesses this value as needed.
  122. */
  123. /* attribute nsISupports loadCookie; */
  124. NS_SCRIPTABLE NS_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie) = 0;
  125. NS_SCRIPTABLE NS_IMETHOD SetLoadCookie(nsISupports * aLoadCookie) = 0;
  126. /**
  127. * The parent content listener if this particular listener is part of a chain
  128. * of content listeners (i.e. a docshell!)
  129. *
  130. * @note If this attribute is set to an object that implements
  131. * nsISupportsWeakReference, the implementation should get the
  132. * nsIWeakReference and hold that. Otherwise, the implementation
  133. * should not refcount this interface; it should assume that a non
  134. * null value is always valid. In that case, the caller is
  135. * responsible for explicitly setting this value back to null if the
  136. * parent content listener is destroyed.
  137. */
  138. /* attribute nsIURIContentListener parentContentListener; */
  139. NS_SCRIPTABLE NS_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentListener) = 0;
  140. NS_SCRIPTABLE NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentListener) = 0;
  141. };
  142. NS_DEFINE_STATIC_IID_ACCESSOR(nsIURIContentListener, NS_IURICONTENTLISTENER_IID)
  143. /* Use this macro when declaring classes that implement this interface. */
  144. #define NS_DECL_NSIURICONTENTLISTENER \
  145. NS_SCRIPTABLE NS_IMETHOD OnStartURIOpen(nsIURI *aURI, PRBool *_retval); \
  146. NS_SCRIPTABLE NS_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval); \
  147. NS_SCRIPTABLE NS_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval); \
  148. NS_SCRIPTABLE NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval); \
  149. NS_SCRIPTABLE NS_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie); \
  150. NS_SCRIPTABLE NS_IMETHOD SetLoadCookie(nsISupports * aLoadCookie); \
  151. NS_SCRIPTABLE NS_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentListener); \
  152. NS_SCRIPTABLE NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentListener);
  153. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  154. #define NS_FORWARD_NSIURICONTENTLISTENER(_to) \
  155. NS_SCRIPTABLE NS_IMETHOD OnStartURIOpen(nsIURI *aURI, PRBool *_retval) { return _to OnStartURIOpen(aURI, _retval); } \
  156. NS_SCRIPTABLE NS_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval) { return _to DoContent(aContentType, aIsContentPreferred, aRequest, aContentHandler, _retval); } \
  157. NS_SCRIPTABLE NS_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval) { return _to IsPreferred(aContentType, aDesiredContentType, _retval); } \
  158. NS_SCRIPTABLE NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) { return _to CanHandleContent(aContentType, aIsContentPreferred, aDesiredContentType, _retval); } \
  159. NS_SCRIPTABLE NS_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie) { return _to GetLoadCookie(aLoadCookie); } \
  160. NS_SCRIPTABLE NS_IMETHOD SetLoadCookie(nsISupports * aLoadCookie) { return _to SetLoadCookie(aLoadCookie); } \
  161. NS_SCRIPTABLE NS_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentListener) { return _to GetParentContentListener(aParentContentListener); } \
  162. NS_SCRIPTABLE NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentListener) { return _to SetParentContentListener(aParentContentListener); }
  163. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  164. #define NS_FORWARD_SAFE_NSIURICONTENTLISTENER(_to) \
  165. NS_SCRIPTABLE NS_IMETHOD OnStartURIOpen(nsIURI *aURI, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStartURIOpen(aURI, _retval); } \
  166. NS_SCRIPTABLE NS_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->DoContent(aContentType, aIsContentPreferred, aRequest, aContentHandler, _retval); } \
  167. NS_SCRIPTABLE NS_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsPreferred(aContentType, aDesiredContentType, _retval); } \
  168. NS_SCRIPTABLE NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanHandleContent(aContentType, aIsContentPreferred, aDesiredContentType, _retval); } \
  169. NS_SCRIPTABLE NS_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLoadCookie(aLoadCookie); } \
  170. NS_SCRIPTABLE NS_IMETHOD SetLoadCookie(nsISupports * aLoadCookie) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLoadCookie(aLoadCookie); } \
  171. NS_SCRIPTABLE NS_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentListener) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParentContentListener(aParentContentListener); } \
  172. NS_SCRIPTABLE NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentListener) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetParentContentListener(aParentContentListener); }
  173. #if 0
  174. /* Use the code below as a template for the implementation class for this interface. */
  175. /* Header file */
  176. class nsURIContentListener : public nsIURIContentListener
  177. {
  178. public:
  179. NS_DECL_ISUPPORTS
  180. NS_DECL_NSIURICONTENTLISTENER
  181. nsURIContentListener();
  182. private:
  183. ~nsURIContentListener();
  184. protected:
  185. /* additional members */
  186. };
  187. /* Implementation file */
  188. NS_IMPL_ISUPPORTS1(nsURIContentListener, nsIURIContentListener)
  189. nsURIContentListener::nsURIContentListener()
  190. {
  191. /* member initializers and constructor code */
  192. }
  193. nsURIContentListener::~nsURIContentListener()
  194. {
  195. /* destructor code */
  196. }
  197. /* boolean onStartURIOpen (in nsIURI aURI); */
  198. NS_IMETHODIMP nsURIContentListener::OnStartURIOpen(nsIURI *aURI, PRBool *_retval)
  199. {
  200. return NS_ERROR_NOT_IMPLEMENTED;
  201. }
  202. /* boolean doContent (in string aContentType, in boolean aIsContentPreferred, in nsIRequest aRequest, out nsIStreamListener aContentHandler); */
  203. NS_IMETHODIMP nsURIContentListener::DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval)
  204. {
  205. return NS_ERROR_NOT_IMPLEMENTED;
  206. }
  207. /* boolean isPreferred (in string aContentType, out string aDesiredContentType); */
  208. NS_IMETHODIMP nsURIContentListener::IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval)
  209. {
  210. return NS_ERROR_NOT_IMPLEMENTED;
  211. }
  212. /* boolean canHandleContent (in string aContentType, in boolean aIsContentPreferred, out string aDesiredContentType); */
  213. NS_IMETHODIMP nsURIContentListener::CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval)
  214. {
  215. return NS_ERROR_NOT_IMPLEMENTED;
  216. }
  217. /* attribute nsISupports loadCookie; */
  218. NS_IMETHODIMP nsURIContentListener::GetLoadCookie(nsISupports * *aLoadCookie)
  219. {
  220. return NS_ERROR_NOT_IMPLEMENTED;
  221. }
  222. NS_IMETHODIMP nsURIContentListener::SetLoadCookie(nsISupports * aLoadCookie)
  223. {
  224. return NS_ERROR_NOT_IMPLEMENTED;
  225. }
  226. /* attribute nsIURIContentListener parentContentListener; */
  227. NS_IMETHODIMP nsURIContentListener::GetParentContentListener(nsIURIContentListener * *aParentContentListener)
  228. {
  229. return NS_ERROR_NOT_IMPLEMENTED;
  230. }
  231. NS_IMETHODIMP nsURIContentListener::SetParentContentListener(nsIURIContentListener * aParentContentListener)
  232. {
  233. return NS_ERROR_NOT_IMPLEMENTED;
  234. }
  235. /* End of implementation class template. */
  236. #endif
  237. #endif /* __gen_nsIURIContentListener_h__ */