Bug 1728955: part 8) Refactor `DisplayErrCode` in Windows' `nsClipboard`. r=masayuki
[gecko.git] / image / imgILoader.idl
bloba8514790a03d582ab7504fb8c78beebe5dcc1ea4
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;
12 interface nsIChannel;
13 interface nsILoadGroup;
14 interface nsIPrincipal;
15 interface nsIStreamListener;
16 interface nsIURI;
17 interface nsIReferrerInfo;
19 interface nsISimpleEnumerator;
21 webidl Document;
23 #include "nsIRequest.idl" // for nsLoadFlags
24 #include "nsIContentPolicy.idl" // for nsContentPolicyType
26 /**
27 * imgILoader interface
29 * @author Stuart Parmenter <pavlov@netscape.com>
30 * @version 0.3
31 * @see imagelib2
33 [scriptable, builtinclass, uuid(e61377d2-910e-4c65-a64b-428d150e1fd1)]
34 interface imgILoader : nsISupports
36 // Extra flags to pass to loadImage if you want a load to use CORS
37 // validation.
38 const unsigned long LOAD_CORS_ANONYMOUS = 1 << 16;
39 const unsigned long LOAD_CORS_USE_CREDENTIALS = 1 << 17;
41 /**
42 * Start the load and decode of an image.
43 * @param aURI the URI to load
44 * @param aInitialDocumentURI the URI that 'initiated' the load -- used for
45 * 3rd party cookie blocking
46 * @param aReferrerInfo the referrer info to compute sending referrer.
47 * @param aLoadingPrincipal the principal of the loading document
48 * @param aLoadGroup Loadgroup to put the image load into
49 * @param aObserver the observer (may be null)
50 * @param aLoadingDocument loading document
51 * @param aLoadFlags Load flags for the request
52 * @param aCacheKey cache key to use for a load if the original
53 * image came from a request that had post data
54 * @param aContentPolicyType [optional] the nsContentPolicyType to
55 * use for this load. Defaults to
56 * nsIContentPolicy::TYPE_IMAGE
59 * ImageLib does NOT keep a strong ref to the observer; this prevents
60 * reference cycles. This means that callers of loadImage should
61 * make sure to Cancel() the resulting request before the observer
62 * goes away.
64 imgIRequest loadImageXPCOM(in nsIURI aURI,
65 in nsIURI aInitialDocumentURL,
66 in nsIReferrerInfo aReferrerInfo,
67 in nsIPrincipal aLoadingPrincipal,
68 in nsILoadGroup aLoadGroup,
69 in imgINotificationObserver aObserver,
70 in Document aLoadingDocument,
71 in nsLoadFlags aLoadFlags,
72 in nsISupports cacheKey,
73 [optional]
74 in nsContentPolicyType aContentPolicyType);
76 /**
77 * Start the load and decode of an image.
78 * @param aChannel the channel to load the image from. This must
79 * already be opened before this method is called, and there
80 * must have been no OnDataAvailable calls for it yet.
81 * @param aObserver the observer (may be null)
82 * @param aLoadingDocument loading document
83 * @param aListener [out]
84 * A listener that you must send the channel's notifications and data
85 * to. Can be null, in which case imagelib has found a cached image
86 * and is not interested in the data. @aChannel will be canceled for
87 * you in this case.
89 * ImageLib does NOT keep a strong ref to the observer; this prevents
90 * reference cycles. This means that callers of loadImageWithChannel should
91 * make sure to Cancel() the resulting request before the observer goes away.
93 imgIRequest loadImageWithChannelXPCOM(in nsIChannel aChannel,
94 in imgINotificationObserver aObserver,
95 in Document aLoadingDocument,
96 out nsIStreamListener aListener);