1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/system/nsIGIOService.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,82 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIUTF8StringEnumerator; 1.12 +interface nsIURI; 1.13 + 1.14 +/* nsIGIOMimeApp holds information about an application that is looked up 1.15 + with nsIGIOService::GetAppForMimeType. */ 1.16 +// 66009894-9877-405b-9321-bf30420e34e6 prev uuid 1.17 + 1.18 +[scriptable, uuid(ca6bad0c-8a48-48ac-82c7-27bb8f510fbe)] 1.19 +interface nsIGIOMimeApp : nsISupports 1.20 +{ 1.21 + const long EXPECTS_URIS = 0; 1.22 + const long EXPECTS_PATHS = 1; 1.23 + const long EXPECTS_URIS_FOR_NON_FILES = 2; 1.24 + 1.25 + readonly attribute AUTF8String id; 1.26 + readonly attribute AUTF8String name; 1.27 + readonly attribute AUTF8String command; 1.28 + readonly attribute long expectsURIs; // see constants above 1.29 + readonly attribute nsIUTF8StringEnumerator supportedURISchemes; 1.30 + 1.31 + void launch(in AUTF8String uri); 1.32 + void setAsDefaultForMimeType(in AUTF8String mimeType); 1.33 + void setAsDefaultForFileExtensions(in AUTF8String extensions); 1.34 + void setAsDefaultForURIScheme(in AUTF8String uriScheme); 1.35 +}; 1.36 + 1.37 +/* 1.38 + * The VFS service makes use of two distinct registries. 1.39 + * 1.40 + * The application registry holds information about applications (uniquely 1.41 + * identified by id), such as which MIME types and URI schemes they are 1.42 + * capable of handling, whether they run in a terminal, etc. 1.43 + * 1.44 + * The MIME registry holds information about MIME types, such as which 1.45 + * extensions map to a given MIME type. The MIME registry also stores the 1.46 + * id of the application selected to handle each MIME type. 1.47 + */ 1.48 + 1.49 +// prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b 1.50 +[scriptable, uuid(eda22a30-84e1-4e16-9ca0-cd1553c2b34a)] 1.51 +interface nsIGIOService : nsISupports 1.52 +{ 1.53 + 1.54 + /*** MIME registry methods ***/ 1.55 + 1.56 + /* Obtain the MIME type registered for an extension. The extension 1.57 + should not include a leading dot. */ 1.58 + AUTF8String getMimeTypeFromExtension(in AUTF8String extension); 1.59 + 1.60 + /* Obtain the preferred application for opening a given URI scheme */ 1.61 + nsIGIOMimeApp getAppForURIScheme(in AUTF8String aURIScheme); 1.62 + 1.63 + /* Obtain the preferred application for opening a given MIME type */ 1.64 + nsIGIOMimeApp getAppForMimeType(in AUTF8String mimeType); 1.65 + 1.66 + /* Obtain the preferred application for opening a given MIME type */ 1.67 + nsIGIOMimeApp createAppFromCommand(in AUTF8String cmd, 1.68 + in AUTF8String appName); 1.69 + 1.70 + /* Obtain a description for the given MIME type */ 1.71 + AUTF8String getDescriptionForMimeType(in AUTF8String mimeType); 1.72 + 1.73 + /*** Misc. methods ***/ 1.74 + 1.75 + /* Open the given URI in the default application */ 1.76 + void showURI(in nsIURI uri); 1.77 + [noscript] void showURIForInput(in ACString uri); 1.78 + 1.79 + /* Open path in file manager using org.freedesktop.FileManager1 interface */ 1.80 + [noscript] void orgFreedesktopFileManager1ShowItems(in ACString path); 1.81 +}; 1.82 + 1.83 +%{C++ 1.84 +#define NS_GIOSERVICE_CONTRACTID "@mozilla.org/gio-service;1" 1.85 +%}