imgILoader.idl (4035B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 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/. */ 6 7 #include "nsISupports.idl" 8 9 interface imgINotificationObserver; 10 interface imgIRequest; 11 12 interface nsIChannel; 13 interface nsILoadGroup; 14 interface nsIPrincipal; 15 interface nsIStreamListener; 16 interface nsIURI; 17 interface nsIReferrerInfo; 18 19 interface nsISimpleEnumerator; 20 21 webidl Document; 22 23 #include "nsIRequest.idl" // for nsLoadFlags 24 #include "nsIContentPolicy.idl" // for nsContentPolicyType 25 26 /** 27 * imgILoader interface 28 * 29 * @author Stuart Parmenter <pavlov@netscape.com> 30 * @version 0.3 31 * @see imagelib2 32 */ 33 [scriptable, builtinclass, uuid(e61377d2-910e-4c65-a64b-428d150e1fd1)] 34 interface imgILoader : nsISupports 35 { 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; 40 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 57 58 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. 63 */ 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); 75 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. 88 * 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. 92 */ 93 imgIRequest loadImageWithChannelXPCOM(in nsIChannel aChannel, 94 in imgINotificationObserver aObserver, 95 in Document aLoadingDocument, 96 out nsIStreamListener aListener); 97 };