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
;
11 interface nsIMutableArray
;
13 /* nsIGIOMimeApp holds information about an application that is looked up
14 with nsIGIOService::GetAppForMimeType. */
15 // 66009894-9877-405b-9321-bf30420e34e6 prev uuid
17 [scriptable
, uuid(ca6bad0c
-8a48
-48ac
-82c7
-27bb8f510fbe
)]
18 interface nsIGIOMimeApp
: nsIHandlerApp
20 const long EXPECTS_URIS
= 0;
21 const long EXPECTS_PATHS
= 1;
22 const long EXPECTS_URIS_FOR_NON_FILES
= 2;
24 readonly attribute AUTF8String
id;
25 readonly attribute AUTF8String command
;
26 readonly attribute
long expectsURIs
; // see constants above
27 readonly attribute nsIUTF8StringEnumerator supportedURISchemes
;
29 void setAsDefaultForMimeType
(in AUTF8String mimeType
);
30 void setAsDefaultForFileExtensions
(in AUTF8String extensions
);
31 void setAsDefaultForURIScheme
(in AUTF8String uriScheme
);
35 * The VFS service makes use of two distinct registries.
37 * The application registry holds information about applications (uniquely
38 * identified by id), such as which MIME types and URI schemes they are
39 * capable of handling, whether they run in a terminal, etc.
41 * The MIME registry holds information about MIME types, such as which
42 * extensions map to a given MIME type. The MIME registry also stores the
43 * id of the application selected to handle each MIME type.
46 // prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b
47 [scriptable
, uuid(eda22a30
-84e1
-4e16
-9ca0
-cd1553c2b34a
)]
48 interface nsIGIOService
: nsISupports
51 /*** MIME registry methods ***/
53 /* Obtain the MIME type registered for an extension. The extension
54 should not include a leading dot. */
55 AUTF8String getMimeTypeFromExtension
(in AUTF8String extension
);
57 /* Obtain the preferred application for opening a given URI scheme */
58 nsIHandlerApp getAppForURIScheme
(in AUTF8String aURIScheme
);
60 /* Obtain list of application capable of opening given URI scheme */
61 nsIMutableArray getAppsForURIScheme
(in AUTF8String aURIScheme
);
63 /* Obtain the preferred application for opening a given MIME type */
64 nsIHandlerApp getAppForMimeType
(in AUTF8String mimeType
);
66 /* Create application info for given command and name */
67 nsIGIOMimeApp createAppFromCommand
(in AUTF8String cmd
,
68 in AUTF8String appName
);
70 /* Find the application info by given command */
71 nsIGIOMimeApp findAppFromCommand
(in AUTF8String cmd
);
73 /* Obtain a description for the given MIME type */
74 AUTF8String getDescriptionForMimeType
(in AUTF8String mimeType
);
76 /*** Misc. methods ***/
78 /* Open the given URI in the default application */
79 void showURI
(in nsIURI uri
);
80 [noscript
] void showURIForInput
(in ACString uri
);
82 /* Open path in file manager using org.freedesktop.FileManager1 interface */
83 [noscript
] void orgFreedesktopFileManager1ShowItems
(in ACString path
);
85 /* Check if we're in flatpak runtime or using GTK portals has been enforced */
86 [noscript
] bool shouldUseFlatpakPortal
();
91 #define NS_GIOSERVICE_CONTRACTID
"@mozilla.org/gio-service;1"