Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / netwerk / mime / public / nsIMIMEService.idl
blobce29b06ea5874de944e5a7fde515f9dabef331ae
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include "nsISupports.idl"
39 #include "nsIMIMEInfo.idl"
40 #include "nsIURI.idl"
41 #include "nsIFile.idl"
43 %{C++
44 #define NS_MIMESERVICE_CID \
45 { /* 03af31da-3109-11d3-8cd0-0060b0fc14a3 */ \
46 0x03af31da, \
47 0x3109, \
48 0x11d3, \
49 {0x8c, 0xd0, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
53 /**
54 * The MIME service is responsible for mapping file extensions to MIME-types
55 * (see RFC 2045). It also provides access to nsIMIMEInfo interfaces and
56 * acts as a general convenience wrapper of nsIMIMEInfo interfaces.
58 * The MIME service maintains a database with a <b>one</b> MIME type <b>to many</b>
59 * file extensions rule. Adding the same file extension to multiple MIME types
60 * is illegal and behavior is undefined.
62 * @see nsIMIMEInfo
64 [scriptable, uuid(5b3675a1-02db-4f8f-a560-b34736635f47)]
65 interface nsIMIMEService : nsISupports {
66 /**
67 * Retrieves an nsIMIMEInfo using both the extension
68 * and the type of a file. The type is given preference
69 * during the lookup. One of aMIMEType and aFileExt
70 * can be an empty string. At least one of aMIMEType and aFileExt
71 * must be nonempty.
73 nsIMIMEInfo getFromTypeAndExtension(in ACString aMIMEType, in AUTF8String aFileExt);
75 /**
76 * Retrieves a ACString representation of the MIME type
77 * associated with this file extension.
79 * @param A file extension (excluding the dot ('.')).
80 * @return The MIME type, if any.
82 ACString getTypeFromExtension(in AUTF8String aFileExt);
84 /**
85 * Retrieves a ACString representation of the MIME type
86 * associated with this URI. The association is purely
87 * file extension to MIME type based. No attempt to determine
88 * the type via server headers or byte scanning is made.
90 * @param The URI the user wants MIME info on.
91 * @return The MIME type, if any.
93 ACString getTypeFromURI(in nsIURI aURI);
96 ACString getTypeFromFile(in nsIFile aFile);
98 /**
99 * Given a Type/Extension combination, returns the default extension
100 * for this type. This may be identical to the passed-in extension.
102 * @param aMIMEType The Type to get information on. Must not be empty.
103 * @param aFileExt File Extension. Can be empty.
105 AUTF8String getPrimaryExtension(in ACString aMIMEType, in AUTF8String aFileExt);