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