PageRenderTime 46ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/nsIRequest.h

http://firefox-mac-pdf.googlecode.com/
C Header | 349 lines | 131 code | 51 blank | 167 comment | 0 complexity | de9ed8fb79a0f480deb31f57dc0063af MD5 | raw file
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/mozilla/netwerk/base/public/nsIRequest.idl
  3. */
  4. #ifndef __gen_nsIRequest_h__
  5. #define __gen_nsIRequest_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 nsILoadGroup; /* forward declaration */
  14. typedef PRUint32 nsLoadFlags;
  15. /* starting interface: nsIRequest */
  16. #define NS_IREQUEST_IID_STR "ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe"
  17. #define NS_IREQUEST_IID \
  18. {0xef6bfbd2, 0xfd46, 0x48d8, \
  19. { 0x96, 0xb7, 0x9f, 0x8f, 0x0f, 0xd3, 0x87, 0xfe }}
  20. /**
  21. * nsIRequest
  22. *
  23. * @status FROZEN
  24. */
  25. class NS_NO_VTABLE NS_SCRIPTABLE nsIRequest : public nsISupports {
  26. public:
  27. NS_DECLARE_STATIC_IID_ACCESSOR(NS_IREQUEST_IID)
  28. /**
  29. * The name of the request. Often this is the URI of the request.
  30. */
  31. /* readonly attribute AUTF8String name; */
  32. NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) = 0;
  33. /**
  34. * Indicates whether the request is pending. nsIRequest::isPending is
  35. * true when there is an outstanding asynchronous event that will make
  36. * the request no longer be pending. Requests do not necessarily start
  37. * out pending; in some cases, requests have to be explicitly initiated
  38. * (e.g. nsIChannel implementations are only pending once asyncOpen
  39. * returns successfully).
  40. *
  41. * Requests can become pending multiple times during their lifetime.
  42. *
  43. * @return TRUE if the request has yet to reach completion.
  44. * @return FALSE if the request has reached completion (e.g., after
  45. * OnStopRequest has fired).
  46. * @note Suspended requests are still considered pending.
  47. */
  48. /* boolean isPending (); */
  49. NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval) = 0;
  50. /**
  51. * The error status associated with the request.
  52. */
  53. /* readonly attribute nsresult status; */
  54. NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus) = 0;
  55. /**
  56. * Cancels the current request. This will close any open input or
  57. * output streams and terminate any async requests. Users should
  58. * normally pass NS_BINDING_ABORTED, although other errors may also
  59. * be passed. The error passed in will become the value of the
  60. * status attribute.
  61. *
  62. * Implementations must not send any notifications (e.g. via
  63. * nsIRequestObserver) synchronously from this function. Similarly,
  64. * removal from the load group (if any) must also happen asynchronously.
  65. *
  66. * Requests that use nsIStreamListener must not call onDataAvailable
  67. * anymore after cancel has been called.
  68. *
  69. * @param aStatus the reason for canceling this request.
  70. *
  71. * NOTE: most nsIRequest implementations expect aStatus to be a
  72. * failure code; however, some implementations may allow aStatus to
  73. * be a success code such as NS_OK. In general, aStatus should be
  74. * a failure code.
  75. */
  76. /* void cancel (in nsresult aStatus); */
  77. NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus) = 0;
  78. /**
  79. * Suspends the current request. This may have the effect of closing
  80. * any underlying transport (in order to free up resources), although
  81. * any open streams remain logically opened and will continue delivering
  82. * data when the transport is resumed.
  83. *
  84. * Calling cancel() on a suspended request must not send any
  85. * notifications (such as onstopRequest) until the request is resumed.
  86. *
  87. * NOTE: some implementations are unable to immediately suspend, and
  88. * may continue to deliver events already posted to an event queue. In
  89. * general, callers should be capable of handling events even after
  90. * suspending a request.
  91. */
  92. /* void suspend (); */
  93. NS_SCRIPTABLE NS_IMETHOD Suspend(void) = 0;
  94. /**
  95. * Resumes the current request. This may have the effect of re-opening
  96. * any underlying transport and will resume the delivery of data to
  97. * any open streams.
  98. */
  99. /* void resume (); */
  100. NS_SCRIPTABLE NS_IMETHOD Resume(void) = 0;
  101. /**
  102. * The load group of this request. While pending, the request is a
  103. * member of the load group. It is the responsibility of the request
  104. * to implement this policy.
  105. */
  106. /* attribute nsILoadGroup loadGroup; */
  107. NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) = 0;
  108. NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) = 0;
  109. /**
  110. * The load flags of this request. Bits 0-15 are reserved.
  111. *
  112. * When added to a load group, this request's load flags are merged with
  113. * the load flags of the load group.
  114. */
  115. /* attribute nsLoadFlags loadFlags; */
  116. NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags) = 0;
  117. NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) = 0;
  118. /**************************************************************************
  119. * Listed below are the various load flags which may be or'd together.
  120. */
  121. /**
  122. * No special load flags:
  123. */
  124. enum { LOAD_NORMAL = 0U };
  125. /**
  126. * Don't deliver status notifications to the nsIProgressEventSink, or keep
  127. * this load from completing the nsILoadGroup it may belong to.
  128. */
  129. enum { LOAD_BACKGROUND = 1U };
  130. /**************************************************************************
  131. * The following flags control the flow of data into the cache.
  132. */
  133. /**
  134. * This flag prevents caching of any kind. It does not, however, prevent
  135. * cached content from being used to satisfy this request.
  136. */
  137. enum { INHIBIT_CACHING = 128U };
  138. /**
  139. * This flag prevents caching on disk (or other persistent media), which
  140. * may be needed to preserve privacy. For HTTPS, this flag is set auto-
  141. * matically.
  142. */
  143. enum { INHIBIT_PERSISTENT_CACHING = 256U };
  144. /**************************************************************************
  145. * The following flags control what happens when the cache contains data
  146. * that could perhaps satisfy this request. They are listed in descending
  147. * order of precidence.
  148. */
  149. /**
  150. * Force an end-to-end download of content data from the origin server.
  151. * This flag is used for a shift-reload.
  152. */
  153. enum { LOAD_BYPASS_CACHE = 512U };
  154. /**
  155. * Load from the cache, bypassing protocol specific validation logic. This
  156. * flag is used when browsing via history. It is not recommended for normal
  157. * browsing as it may likely violate reasonable assumptions made by the
  158. * server and confuse users.
  159. */
  160. enum { LOAD_FROM_CACHE = 1024U };
  161. /**
  162. * The following flags control the frequency of cached content validation
  163. * when neither LOAD_BYPASS_CACHE or LOAD_FROM_CACHE are set. By default,
  164. * cached content is automatically validated if necessary before reuse.
  165. *
  166. * VALIDATE_ALWAYS forces validation of any cached content independent of
  167. * its expiration time.
  168. *
  169. * VALIDATE_NEVER disables validation of expired content.
  170. *
  171. * VALIDATE_ONCE_PER_SESSION disables validation of expired content,
  172. * provided it has already been validated (at least once) since the start
  173. * of this session.
  174. *
  175. * NOTE TO IMPLEMENTORS:
  176. * These flags are intended for normal browsing, and they should therefore
  177. * not apply to content that must be validated before each use. Consider,
  178. * for example, a HTTP response with a "Cache-control: no-cache" header.
  179. * According to RFC2616, this response must be validated before it can
  180. * be taken from a cache. Breaking this requirement could result in
  181. * incorrect and potentially undesirable side-effects.
  182. */
  183. enum { VALIDATE_ALWAYS = 2048U };
  184. enum { VALIDATE_NEVER = 4096U };
  185. enum { VALIDATE_ONCE_PER_SESSION = 8192U };
  186. };
  187. NS_DEFINE_STATIC_IID_ACCESSOR(nsIRequest, NS_IREQUEST_IID)
  188. /* Use this macro when declaring classes that implement this interface. */
  189. #define NS_DECL_NSIREQUEST \
  190. NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName); \
  191. NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval); \
  192. NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus); \
  193. NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus); \
  194. NS_SCRIPTABLE NS_IMETHOD Suspend(void); \
  195. NS_SCRIPTABLE NS_IMETHOD Resume(void); \
  196. NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup); \
  197. NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup); \
  198. NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags); \
  199. NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags); \
  200. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  201. #define NS_FORWARD_NSIREQUEST(_to) \
  202. NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) { return _to GetName(aName); } \
  203. NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval) { return _to IsPending(_retval); } \
  204. NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus) { return _to GetStatus(aStatus); } \
  205. NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus) { return _to Cancel(aStatus); } \
  206. NS_SCRIPTABLE NS_IMETHOD Suspend(void) { return _to Suspend(); } \
  207. NS_SCRIPTABLE NS_IMETHOD Resume(void) { return _to Resume(); } \
  208. NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { return _to GetLoadGroup(aLoadGroup); } \
  209. NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { return _to SetLoadGroup(aLoadGroup); } \
  210. NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags) { return _to GetLoadFlags(aLoadFlags); } \
  211. NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) { return _to SetLoadFlags(aLoadFlags); } \
  212. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  213. #define NS_FORWARD_SAFE_NSIREQUEST(_to) \
  214. NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
  215. NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsPending(_retval); } \
  216. NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStatus(aStatus); } \
  217. NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(aStatus); } \
  218. NS_SCRIPTABLE NS_IMETHOD Suspend(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Suspend(); } \
  219. NS_SCRIPTABLE NS_IMETHOD Resume(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Resume(); } \
  220. NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLoadGroup(aLoadGroup); } \
  221. NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLoadGroup(aLoadGroup); } \
  222. NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLoadFlags(aLoadFlags); } \
  223. NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLoadFlags(aLoadFlags); } \
  224. #if 0
  225. /* Use the code below as a template for the implementation class for this interface. */
  226. /* Header file */
  227. class nsRequest : public nsIRequest
  228. {
  229. public:
  230. NS_DECL_ISUPPORTS
  231. NS_DECL_NSIREQUEST
  232. nsRequest();
  233. private:
  234. ~nsRequest();
  235. protected:
  236. /* additional members */
  237. };
  238. /* Implementation file */
  239. NS_IMPL_ISUPPORTS1(nsRequest, nsIRequest)
  240. nsRequest::nsRequest()
  241. {
  242. /* member initializers and constructor code */
  243. }
  244. nsRequest::~nsRequest()
  245. {
  246. /* destructor code */
  247. }
  248. /* readonly attribute AUTF8String name; */
  249. NS_IMETHODIMP nsRequest::GetName(nsACString & aName)
  250. {
  251. return NS_ERROR_NOT_IMPLEMENTED;
  252. }
  253. /* boolean isPending (); */
  254. NS_IMETHODIMP nsRequest::IsPending(PRBool *_retval)
  255. {
  256. return NS_ERROR_NOT_IMPLEMENTED;
  257. }
  258. /* readonly attribute nsresult status; */
  259. NS_IMETHODIMP nsRequest::GetStatus(nsresult *aStatus)
  260. {
  261. return NS_ERROR_NOT_IMPLEMENTED;
  262. }
  263. /* void cancel (in nsresult aStatus); */
  264. NS_IMETHODIMP nsRequest::Cancel(nsresult aStatus)
  265. {
  266. return NS_ERROR_NOT_IMPLEMENTED;
  267. }
  268. /* void suspend (); */
  269. NS_IMETHODIMP nsRequest::Suspend()
  270. {
  271. return NS_ERROR_NOT_IMPLEMENTED;
  272. }
  273. /* void resume (); */
  274. NS_IMETHODIMP nsRequest::Resume()
  275. {
  276. return NS_ERROR_NOT_IMPLEMENTED;
  277. }
  278. /* attribute nsILoadGroup loadGroup; */
  279. NS_IMETHODIMP nsRequest::GetLoadGroup(nsILoadGroup * *aLoadGroup)
  280. {
  281. return NS_ERROR_NOT_IMPLEMENTED;
  282. }
  283. NS_IMETHODIMP nsRequest::SetLoadGroup(nsILoadGroup * aLoadGroup)
  284. {
  285. return NS_ERROR_NOT_IMPLEMENTED;
  286. }
  287. /* attribute nsLoadFlags loadFlags; */
  288. NS_IMETHODIMP nsRequest::GetLoadFlags(nsLoadFlags *aLoadFlags)
  289. {
  290. return NS_ERROR_NOT_IMPLEMENTED;
  291. }
  292. NS_IMETHODIMP nsRequest::SetLoadFlags(nsLoadFlags aLoadFlags)
  293. {
  294. return NS_ERROR_NOT_IMPLEMENTED;
  295. }
  296. /* End of implementation class template. */
  297. #endif
  298. #endif /* __gen_nsIRequest_h__ */