uriloader/exthandler/nsIHelperAppLauncherDialog.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/uriloader/exthandler/nsIHelperAppLauncherDialog.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,115 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsIHelperAppLauncher;
    1.12 +interface nsIFile;
    1.13 +
    1.14 +/**
    1.15 + * This interface is used to display a confirmation dialog before
    1.16 + * launching a "helper app" to handle content not handled by
    1.17 + * Mozilla.
    1.18 + *
    1.19 + * Usage:  Clients (of which there is one: the nsIExternalHelperAppService
    1.20 + * implementation in mozilla/uriloader/exthandler) create an instance of
    1.21 + * this interface (using the contract ID) and then call the show() method.
    1.22 + *
    1.23 + * The dialog is shown non-modally.  The implementation of the dialog
    1.24 + * will access methods of the nsIHelperAppLauncher passed in to show()
    1.25 + * in order to cause a "save to disk" or "open using" action.
    1.26 + */
    1.27 +[scriptable, uuid(3ae4dca8-ac91-4891-adcf-3fbebed6170e)]
    1.28 +interface nsIHelperAppLauncherDialog : nsISupports {
    1.29 +  /**
    1.30 +   * This request is passed to the helper app dialog because Gecko can not
    1.31 +   * handle content of this type.
    1.32 +   */
    1.33 +  const unsigned long REASON_CANTHANDLE = 0;
    1.34 +
    1.35 +  /**
    1.36 +   * The server requested external handling.
    1.37 +   */
    1.38 +  const unsigned long REASON_SERVERREQUEST = 1;
    1.39 +
    1.40 +  /**
    1.41 +   * Gecko detected that the type sent by the server (e.g. text/plain) does
    1.42 +   * not match the actual type.
    1.43 +   */
    1.44 +  const unsigned long REASON_TYPESNIFFED = 2;
    1.45 +
    1.46 +  /**
    1.47 +   * Show confirmation dialog for launching application (or "save to
    1.48 +   * disk") for content specified by aLauncher.
    1.49 +   *
    1.50 +   * @param aLauncher
    1.51 +   *        A nsIHelperAppLauncher to be invoked when a file is selected.
    1.52 +   * @param aWindowContext
    1.53 +   *        Window associated with action.
    1.54 +   * @param aReason
    1.55 +   *        One of the constants from above. It indicates why the dialog is
    1.56 +   *        shown. Implementors should treat unknown reasons like
    1.57 +   *        REASON_CANTHANDLE.
    1.58 +   */
    1.59 +  void show(in nsIHelperAppLauncher aLauncher,
    1.60 +            in nsISupports aWindowContext,
    1.61 +            in unsigned long aReason);
    1.62 +
    1.63 +  /**
    1.64 +   * Invoke a save-to-file dialog instead of the full fledged helper app dialog.
    1.65 +   * Returns the a nsIFile for the file name/location selected.
    1.66 +   *
    1.67 +   * @param aLauncher
    1.68 +   *        A nsIHelperAppLauncher to be invoked when a file is selected.
    1.69 +   * @param aWindowContext
    1.70 +   *        Window associated with action.
    1.71 +   * @param aDefaultFileName
    1.72 +   *        Default file name to provide (can be null)
    1.73 +   * @param aSuggestedFileExtension
    1.74 +   *        Sugested file extension
    1.75 +   * @param aForcePrompt
    1.76 +   *        Set to true to force prompting the user for thet file
    1.77 +   *        name/location, otherwise perferences may control if the user is
    1.78 +   *        prompted.
    1.79 +   *
    1.80 +   * @throws NS_ERROR_NOT_AVAILABLE if the async version of this function
    1.81 +   *                                should be used.
    1.82 +   */
    1.83 +  nsIFile promptForSaveToFile(in nsIHelperAppLauncher aLauncher,
    1.84 +                              in nsISupports aWindowContext,
    1.85 +                              in wstring aDefaultFileName,
    1.86 +                              in wstring aSuggestedFileExtension,
    1.87 +                              in boolean aForcePrompt);
    1.88 +
    1.89 +  /**
    1.90 +   * Async invoke a save-to-file dialog instead of the full fledged helper app
    1.91 +   * dialog. When the file is chosen (or the dialog is closed), the callback
    1.92 +   * in aLauncher (aLauncher.saveDestinationAvailable) is called with the
    1.93 +   * selected file.
    1.94 +   *
    1.95 +   * @param aLauncher
    1.96 +   *        A nsIHelperAppLauncher to be invoked when a file is selected.
    1.97 +   * @param aWindowContext
    1.98 +   *        Window associated with action.
    1.99 +   * @param aDefaultFileName
   1.100 +   *        Default file name to provide (can be null)
   1.101 +   * @param aSuggestedFileExtension
   1.102 +   *        Sugested file extension
   1.103 +   * @param aForcePrompt
   1.104 +   *        Set to true to force prompting the user for thet file
   1.105 +   *        name/location, otherwise perferences may control if the user is
   1.106 +   *        prompted.
   1.107 +   */
   1.108 +  void promptForSaveToFileAsync(in nsIHelperAppLauncher aLauncher,
   1.109 +                                in nsISupports aWindowContext,
   1.110 +                                in wstring aDefaultFileName,
   1.111 +                                in wstring aSuggestedFileExtension,
   1.112 +                                in boolean aForcePrompt);
   1.113 +};
   1.114 +
   1.115 +
   1.116 +%{C++
   1.117 +#define NS_HELPERAPPLAUNCHERDLG_CONTRACTID    "@mozilla.org/helperapplauncherdialog;1"
   1.118 +%}

mercurial