OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/builds/tinderbox/XR-Mozilla1.8.0
-Release/WINNT_5.2_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 |
| 17 class nsIRequest; /* forward declaration */ |
| 18 |
| 19 class nsIStreamListener; /* forward declaration */ |
| 20 |
| 21 class 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 */ |
| 40 class NS_NO_VTABLE nsIURIContentListener : public nsISupports { |
| 41 public: |
| 42 |
| 43 NS_DEFINE_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_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_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsI
Request *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_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, P
RBool *_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 aIsContentPref
erred, out string aDesiredContentType); */ |
| 133 NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferr
ed, 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_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie) = 0; |
| 141 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_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentLis
tener) = 0; |
| 157 NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentList
ener) = 0; |
| 158 |
| 159 }; |
| 160 |
| 161 /* Use this macro when declaring classes that implement this interface. */ |
| 162 #define NS_DECL_NSIURICONTENTLISTENER \ |
| 163 NS_IMETHOD OnStartURIOpen(nsIURI *aURI, PRBool *_retval); \ |
| 164 NS_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsI
Request *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval); \ |
| 165 NS_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, P
RBool *_retval); \ |
| 166 NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferr
ed, char **aDesiredContentType, PRBool *_retval); \ |
| 167 NS_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie); \ |
| 168 NS_IMETHOD SetLoadCookie(nsISupports * aLoadCookie); \ |
| 169 NS_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentLis
tener); \ |
| 170 NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentList
ener); |
| 171 |
| 172 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object. */ |
| 173 #define NS_FORWARD_NSIURICONTENTLISTENER(_to) \ |
| 174 NS_IMETHOD OnStartURIOpen(nsIURI *aURI, PRBool *_retval) { return _to OnStartU
RIOpen(aURI, _retval); } \ |
| 175 NS_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsI
Request *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval) { retur
n _to DoContent(aContentType, aIsContentPreferred, aRequest, aContentHandler, _r
etval); } \ |
| 176 NS_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, P
RBool *_retval) { return _to IsPreferred(aContentType, aDesiredContentType, _ret
val); } \ |
| 177 NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferr
ed, char **aDesiredContentType, PRBool *_retval) { return _to CanHandleContent(a
ContentType, aIsContentPreferred, aDesiredContentType, _retval); } \ |
| 178 NS_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie) { return _to GetLoadCooki
e(aLoadCookie); } \ |
| 179 NS_IMETHOD SetLoadCookie(nsISupports * aLoadCookie) { return _to SetLoadCookie
(aLoadCookie); } \ |
| 180 NS_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentLis
tener) { return _to GetParentContentListener(aParentContentListener); } \ |
| 181 NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentList
ener) { return _to SetParentContentListener(aParentContentListener); } |
| 182 |
| 183 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object in a safe way. */ |
| 184 #define NS_FORWARD_SAFE_NSIURICONTENTLISTENER(_to) \ |
| 185 NS_IMETHOD OnStartURIOpen(nsIURI *aURI, PRBool *_retval) { return !_to ? NS_ER
ROR_NULL_POINTER : _to->OnStartURIOpen(aURI, _retval); } \ |
| 186 NS_IMETHOD DoContent(const char *aContentType, PRBool aIsContentPreferred, nsI
Request *aRequest, nsIStreamListener **aContentHandler, PRBool *_retval) { retur
n !_to ? NS_ERROR_NULL_POINTER : _to->DoContent(aContentType, aIsContentPreferre
d, aRequest, aContentHandler, _retval); } \ |
| 187 NS_IMETHOD IsPreferred(const char *aContentType, char **aDesiredContentType, P
RBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsPreferred(aConten
tType, aDesiredContentType, _retval); } \ |
| 188 NS_IMETHOD CanHandleContent(const char *aContentType, PRBool aIsContentPreferr
ed, char **aDesiredContentType, PRBool *_retval) { return !_to ? NS_ERROR_NULL_P
OINTER : _to->CanHandleContent(aContentType, aIsContentPreferred, aDesiredConten
tType, _retval); } \ |
| 189 NS_IMETHOD GetLoadCookie(nsISupports * *aLoadCookie) { return !_to ? NS_ERROR_
NULL_POINTER : _to->GetLoadCookie(aLoadCookie); } \ |
| 190 NS_IMETHOD SetLoadCookie(nsISupports * aLoadCookie) { return !_to ? NS_ERROR_N
ULL_POINTER : _to->SetLoadCookie(aLoadCookie); } \ |
| 191 NS_IMETHOD GetParentContentListener(nsIURIContentListener * *aParentContentLis
tener) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParentContentListener(aPa
rentContentListener); } \ |
| 192 NS_IMETHOD SetParentContentListener(nsIURIContentListener * aParentContentList
ener) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetParentContentListener(aPar
entContentListener); } |
| 193 |
| 194 #if 0 |
| 195 /* Use the code below as a template for the implementation class for this interf
ace. */ |
| 196 |
| 197 /* Header file */ |
| 198 class nsURIContentListener : public nsIURIContentListener |
| 199 { |
| 200 public: |
| 201 NS_DECL_ISUPPORTS |
| 202 NS_DECL_NSIURICONTENTLISTENER |
| 203 |
| 204 nsURIContentListener(); |
| 205 |
| 206 private: |
| 207 ~nsURIContentListener(); |
| 208 |
| 209 protected: |
| 210 /* additional members */ |
| 211 }; |
| 212 |
| 213 /* Implementation file */ |
| 214 NS_IMPL_ISUPPORTS1(nsURIContentListener, nsIURIContentListener) |
| 215 |
| 216 nsURIContentListener::nsURIContentListener() |
| 217 { |
| 218 /* member initializers and constructor code */ |
| 219 } |
| 220 |
| 221 nsURIContentListener::~nsURIContentListener() |
| 222 { |
| 223 /* destructor code */ |
| 224 } |
| 225 |
| 226 /* boolean onStartURIOpen (in nsIURI aURI); */ |
| 227 NS_IMETHODIMP nsURIContentListener::OnStartURIOpen(nsIURI *aURI, PRBool *_retval
) |
| 228 { |
| 229 return NS_ERROR_NOT_IMPLEMENTED; |
| 230 } |
| 231 |
| 232 /* boolean doContent (in string aContentType, in boolean aIsContentPreferred, in
nsIRequest aRequest, out nsIStreamListener aContentHandler); */ |
| 233 NS_IMETHODIMP nsURIContentListener::DoContent(const char *aContentType, PRBool a
IsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, P
RBool *_retval) |
| 234 { |
| 235 return NS_ERROR_NOT_IMPLEMENTED; |
| 236 } |
| 237 |
| 238 /* boolean isPreferred (in string aContentType, out string aDesiredContentType);
*/ |
| 239 NS_IMETHODIMP nsURIContentListener::IsPreferred(const char *aContentType, char *
*aDesiredContentType, PRBool *_retval) |
| 240 { |
| 241 return NS_ERROR_NOT_IMPLEMENTED; |
| 242 } |
| 243 |
| 244 /* boolean canHandleContent (in string aContentType, in boolean aIsContentPrefer
red, out string aDesiredContentType); */ |
| 245 NS_IMETHODIMP nsURIContentListener::CanHandleContent(const char *aContentType, P
RBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) |
| 246 { |
| 247 return NS_ERROR_NOT_IMPLEMENTED; |
| 248 } |
| 249 |
| 250 /* attribute nsISupports loadCookie; */ |
| 251 NS_IMETHODIMP nsURIContentListener::GetLoadCookie(nsISupports * *aLoadCookie) |
| 252 { |
| 253 return NS_ERROR_NOT_IMPLEMENTED; |
| 254 } |
| 255 NS_IMETHODIMP nsURIContentListener::SetLoadCookie(nsISupports * aLoadCookie) |
| 256 { |
| 257 return NS_ERROR_NOT_IMPLEMENTED; |
| 258 } |
| 259 |
| 260 /* attribute nsIURIContentListener parentContentListener; */ |
| 261 NS_IMETHODIMP nsURIContentListener::GetParentContentListener(nsIURIContentListen
er * *aParentContentListener) |
| 262 { |
| 263 return NS_ERROR_NOT_IMPLEMENTED; |
| 264 } |
| 265 NS_IMETHODIMP nsURIContentListener::SetParentContentListener(nsIURIContentListen
er * aParentContentListener) |
| 266 { |
| 267 return NS_ERROR_NOT_IMPLEMENTED; |
| 268 } |
| 269 |
| 270 /* End of implementation class template. */ |
| 271 #endif |
| 272 |
| 273 |
| 274 #endif /* __gen_nsIURIContentListener_h__ */ |
OLD | NEW |