2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-07-03 00:08:27 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1999-07-03 00:08:27 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-07-03 00:08:27 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-07-03 00:08:27 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* An nsIMIMEInfo gives a user access to mime information.
|
2000-01-24 18:41:03 +03:00
|
|
|
* there is a one-to-many relationship between MIME types
|
|
|
|
* and file extensions. This means that a MIMEInfo object
|
|
|
|
* may have multiple file extensions associated with it.
|
|
|
|
* However, the reverse is not true.
|
1999-07-03 00:08:27 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2001-07-16 06:40:48 +04:00
|
|
|
interface nsIURI;
|
2000-06-21 10:34:43 +04:00
|
|
|
interface nsIFile;
|
|
|
|
|
|
|
|
typedef long nsMIMEInfoHandleAction;
|
2000-04-05 07:03:50 +04:00
|
|
|
|
1999-07-03 00:08:27 +04:00
|
|
|
[scriptable, uuid(6A57EAE0-2FE8-11d3-A164-0050041CAF44)]
|
|
|
|
interface nsIMIMEInfo : nsISupports {
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Gives you an array of file types associated with this type.
|
2000-01-24 18:41:03 +03:00
|
|
|
*
|
|
|
|
* @return Number of elements in the array.
|
|
|
|
* @return Array of extensions.
|
|
|
|
*/
|
2003-01-12 04:14:35 +03:00
|
|
|
void GetFileExtensions(out PRUint32 elementCount,
|
2000-01-24 18:41:03 +03:00
|
|
|
[array, size_is(elementCount)] out string extensions);
|
1999-07-03 00:08:27 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Set File Extensions. Input is a comma delimited list of extensions.
|
|
|
|
*/
|
|
|
|
void SetFileExtensions( in string aExtensions );
|
2000-04-19 08:45:30 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Returns whether or not the given extension is
|
2000-01-24 18:41:03 +03:00
|
|
|
* associated with this MIME info.
|
|
|
|
*
|
2003-01-12 04:14:35 +03:00
|
|
|
* @return TRUE if the association exists.
|
2000-01-24 18:41:03 +03:00
|
|
|
*/
|
|
|
|
boolean ExtensionExists(in string aExtension);
|
1999-07-03 00:08:27 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Append a given extension to the set of extensions
|
|
|
|
*/
|
2000-04-05 07:03:50 +04:00
|
|
|
void AppendExtension(in string aExtension);
|
2000-01-24 18:41:03 +03:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Returns a clone of this MIMEInfo.
|
2001-12-12 04:02:26 +03:00
|
|
|
*
|
|
|
|
* @return A clone of the MIMEInfo
|
|
|
|
*/
|
|
|
|
nsIMIMEInfo clone();
|
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Returns the first extension association in
|
2002-01-16 07:28:06 +03:00
|
|
|
* the internal set of extensions.
|
|
|
|
*
|
|
|
|
* @return The first extension.
|
|
|
|
*/
|
|
|
|
attribute string primaryExtension;
|
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* The MIME type of this MIMEInfo.
|
2000-01-24 18:41:03 +03:00
|
|
|
*
|
|
|
|
* @return String representing the MIME type.
|
|
|
|
*/
|
2003-01-12 04:14:35 +03:00
|
|
|
attribute string MIMEType;
|
2000-01-24 18:41:03 +03:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* A human readable description of the MIME info.
|
2000-01-24 18:41:03 +03:00
|
|
|
*
|
|
|
|
* @return The description
|
|
|
|
*/
|
2003-01-12 04:14:35 +03:00
|
|
|
attribute wstring Description;
|
2000-01-24 18:41:03 +03:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Gives you arbitrary data about the MIMEInfo. An example
|
2000-01-24 18:41:03 +03:00
|
|
|
* of this is a generic image graphically representing
|
|
|
|
* this MIME info. This image can be used to generically
|
|
|
|
* and graphically represent the type.
|
|
|
|
*
|
|
|
|
* @return A URI representing the data location.
|
|
|
|
*/
|
|
|
|
readonly attribute nsIURI DataURI;
|
2000-04-05 07:03:50 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* Mac Type and creator types
|
2000-04-05 07:03:50 +04:00
|
|
|
*/
|
2003-01-12 04:14:35 +03:00
|
|
|
attribute PRUint32 MacType;
|
|
|
|
attribute PRUint32 MacCreator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether or not these two MIME infos are logically
|
2003-03-19 07:35:08 +03:00
|
|
|
* equivalent maintaining the one-to-many relationship between
|
2000-01-24 18:41:03 +03:00
|
|
|
* MIME types and file extensions.
|
|
|
|
*
|
|
|
|
* @returns TRUE if the two are considered equal
|
|
|
|
*/
|
2003-01-12 04:14:35 +03:00
|
|
|
boolean Equals(in nsIMIMEInfo aMIMEInfo);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a nsIFile that points to the application the user has said
|
|
|
|
* they want associated with this content type. This is not always
|
|
|
|
* guaranteed to be set!!
|
|
|
|
*/
|
|
|
|
attribute nsIFile preferredApplicationHandler;
|
2000-06-21 10:34:43 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* a pretty name description of the associated application
|
|
|
|
*/
|
|
|
|
attribute wstring applicationDescription;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a nsIFile that points to the application that is associated
|
|
|
|
* by default with this content type. This will usually be specified in
|
|
|
|
* the platform settings somehow. This is not always guaranteed
|
|
|
|
* to be set!!
|
|
|
|
*/
|
|
|
|
attribute nsIFile defaultApplicationHandler;
|
2000-06-21 10:34:43 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
/**
|
|
|
|
* a pretty name description of the default application
|
|
|
|
*/
|
|
|
|
attribute wstring defaultDescription;
|
2000-06-21 10:34:43 +04:00
|
|
|
|
2003-01-12 04:14:35 +03:00
|
|
|
const long saveToDisk = 0;
|
2000-06-21 10:34:43 +04:00
|
|
|
const long alwaysAsk = 1;
|
|
|
|
const long useHelperApp = 2;
|
2003-01-12 04:14:35 +03:00
|
|
|
const long handleInternally = 3;
|
|
|
|
const long useSystemDefault = 4;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* preferredAction is how the user specified they would like to handle
|
|
|
|
* this content type: save to disk, use specified helper app, use OS
|
|
|
|
* default handler or handle using navigator.
|
|
|
|
*/
|
|
|
|
attribute nsMIMEInfoHandleAction preferredAction;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* alwaysAskBeforeHandling: if true, we should always give the user a
|
|
|
|
* dialog asking how to dispose of this content.
|
|
|
|
*/
|
|
|
|
attribute boolean alwaysAskBeforeHandling;
|
2000-04-28 14:51:52 +04:00
|
|
|
};
|
2000-06-21 10:34:43 +04:00
|
|
|
|
|
|
|
%{C++
|
|
|
|
#define NS_MIMEINFO_CID \
|
|
|
|
{ /* {95df6583-0001-11d4-a12b-a66ef662f0bc} */ \
|
|
|
|
0x95df6583, \
|
|
|
|
0x0001, \
|
|
|
|
0x11d4, \
|
|
|
|
{ 0xa1, 0x2b, 0xa6, 0x6e, 0xf6, 0x62, 0xf0, 0xbc } \
|
|
|
|
}
|
|
|
|
|
2000-09-14 03:57:52 +04:00
|
|
|
#define NS_MIMEINFO_CONTRACTID "@mozilla.org/mime-info;1"
|
2000-06-21 10:34:43 +04:00
|
|
|
%}
|