1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is mozilla.org code.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2001
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Stuart Parmenter <pavlov@netscape.com>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41
42 interface imgIDecoderObserver;
43 interface imgIRequest;
44
45 interface nsIChannel;
46 interface nsILoadGroup;
47 interface nsIStreamListener;
48 interface nsIURI;
49
50 interface nsISimpleEnumerator;
51
52 #include "nsIRequest.idl" // for nsLoadFlags
53
54 /**
55 * imgILoader interface
56 *
57 * @author Stuart Parmenter <pavlov@netscape.com>
58 * @version 0.3
59 * @see imagelib2
60 */
61 [scriptable, uuid(d2f50c69-1064-4ce3-a92d-01dc5f5b4842)]
62 interface imgILoader : nsISupports
63 {
64 /**
65 * Start the load and decode of an image.
66 * @param aURI the URI to load
67 * @param aInitialDocumentURI the URI that 'initiated' the load -- used for 3rd party cookie blocking
68 * @param aReferrerURI the 'referring' URI
69 * @param aLoadGroup Loadgroup to put the image load into
70 * @param aObserver the observer
71 * @param aCX some random data
72 * @param aLoadFlags Load flags for the request
73 * @param aCacheKey cache key to use for a load if the original
74 * image came from a request that had post data
75 * @param aRequest A newly created, unused imgIRequest object or NULL for one to
76 be created for you.
77
78
79 * libpr0n does NOT keep a strong ref to the observer; this prevents
80 * reference cycles. This means that callers of loadImage should
81 * make sure to Cancel() the resulting request before the observer
82 * goes away.
83 */
84 [noscript] imgIRequest loadImage(in nsIURI aURI,
85 in nsIURI aInitialDocumentURL,
86 in nsIURI aReferrerURI,
87 in nsILoadGroup aLoadGroup,
88 in imgIDecoderObserver aObserver,
89 in nsISupports aCX,
90 in nsLoadFlags aLoadFlags,
91 in nsISupports cacheKey,
92 in imgIRequest aRequest);
93
94 /**
95 * Start the load and decode of an image.
96 * @param aChannel the channel to load the image from. This must
97 * already be opened before ths method is called, and there
98 * must have been no OnDataAvailable calls for it yet.
99 * @param aObserver the observer
100 * @param cx some random data
101 * @param aListener [out]
102 * A listener that should receive the data. Can be null, in which
103 * case imagelib has found a cached image and is not interested in
104 * the data. The caller needs not cancel the channel in this case.
105 *
106 * libpr0n does NOT keep a strong ref to the observer; this prevents
107 * reference cycles. This means that callers of loadImageWithChannel should
108 * make sure to Cancel() the resulting request before the observer goes away.
109 */
110 [noscript] imgIRequest loadImageWithChannel(in nsIChannel aChannel,
111 in imgIDecoderObserver aObserver,
112 in nsISupports cx,
113 out nsIStreamListener aListener);
114
115 /**
116 * Checks if a decoder for the an image with the given mime type is available
117 * @param mimeType The type to find a decoder for
118 * @return true if a decoder is available, false otherwise
119 */
120 boolean supportImageWithMimeType(in string mimeType);
121 };