1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
9 interface imgINotificationObserver
;
10 interface imgIRequest
;
13 interface nsILoadGroup
;
14 interface nsIPrincipal
;
15 interface nsIStreamListener
;
17 interface nsIReferrerInfo
;
19 interface nsISimpleEnumerator
;
21 #include
"nsIRequest.idl" // for nsLoadFlags
22 #include
"nsIContentPolicy.idl" // for nsContentPolicyType
25 * imgILoader interface
27 * @author Stuart Parmenter <pavlov@netscape.com>
31 [scriptable
, builtinclass
, uuid(e61377d2
-910e-4c65
-a64b
-428d150e1fd1
)]
32 interface imgILoader
: nsISupports
34 // Extra flags to pass to loadImage if you want a load to use CORS
36 const unsigned long LOAD_CORS_ANONYMOUS
= 1 << 16;
37 const unsigned long LOAD_CORS_USE_CREDENTIALS
= 1 << 17;
40 * Start the load and decode of an image.
41 * @param aURI the URI to load
42 * @param aInitialDocumentURI the URI that 'initiated' the load -- used for
43 * 3rd party cookie blocking
44 * @param aReferrerInfo the referrer info to compute sending referrer.
45 * @param aLoadingPrincipal the principal of the loading document
46 * @param aLoadGroup Loadgroup to put the image load into
47 * @param aObserver the observer (may be null)
48 * @param aCX some random data
49 * @param aLoadFlags Load flags for the request
50 * @param aCacheKey cache key to use for a load if the original
51 * image came from a request that had post data
52 * @param aContentPolicyType [optional] the nsContentPolicyType to
53 * use for this load. Defaults to
54 * nsIContentPolicy::TYPE_IMAGE
57 * ImageLib does NOT keep a strong ref to the observer; this prevents
58 * reference cycles. This means that callers of loadImage should
59 * make sure to Cancel() the resulting request before the observer
62 imgIRequest loadImageXPCOM
(in nsIURI aURI
,
63 in nsIURI aInitialDocumentURL
,
64 in nsIReferrerInfo aReferrerInfo
,
65 in nsIPrincipal aLoadingPrincipal
,
66 in nsILoadGroup aLoadGroup
,
67 in imgINotificationObserver aObserver
,
69 in nsLoadFlags aLoadFlags
,
70 in nsISupports cacheKey
,
72 in nsContentPolicyType aContentPolicyType
);
75 * Start the load and decode of an image.
76 * @param aChannel the channel to load the image from. This must
77 * already be opened before ths method is called, and there
78 * must have been no OnDataAvailable calls for it yet.
79 * @param aObserver the observer (may be null)
80 * @param cx some random data
81 * @param aListener [out]
82 * A listener that you must send the channel's notifications and data
83 * to. Can be null, in which case imagelib has found a cached image
84 * and is not interested in the data. @aChannel will be canceled for
87 * ImageLib does NOT keep a strong ref to the observer; this prevents
88 * reference cycles. This means that callers of loadImageWithChannel should
89 * make sure to Cancel() the resulting request before the observer goes away.
91 imgIRequest loadImageWithChannelXPCOM
(in nsIChannel aChannel
,
92 in imgINotificationObserver aObserver
,
94 out nsIStreamListener aListener
);