1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
8 interface nsIHelperAppLauncher
;
10 interface nsIInterfaceRequestor
;
13 * This interface is used to display a confirmation dialog before
14 * launching a "helper app" to handle content not handled by
17 * Usage: Clients (of which there is one: the nsIExternalHelperAppService
18 * implementation in mozilla/uriloader/exthandler) create an instance of
19 * this interface (using the contract ID) and then call the show() method.
21 * The dialog is shown non-modally. The implementation of the dialog
22 * will access methods of the nsIHelperAppLauncher passed in to show()
23 * in order to cause a "save to disk" or "open using" action.
25 [scriptable
, uuid(bfc739f3
-8d75
-4034-a6f8
-1039a5996bad
)]
26 interface nsIHelperAppLauncherDialog
: nsISupports
{
28 * This request is passed to the helper app dialog because Gecko can not
29 * handle content of this type.
31 const unsigned long REASON_CANTHANDLE
= 0;
34 * The server requested external handling.
36 const unsigned long REASON_SERVERREQUEST
= 1;
39 * Gecko detected that the type sent by the server (e.g. text/plain) does
40 * not match the actual type.
42 const unsigned long REASON_TYPESNIFFED
= 2;
45 * Show confirmation dialog for launching application (or "save to
46 * disk") for content specified by aLauncher.
49 * A nsIHelperAppLauncher to be invoked when a file is selected.
50 * @param aWindowContext
51 * Window associated with action.
53 * One of the constants from above. It indicates why the dialog is
54 * shown. Implementors should treat unknown reasons like
57 void show
(in nsIHelperAppLauncher aLauncher
,
58 in nsIInterfaceRequestor aWindowContext
,
59 in unsigned long aReason
);
62 * Async invoke a save-to-file dialog instead of the full fledged helper app
63 * dialog. When the file is chosen (or the dialog is closed), the callback
64 * in aLauncher (aLauncher.saveDestinationAvailable) is called with the
68 * A nsIHelperAppLauncher to be invoked when a file is selected.
69 * @param aWindowContext
70 * Window associated with action.
71 * @param aDefaultFileName
72 * Default file name to provide (can be null)
73 * @param aSuggestedFileExtension
74 * Sugested file extension
76 * Set to true to force prompting the user for thet file
77 * name/location, otherwise perferences may control if the user is
80 void promptForSaveToFileAsync
(in nsIHelperAppLauncher aLauncher
,
81 in nsIInterfaceRequestor aWindowContext
,
82 in wstring aDefaultFileName
,
83 in wstring aSuggestedFileExtension
,
84 in boolean aForcePrompt
);
89 #define NS_HELPERAPPLAUNCHERDLG_CONTRACTID
"@mozilla.org/helperapplauncherdialog;1"