Backed out changeset 46540ac0fc04 (bug 1945637) for causing multiple failures CLOSED...
[gecko.git] / xpcom / system / nsIGIOService.idl
blobd7c22834fdad586a61d0cc9643dd1ea699e2c08d
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;
10 interface nsIURI;
11 interface nsIFile;
12 interface nsIMutableArray;
14 [scriptable, uuid(eb5a6937-addc-4d5d-85e6-f11798f90a0a)]
15 interface nsIGIOHandlerApp : nsIHandlerApp
17 readonly attribute AUTF8String id;
18 /* Launch files */
19 void launchFile(in AUTF8String fileName);
20 AUTF8String getMozIconURL();
23 /* nsIGIOMimeApp holds information about an application that is looked up
24 with nsIGIOService::GetAppForMimeType. */
25 // 66009894-9877-405b-9321-bf30420e34e6 prev uuid
27 [scriptable, uuid(ca6bad0c-8a48-48ac-82c7-27bb8f510fbe)]
28 interface nsIGIOMimeApp : nsIHandlerApp
30 const long EXPECTS_URIS = 0;
31 const long EXPECTS_PATHS = 1;
32 const long EXPECTS_URIS_FOR_NON_FILES = 2;
34 readonly attribute AUTF8String id;
35 readonly attribute AUTF8String command;
36 readonly attribute long expectsURIs; // see constants above
37 readonly attribute nsIUTF8StringEnumerator supportedURISchemes;
39 void setAsDefaultForMimeType(in AUTF8String mimeType);
40 void setAsDefaultForFileExtensions(in AUTF8String extensions);
41 void setAsDefaultForURIScheme(in AUTF8String uriScheme);
45 * The VFS service makes use of two distinct registries.
47 * The application registry holds information about applications (uniquely
48 * identified by id), such as which MIME types and URI schemes they are
49 * capable of handling, whether they run in a terminal, etc.
51 * The MIME registry holds information about MIME types, such as which
52 * extensions map to a given MIME type. The MIME registry also stores the
53 * id of the application selected to handle each MIME type.
56 // prev id eda22a30-84e1-4e16-9ca0-cd1553c2b34a
57 [scriptable, builtinclass, uuid(51583703-cafc-4769-9ff1-edb349151930)]
58 interface nsIGIOService : nsISupports
61 /*** MIME registry methods ***/
63 /* Obtain the MIME type registered for an extension. The extension
64 should not include a leading dot. */
65 AUTF8String getMimeTypeFromExtension(in AUTF8String extension);
67 /* Obtain the preferred application for opening a given URI scheme */
68 nsIHandlerApp getAppForURIScheme(in AUTF8String aURIScheme);
70 /* Obtain list of application capable of opening given URI scheme */
71 nsIMutableArray getAppsForURIScheme(in AUTF8String aURIScheme);
73 /* Obtain the preferred application for opening a given MIME type */
74 nsIHandlerApp getAppForMimeType(in AUTF8String mimeType);
76 /* Create application info from given application desktop filename */
77 nsIGIOHandlerApp createHandlerAppFromAppId(in string appId);
79 /* Create application info for given command and name */
80 nsIGIOMimeApp createAppFromCommand(in AUTF8String cmd,
81 in AUTF8String appName);
83 /* Find the application info by given command */
84 nsIGIOMimeApp findAppFromCommand(in AUTF8String cmd);
86 /* Obtain a description for the given MIME type */
87 AUTF8String getDescriptionForMimeType(in AUTF8String mimeType);
89 /*** Misc. methods ***/
90 [infallible] readonly attribute boolean isRunningUnderFlatpak;
91 [infallible] readonly attribute boolean isRunningUnderSnap;
93 /* Open the given URI in the default application */
94 [noscript] void showURI(in nsIURI uri);
95 [noscript] void revealFile(in nsIFile file);
96 [noscript] void launchFile(in ACString path);
99 %{C++
100 #define NS_GIOSERVICE_CONTRACTID "@mozilla.org/gio-service;1"