michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIRequest; michael@0: michael@0: /** michael@0: * Content sniffer interface. Components implementing this interface can michael@0: * determine a MIME type from a chunk of bytes. michael@0: */ michael@0: [scriptable, uuid(a5772d1b-fc63-495e-a169-96e8d3311af0)] michael@0: interface nsIContentSniffer : nsISupports michael@0: { michael@0: /** michael@0: * Given a chunk of data, determines a MIME type. Information from the given michael@0: * request may be used in order to make a better decision. michael@0: * michael@0: * @param aRequest The request where this data came from. May be null. michael@0: * @param aData Data to check michael@0: * @param aLength Length of the data michael@0: * michael@0: * @return The content type michael@0: * michael@0: * @throw NS_ERROR_NOT_AVAILABLE if no MIME type could be determined. michael@0: * michael@0: * @note Implementations should consider the request read-only. Especially, michael@0: * they should not attempt to set the content type property that subclasses of michael@0: * nsIRequest might offer. michael@0: */ michael@0: ACString getMIMETypeFromContent(in nsIRequest aRequest, michael@0: [const,array,size_is(aLength)] in octet aData, michael@0: in unsigned long aLength); michael@0: };