uriloader/exthandler/nsIExternalHelperAppService.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "nsICancelable.idl"
michael@0 8
michael@0 9 interface nsIURI;
michael@0 10 interface nsIRequest;
michael@0 11 interface nsIStreamListener;
michael@0 12 interface nsIFile;
michael@0 13 interface nsIMIMEInfo;
michael@0 14 interface nsIWebProgressListener2;
michael@0 15 interface nsIInterfaceRequestor;
michael@0 16
michael@0 17 /**
michael@0 18 * The external helper app service is used for finding and launching
michael@0 19 * platform specific external applications for a given mime content type.
michael@0 20 */
michael@0 21 [scriptable, uuid(9e456297-ba3e-42b1-92bd-b7db014268cb)]
michael@0 22 interface nsIExternalHelperAppService : nsISupports
michael@0 23 {
michael@0 24 /**
michael@0 25 * Binds an external helper application to a stream listener. The caller
michael@0 26 * should pump data into the returned stream listener. When the OnStopRequest
michael@0 27 * is issued, the stream listener implementation will launch the helper app
michael@0 28 * with this data.
michael@0 29 * @param aMimeContentType The content type of the incoming data
michael@0 30 * @param aRequest The request corresponding to the incoming data
michael@0 31 * @param aWindowContext Use GetInterface to retrieve properties like the
michael@0 32 * dom window or parent window...
michael@0 33 * The service might need this in order to bring up dialogs.
michael@0 34 * @param aForceSave True to always save this content to disk, regardless of
michael@0 35 * nsIMIMEInfo and other such influences.
michael@0 36 * @return A nsIStreamListener which the caller should pump the data into.
michael@0 37 */
michael@0 38 nsIStreamListener doContent (in ACString aMimeContentType, in nsIRequest aRequest,
michael@0 39 in nsIInterfaceRequestor aWindowContext,
michael@0 40 in boolean aForceSave);
michael@0 41
michael@0 42 /**
michael@0 43 * Returns true if data from a URL with this extension combination
michael@0 44 * is to be decoded from aEncodingType prior to saving or passing
michael@0 45 * off to helper apps, false otherwise.
michael@0 46 */
michael@0 47 boolean applyDecodingForExtension(in AUTF8String aExtension,
michael@0 48 in ACString aEncodingType);
michael@0 49
michael@0 50 };
michael@0 51
michael@0 52 /**
michael@0 53 * This is a private interface shared between external app handlers and the platform specific
michael@0 54 * external helper app service
michael@0 55 */
michael@0 56 [scriptable, uuid(6613e2e7-feab-4e3a-bb1f-b03200d544ec)]
michael@0 57 interface nsPIExternalAppLauncher : nsISupports
michael@0 58 {
michael@0 59 /**
michael@0 60 * mscott --> eventually I should move this into a new service so other
michael@0 61 * consumers can add temporary files they want deleted on exit.
michael@0 62 * @param aTemporaryFile A temporary file we should delete on exit.
michael@0 63 */
michael@0 64 void deleteTemporaryFileOnExit(in nsIFile aTemporaryFile);
michael@0 65 /**
michael@0 66 * Delete a temporary file created inside private browsing mode when
michael@0 67 * the private browsing mode has ended.
michael@0 68 */
michael@0 69 void deleteTemporaryPrivateFileWhenPossible(in nsIFile aTemporaryFile);
michael@0 70 };
michael@0 71
michael@0 72 /**
michael@0 73 * A helper app launcher is a small object created to handle the launching
michael@0 74 * of an external application.
michael@0 75 *
michael@0 76 * Note that cancelling the load via the nsICancelable interface will release
michael@0 77 * the reference to the launcher dialog.
michael@0 78 */
michael@0 79 [scriptable, uuid(acf2a516-7d7f-4771-8b22-6c4a559c088e)]
michael@0 80 interface nsIHelperAppLauncher : nsICancelable
michael@0 81 {
michael@0 82 /**
michael@0 83 * The mime info object associated with the content type this helper app
michael@0 84 * launcher is currently attempting to load
michael@0 85 */
michael@0 86 readonly attribute nsIMIMEInfo MIMEInfo;
michael@0 87
michael@0 88 /**
michael@0 89 * The source uri
michael@0 90 */
michael@0 91 readonly attribute nsIURI source;
michael@0 92
michael@0 93 /**
michael@0 94 * The suggested name for this file
michael@0 95 */
michael@0 96 readonly attribute AString suggestedFileName;
michael@0 97
michael@0 98 /**
michael@0 99 * Saves the final destination of the file. Does not actually perform the
michael@0 100 * save.
michael@0 101 * NOTE: This will release the reference to the
michael@0 102 * nsIHelperAppLauncherDialog.
michael@0 103 */
michael@0 104 void saveToDisk(in nsIFile aNewFileLocation, in boolean aRememberThisPreference);
michael@0 105
michael@0 106 /**
michael@0 107 * Remembers that aApplication should be used to launch this content. Does
michael@0 108 * not actually launch the application.
michael@0 109 * NOTE: This will release the reference to the nsIHelperAppLauncherDialog.
michael@0 110 * @param aApplication nsIFile corresponding to the location of the application to use.
michael@0 111 * @param aRememberThisPreference TRUE if we should remember this choice.
michael@0 112 */
michael@0 113 void launchWithApplication(in nsIFile aApplication, in boolean aRememberThisPreference);
michael@0 114
michael@0 115 /**
michael@0 116 * Callback invoked by nsIHelperAppLauncherDialog::promptForSaveToFileAsync
michael@0 117 * after the user has chosen a file through the File Picker (or dismissed it).
michael@0 118 * @param aFile The file that was chosen by the user (or null if dialog was dismissed).
michael@0 119 */
michael@0 120 void saveDestinationAvailable(in nsIFile aFile);
michael@0 121
michael@0 122 /**
michael@0 123 * The following methods are used by the progress dialog to get or set
michael@0 124 * information on the current helper app launcher download.
michael@0 125 * This reference will be released when the download is finished (after the
michael@0 126 * listener receives the STATE_STOP notification).
michael@0 127 */
michael@0 128 void setWebProgressListener(in nsIWebProgressListener2 aWebProgressListener);
michael@0 129
michael@0 130 /**
michael@0 131 * The file we are saving to
michael@0 132 */
michael@0 133 readonly attribute nsIFile targetFile;
michael@0 134
michael@0 135 /**
michael@0 136 * The executable-ness of the target file
michael@0 137 */
michael@0 138 readonly attribute boolean targetFileIsExecutable;
michael@0 139
michael@0 140 /**
michael@0 141 * Time when the download started
michael@0 142 */
michael@0 143 readonly attribute PRTime timeDownloadStarted;
michael@0 144
michael@0 145 /**
michael@0 146 * The download content length, or -1 if the length is not available.
michael@0 147 */
michael@0 148 readonly attribute int64_t contentLength;
michael@0 149 };

mercurial