1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
7 #include
"nsIMIMEInfo.idl"
9 interface nsIUTF8StringEnumerator
;
12 interface nsIMutableArray
;
14 /* nsIGIOMimeApp holds information about an application that is looked up
15 with nsIGIOService::GetAppForMimeType. */
16 // 66009894-9877-405b-9321-bf30420e34e6 prev uuid
18 [scriptable
, uuid(ca6bad0c
-8a48
-48ac
-82c7
-27bb8f510fbe
)]
19 interface nsIGIOMimeApp
: nsIHandlerApp
21 const long EXPECTS_URIS
= 0;
22 const long EXPECTS_PATHS
= 1;
23 const long EXPECTS_URIS_FOR_NON_FILES
= 2;
25 readonly attribute AUTF8String
id;
26 readonly attribute AUTF8String command
;
27 readonly attribute
long expectsURIs
; // see constants above
28 readonly attribute nsIUTF8StringEnumerator supportedURISchemes
;
30 void setAsDefaultForMimeType
(in AUTF8String mimeType
);
31 void setAsDefaultForFileExtensions
(in AUTF8String extensions
);
32 void setAsDefaultForURIScheme
(in AUTF8String uriScheme
);
36 * The VFS service makes use of two distinct registries.
38 * The application registry holds information about applications (uniquely
39 * identified by id), such as which MIME types and URI schemes they are
40 * capable of handling, whether they run in a terminal, etc.
42 * The MIME registry holds information about MIME types, such as which
43 * extensions map to a given MIME type. The MIME registry also stores the
44 * id of the application selected to handle each MIME type.
47 // prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b
48 [scriptable
, builtinclass
, uuid(eda22a30
-84e1
-4e16
-9ca0
-cd1553c2b34a
)]
49 interface nsIGIOService
: nsISupports
52 /*** MIME registry methods ***/
54 /* Obtain the MIME type registered for an extension. The extension
55 should not include a leading dot. */
56 AUTF8String getMimeTypeFromExtension
(in AUTF8String extension
);
58 /* Obtain the preferred application for opening a given URI scheme */
59 nsIHandlerApp getAppForURIScheme
(in AUTF8String aURIScheme
);
61 /* Obtain list of application capable of opening given URI scheme */
62 nsIMutableArray getAppsForURIScheme
(in AUTF8String aURIScheme
);
64 /* Obtain the preferred application for opening a given MIME type */
65 nsIHandlerApp getAppForMimeType
(in AUTF8String mimeType
);
67 /* Create application info for given command and name */
68 nsIGIOMimeApp createAppFromCommand
(in AUTF8String cmd
,
69 in AUTF8String appName
);
71 /* Find the application info by given command */
72 nsIGIOMimeApp findAppFromCommand
(in AUTF8String cmd
);
74 /* Obtain a description for the given MIME type */
75 AUTF8String getDescriptionForMimeType
(in AUTF8String mimeType
);
77 /*** Misc. methods ***/
79 /* Open the given URI in the default application */
80 [noscript
] void showURI
(in nsIURI uri
);
81 [noscript
] void revealFile
(in nsIFile file
);
82 [noscript
] void launchFile
(in ACString path
);
86 #define NS_GIOSERVICE_CONTRACTID
"@mozilla.org/gio-service;1"