Wed, 31 Dec 2014 06:09:35 +0100
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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIHelperAppLauncher; |
michael@0 | 9 | interface nsIFile; |
michael@0 | 10 | |
michael@0 | 11 | /** |
michael@0 | 12 | * This interface is used to display a confirmation dialog before |
michael@0 | 13 | * launching a "helper app" to handle content not handled by |
michael@0 | 14 | * Mozilla. |
michael@0 | 15 | * |
michael@0 | 16 | * Usage: Clients (of which there is one: the nsIExternalHelperAppService |
michael@0 | 17 | * implementation in mozilla/uriloader/exthandler) create an instance of |
michael@0 | 18 | * this interface (using the contract ID) and then call the show() method. |
michael@0 | 19 | * |
michael@0 | 20 | * The dialog is shown non-modally. The implementation of the dialog |
michael@0 | 21 | * will access methods of the nsIHelperAppLauncher passed in to show() |
michael@0 | 22 | * in order to cause a "save to disk" or "open using" action. |
michael@0 | 23 | */ |
michael@0 | 24 | [scriptable, uuid(3ae4dca8-ac91-4891-adcf-3fbebed6170e)] |
michael@0 | 25 | interface nsIHelperAppLauncherDialog : nsISupports { |
michael@0 | 26 | /** |
michael@0 | 27 | * This request is passed to the helper app dialog because Gecko can not |
michael@0 | 28 | * handle content of this type. |
michael@0 | 29 | */ |
michael@0 | 30 | const unsigned long REASON_CANTHANDLE = 0; |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * The server requested external handling. |
michael@0 | 34 | */ |
michael@0 | 35 | const unsigned long REASON_SERVERREQUEST = 1; |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * Gecko detected that the type sent by the server (e.g. text/plain) does |
michael@0 | 39 | * not match the actual type. |
michael@0 | 40 | */ |
michael@0 | 41 | const unsigned long REASON_TYPESNIFFED = 2; |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Show confirmation dialog for launching application (or "save to |
michael@0 | 45 | * disk") for content specified by aLauncher. |
michael@0 | 46 | * |
michael@0 | 47 | * @param aLauncher |
michael@0 | 48 | * A nsIHelperAppLauncher to be invoked when a file is selected. |
michael@0 | 49 | * @param aWindowContext |
michael@0 | 50 | * Window associated with action. |
michael@0 | 51 | * @param aReason |
michael@0 | 52 | * One of the constants from above. It indicates why the dialog is |
michael@0 | 53 | * shown. Implementors should treat unknown reasons like |
michael@0 | 54 | * REASON_CANTHANDLE. |
michael@0 | 55 | */ |
michael@0 | 56 | void show(in nsIHelperAppLauncher aLauncher, |
michael@0 | 57 | in nsISupports aWindowContext, |
michael@0 | 58 | in unsigned long aReason); |
michael@0 | 59 | |
michael@0 | 60 | /** |
michael@0 | 61 | * Invoke a save-to-file dialog instead of the full fledged helper app dialog. |
michael@0 | 62 | * Returns the a nsIFile for the file name/location selected. |
michael@0 | 63 | * |
michael@0 | 64 | * @param aLauncher |
michael@0 | 65 | * A nsIHelperAppLauncher to be invoked when a file is selected. |
michael@0 | 66 | * @param aWindowContext |
michael@0 | 67 | * Window associated with action. |
michael@0 | 68 | * @param aDefaultFileName |
michael@0 | 69 | * Default file name to provide (can be null) |
michael@0 | 70 | * @param aSuggestedFileExtension |
michael@0 | 71 | * Sugested file extension |
michael@0 | 72 | * @param aForcePrompt |
michael@0 | 73 | * Set to true to force prompting the user for thet file |
michael@0 | 74 | * name/location, otherwise perferences may control if the user is |
michael@0 | 75 | * prompted. |
michael@0 | 76 | * |
michael@0 | 77 | * @throws NS_ERROR_NOT_AVAILABLE if the async version of this function |
michael@0 | 78 | * should be used. |
michael@0 | 79 | */ |
michael@0 | 80 | nsIFile promptForSaveToFile(in nsIHelperAppLauncher aLauncher, |
michael@0 | 81 | in nsISupports aWindowContext, |
michael@0 | 82 | in wstring aDefaultFileName, |
michael@0 | 83 | in wstring aSuggestedFileExtension, |
michael@0 | 84 | in boolean aForcePrompt); |
michael@0 | 85 | |
michael@0 | 86 | /** |
michael@0 | 87 | * Async invoke a save-to-file dialog instead of the full fledged helper app |
michael@0 | 88 | * dialog. When the file is chosen (or the dialog is closed), the callback |
michael@0 | 89 | * in aLauncher (aLauncher.saveDestinationAvailable) is called with the |
michael@0 | 90 | * selected file. |
michael@0 | 91 | * |
michael@0 | 92 | * @param aLauncher |
michael@0 | 93 | * A nsIHelperAppLauncher to be invoked when a file is selected. |
michael@0 | 94 | * @param aWindowContext |
michael@0 | 95 | * Window associated with action. |
michael@0 | 96 | * @param aDefaultFileName |
michael@0 | 97 | * Default file name to provide (can be null) |
michael@0 | 98 | * @param aSuggestedFileExtension |
michael@0 | 99 | * Sugested file extension |
michael@0 | 100 | * @param aForcePrompt |
michael@0 | 101 | * Set to true to force prompting the user for thet file |
michael@0 | 102 | * name/location, otherwise perferences may control if the user is |
michael@0 | 103 | * prompted. |
michael@0 | 104 | */ |
michael@0 | 105 | void promptForSaveToFileAsync(in nsIHelperAppLauncher aLauncher, |
michael@0 | 106 | in nsISupports aWindowContext, |
michael@0 | 107 | in wstring aDefaultFileName, |
michael@0 | 108 | in wstring aSuggestedFileExtension, |
michael@0 | 109 | in boolean aForcePrompt); |
michael@0 | 110 | }; |
michael@0 | 111 | |
michael@0 | 112 | |
michael@0 | 113 | %{C++ |
michael@0 | 114 | #define NS_HELPERAPPLAUNCHERDLG_CONTRACTID "@mozilla.org/helperapplauncherdialog;1" |
michael@0 | 115 | %} |