1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/uriloader/exthandler/nsIExternalHelperAppService.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,149 @@ 1.4 +/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsICancelable.idl" 1.11 + 1.12 +interface nsIURI; 1.13 +interface nsIRequest; 1.14 +interface nsIStreamListener; 1.15 +interface nsIFile; 1.16 +interface nsIMIMEInfo; 1.17 +interface nsIWebProgressListener2; 1.18 +interface nsIInterfaceRequestor; 1.19 + 1.20 +/** 1.21 + * The external helper app service is used for finding and launching 1.22 + * platform specific external applications for a given mime content type. 1.23 + */ 1.24 +[scriptable, uuid(9e456297-ba3e-42b1-92bd-b7db014268cb)] 1.25 +interface nsIExternalHelperAppService : nsISupports 1.26 +{ 1.27 + /** 1.28 + * Binds an external helper application to a stream listener. The caller 1.29 + * should pump data into the returned stream listener. When the OnStopRequest 1.30 + * is issued, the stream listener implementation will launch the helper app 1.31 + * with this data. 1.32 + * @param aMimeContentType The content type of the incoming data 1.33 + * @param aRequest The request corresponding to the incoming data 1.34 + * @param aWindowContext Use GetInterface to retrieve properties like the 1.35 + * dom window or parent window... 1.36 + * The service might need this in order to bring up dialogs. 1.37 + * @param aForceSave True to always save this content to disk, regardless of 1.38 + * nsIMIMEInfo and other such influences. 1.39 + * @return A nsIStreamListener which the caller should pump the data into. 1.40 + */ 1.41 + nsIStreamListener doContent (in ACString aMimeContentType, in nsIRequest aRequest, 1.42 + in nsIInterfaceRequestor aWindowContext, 1.43 + in boolean aForceSave); 1.44 + 1.45 + /** 1.46 + * Returns true if data from a URL with this extension combination 1.47 + * is to be decoded from aEncodingType prior to saving or passing 1.48 + * off to helper apps, false otherwise. 1.49 + */ 1.50 + boolean applyDecodingForExtension(in AUTF8String aExtension, 1.51 + in ACString aEncodingType); 1.52 + 1.53 +}; 1.54 + 1.55 +/** 1.56 + * This is a private interface shared between external app handlers and the platform specific 1.57 + * external helper app service 1.58 + */ 1.59 +[scriptable, uuid(6613e2e7-feab-4e3a-bb1f-b03200d544ec)] 1.60 +interface nsPIExternalAppLauncher : nsISupports 1.61 +{ 1.62 + /** 1.63 + * mscott --> eventually I should move this into a new service so other 1.64 + * consumers can add temporary files they want deleted on exit. 1.65 + * @param aTemporaryFile A temporary file we should delete on exit. 1.66 + */ 1.67 + void deleteTemporaryFileOnExit(in nsIFile aTemporaryFile); 1.68 + /** 1.69 + * Delete a temporary file created inside private browsing mode when 1.70 + * the private browsing mode has ended. 1.71 + */ 1.72 + void deleteTemporaryPrivateFileWhenPossible(in nsIFile aTemporaryFile); 1.73 +}; 1.74 + 1.75 +/** 1.76 + * A helper app launcher is a small object created to handle the launching 1.77 + * of an external application. 1.78 + * 1.79 + * Note that cancelling the load via the nsICancelable interface will release 1.80 + * the reference to the launcher dialog. 1.81 + */ 1.82 +[scriptable, uuid(acf2a516-7d7f-4771-8b22-6c4a559c088e)] 1.83 +interface nsIHelperAppLauncher : nsICancelable 1.84 +{ 1.85 + /** 1.86 + * The mime info object associated with the content type this helper app 1.87 + * launcher is currently attempting to load 1.88 + */ 1.89 + readonly attribute nsIMIMEInfo MIMEInfo; 1.90 + 1.91 + /** 1.92 + * The source uri 1.93 + */ 1.94 + readonly attribute nsIURI source; 1.95 + 1.96 + /** 1.97 + * The suggested name for this file 1.98 + */ 1.99 + readonly attribute AString suggestedFileName; 1.100 + 1.101 + /** 1.102 + * Saves the final destination of the file. Does not actually perform the 1.103 + * save. 1.104 + * NOTE: This will release the reference to the 1.105 + * nsIHelperAppLauncherDialog. 1.106 + */ 1.107 + void saveToDisk(in nsIFile aNewFileLocation, in boolean aRememberThisPreference); 1.108 + 1.109 + /** 1.110 + * Remembers that aApplication should be used to launch this content. Does 1.111 + * not actually launch the application. 1.112 + * NOTE: This will release the reference to the nsIHelperAppLauncherDialog. 1.113 + * @param aApplication nsIFile corresponding to the location of the application to use. 1.114 + * @param aRememberThisPreference TRUE if we should remember this choice. 1.115 + */ 1.116 + void launchWithApplication(in nsIFile aApplication, in boolean aRememberThisPreference); 1.117 + 1.118 + /** 1.119 + * Callback invoked by nsIHelperAppLauncherDialog::promptForSaveToFileAsync 1.120 + * after the user has chosen a file through the File Picker (or dismissed it). 1.121 + * @param aFile The file that was chosen by the user (or null if dialog was dismissed). 1.122 + */ 1.123 + void saveDestinationAvailable(in nsIFile aFile); 1.124 + 1.125 + /** 1.126 + * The following methods are used by the progress dialog to get or set 1.127 + * information on the current helper app launcher download. 1.128 + * This reference will be released when the download is finished (after the 1.129 + * listener receives the STATE_STOP notification). 1.130 + */ 1.131 + void setWebProgressListener(in nsIWebProgressListener2 aWebProgressListener); 1.132 + 1.133 + /** 1.134 + * The file we are saving to 1.135 + */ 1.136 + readonly attribute nsIFile targetFile; 1.137 + 1.138 + /** 1.139 + * The executable-ness of the target file 1.140 + */ 1.141 + readonly attribute boolean targetFileIsExecutable; 1.142 + 1.143 + /** 1.144 + * Time when the download started 1.145 + */ 1.146 + readonly attribute PRTime timeDownloadStarted; 1.147 + 1.148 + /** 1.149 + * The download content length, or -1 if the length is not available. 1.150 + */ 1.151 + readonly attribute int64_t contentLength; 1.152 +};