nsIContentSniffer.idl (1296B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #include "nsISupports.idl" 6 7 interface nsIRequest; 8 9 /** 10 * Content sniffer interface. Components implementing this interface can 11 * determine a MIME type from a chunk of bytes. 12 */ 13 [scriptable, uuid(a5772d1b-fc63-495e-a169-96e8d3311af0)] 14 interface nsIContentSniffer : nsISupports 15 { 16 /** 17 * Given a chunk of data, determines a MIME type. Information from the given 18 * request may be used in order to make a better decision. 19 * 20 * @param aRequest The request where this data came from. May be null. 21 * @param aData Data to check 22 * @param aLength Length of the data 23 * 24 * @return The content type 25 * 26 * @throw NS_ERROR_NOT_AVAILABLE if no MIME type could be determined. 27 * 28 * @note Implementations should consider the request read-only. Especially, 29 * they should not attempt to set the content type property that subclasses of 30 * nsIRequest might offer. 31 */ 32 ACString getMIMETypeFromContent(in nsIRequest aRequest, 33 [const,array,size_is(aLength)] in octet aData, 34 in unsigned long aLength); 35 };