michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIUTF8StringEnumerator; michael@0: interface nsIURI; michael@0: michael@0: /* nsIGIOMimeApp holds information about an application that is looked up michael@0: with nsIGIOService::GetAppForMimeType. */ michael@0: // 66009894-9877-405b-9321-bf30420e34e6 prev uuid michael@0: michael@0: [scriptable, uuid(ca6bad0c-8a48-48ac-82c7-27bb8f510fbe)] michael@0: interface nsIGIOMimeApp : nsISupports michael@0: { michael@0: const long EXPECTS_URIS = 0; michael@0: const long EXPECTS_PATHS = 1; michael@0: const long EXPECTS_URIS_FOR_NON_FILES = 2; michael@0: michael@0: readonly attribute AUTF8String id; michael@0: readonly attribute AUTF8String name; michael@0: readonly attribute AUTF8String command; michael@0: readonly attribute long expectsURIs; // see constants above michael@0: readonly attribute nsIUTF8StringEnumerator supportedURISchemes; michael@0: michael@0: void launch(in AUTF8String uri); michael@0: void setAsDefaultForMimeType(in AUTF8String mimeType); michael@0: void setAsDefaultForFileExtensions(in AUTF8String extensions); michael@0: void setAsDefaultForURIScheme(in AUTF8String uriScheme); michael@0: }; michael@0: michael@0: /* michael@0: * The VFS service makes use of two distinct registries. michael@0: * michael@0: * The application registry holds information about applications (uniquely michael@0: * identified by id), such as which MIME types and URI schemes they are michael@0: * capable of handling, whether they run in a terminal, etc. michael@0: * michael@0: * The MIME registry holds information about MIME types, such as which michael@0: * extensions map to a given MIME type. The MIME registry also stores the michael@0: * id of the application selected to handle each MIME type. michael@0: */ michael@0: michael@0: // prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b michael@0: [scriptable, uuid(eda22a30-84e1-4e16-9ca0-cd1553c2b34a)] michael@0: interface nsIGIOService : nsISupports michael@0: { michael@0: michael@0: /*** MIME registry methods ***/ michael@0: michael@0: /* Obtain the MIME type registered for an extension. The extension michael@0: should not include a leading dot. */ michael@0: AUTF8String getMimeTypeFromExtension(in AUTF8String extension); michael@0: michael@0: /* Obtain the preferred application for opening a given URI scheme */ michael@0: nsIGIOMimeApp getAppForURIScheme(in AUTF8String aURIScheme); michael@0: michael@0: /* Obtain the preferred application for opening a given MIME type */ michael@0: nsIGIOMimeApp getAppForMimeType(in AUTF8String mimeType); michael@0: michael@0: /* Obtain the preferred application for opening a given MIME type */ michael@0: nsIGIOMimeApp createAppFromCommand(in AUTF8String cmd, michael@0: in AUTF8String appName); michael@0: michael@0: /* Obtain a description for the given MIME type */ michael@0: AUTF8String getDescriptionForMimeType(in AUTF8String mimeType); michael@0: michael@0: /*** Misc. methods ***/ michael@0: michael@0: /* Open the given URI in the default application */ michael@0: void showURI(in nsIURI uri); michael@0: [noscript] void showURIForInput(in ACString uri); michael@0: michael@0: /* Open path in file manager using org.freedesktop.FileManager1 interface */ michael@0: [noscript] void orgFreedesktopFileManager1ShowItems(in ACString path); michael@0: }; michael@0: michael@0: %{C++ michael@0: #define NS_GIOSERVICE_CONTRACTID "@mozilla.org/gio-service;1" michael@0: %}