michael@0: /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * 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 "nsICancelable.idl" michael@0: michael@0: interface nsIURI; michael@0: interface nsIRequest; michael@0: interface nsIStreamListener; michael@0: interface nsIFile; michael@0: interface nsIMIMEInfo; michael@0: interface nsIWebProgressListener2; michael@0: interface nsIInterfaceRequestor; michael@0: michael@0: /** michael@0: * The external helper app service is used for finding and launching michael@0: * platform specific external applications for a given mime content type. michael@0: */ michael@0: [scriptable, uuid(9e456297-ba3e-42b1-92bd-b7db014268cb)] michael@0: interface nsIExternalHelperAppService : nsISupports michael@0: { michael@0: /** michael@0: * Binds an external helper application to a stream listener. The caller michael@0: * should pump data into the returned stream listener. When the OnStopRequest michael@0: * is issued, the stream listener implementation will launch the helper app michael@0: * with this data. michael@0: * @param aMimeContentType The content type of the incoming data michael@0: * @param aRequest The request corresponding to the incoming data michael@0: * @param aWindowContext Use GetInterface to retrieve properties like the michael@0: * dom window or parent window... michael@0: * The service might need this in order to bring up dialogs. michael@0: * @param aForceSave True to always save this content to disk, regardless of michael@0: * nsIMIMEInfo and other such influences. michael@0: * @return A nsIStreamListener which the caller should pump the data into. michael@0: */ michael@0: nsIStreamListener doContent (in ACString aMimeContentType, in nsIRequest aRequest, michael@0: in nsIInterfaceRequestor aWindowContext, michael@0: in boolean aForceSave); michael@0: michael@0: /** michael@0: * Returns true if data from a URL with this extension combination michael@0: * is to be decoded from aEncodingType prior to saving or passing michael@0: * off to helper apps, false otherwise. michael@0: */ michael@0: boolean applyDecodingForExtension(in AUTF8String aExtension, michael@0: in ACString aEncodingType); michael@0: michael@0: }; michael@0: michael@0: /** michael@0: * This is a private interface shared between external app handlers and the platform specific michael@0: * external helper app service michael@0: */ michael@0: [scriptable, uuid(6613e2e7-feab-4e3a-bb1f-b03200d544ec)] michael@0: interface nsPIExternalAppLauncher : nsISupports michael@0: { michael@0: /** michael@0: * mscott --> eventually I should move this into a new service so other michael@0: * consumers can add temporary files they want deleted on exit. michael@0: * @param aTemporaryFile A temporary file we should delete on exit. michael@0: */ michael@0: void deleteTemporaryFileOnExit(in nsIFile aTemporaryFile); michael@0: /** michael@0: * Delete a temporary file created inside private browsing mode when michael@0: * the private browsing mode has ended. michael@0: */ michael@0: void deleteTemporaryPrivateFileWhenPossible(in nsIFile aTemporaryFile); michael@0: }; michael@0: michael@0: /** michael@0: * A helper app launcher is a small object created to handle the launching michael@0: * of an external application. michael@0: * michael@0: * Note that cancelling the load via the nsICancelable interface will release michael@0: * the reference to the launcher dialog. michael@0: */ michael@0: [scriptable, uuid(acf2a516-7d7f-4771-8b22-6c4a559c088e)] michael@0: interface nsIHelperAppLauncher : nsICancelable michael@0: { michael@0: /** michael@0: * The mime info object associated with the content type this helper app michael@0: * launcher is currently attempting to load michael@0: */ michael@0: readonly attribute nsIMIMEInfo MIMEInfo; michael@0: michael@0: /** michael@0: * The source uri michael@0: */ michael@0: readonly attribute nsIURI source; michael@0: michael@0: /** michael@0: * The suggested name for this file michael@0: */ michael@0: readonly attribute AString suggestedFileName; michael@0: michael@0: /** michael@0: * Saves the final destination of the file. Does not actually perform the michael@0: * save. michael@0: * NOTE: This will release the reference to the michael@0: * nsIHelperAppLauncherDialog. michael@0: */ michael@0: void saveToDisk(in nsIFile aNewFileLocation, in boolean aRememberThisPreference); michael@0: michael@0: /** michael@0: * Remembers that aApplication should be used to launch this content. Does michael@0: * not actually launch the application. michael@0: * NOTE: This will release the reference to the nsIHelperAppLauncherDialog. michael@0: * @param aApplication nsIFile corresponding to the location of the application to use. michael@0: * @param aRememberThisPreference TRUE if we should remember this choice. michael@0: */ michael@0: void launchWithApplication(in nsIFile aApplication, in boolean aRememberThisPreference); michael@0: michael@0: /** michael@0: * Callback invoked by nsIHelperAppLauncherDialog::promptForSaveToFileAsync michael@0: * after the user has chosen a file through the File Picker (or dismissed it). michael@0: * @param aFile The file that was chosen by the user (or null if dialog was dismissed). michael@0: */ michael@0: void saveDestinationAvailable(in nsIFile aFile); michael@0: michael@0: /** michael@0: * The following methods are used by the progress dialog to get or set michael@0: * information on the current helper app launcher download. michael@0: * This reference will be released when the download is finished (after the michael@0: * listener receives the STATE_STOP notification). michael@0: */ michael@0: void setWebProgressListener(in nsIWebProgressListener2 aWebProgressListener); michael@0: michael@0: /** michael@0: * The file we are saving to michael@0: */ michael@0: readonly attribute nsIFile targetFile; michael@0: michael@0: /** michael@0: * The executable-ness of the target file michael@0: */ michael@0: readonly attribute boolean targetFileIsExecutable; michael@0: michael@0: /** michael@0: * Time when the download started michael@0: */ michael@0: readonly attribute PRTime timeDownloadStarted; michael@0: michael@0: /** michael@0: * The download content length, or -1 if the length is not available. michael@0: */ michael@0: readonly attribute int64_t contentLength; michael@0: };