uriloader/exthandler/nsIHelperAppLauncherDialog.idl

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial