Back to index

lightning-sunbird  0.9+nobinonly
nsINativeAppSupport.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Bill Law    <law@netscape.com>
00024  *   Blake Ross  <blake@netscape.com>
00025  *   Benjamin Smedberg <bsmedberg@covad.net>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040  
00041 #include "nsISupports.idl"
00042 
00043 /* nsINativeAppSupport
00044  *
00045  * This "pseudo" (in the XPCOM sense) interface provides for
00046  * platform-specific general application support:
00047  *  o It manages the details of the simple DDE communication 
00048  *    supported on the Win32 platform (it is the addition of this 
00049  *    item that prompted the creation of this interface.
00050  *
00051  * Due to the nature of the beast, this interface is not a full-blown
00052  * XPCOM component.  The primary reason is that objects that implement
00053  * this interface generally must be operational *before* XPCOM (or any
00054  * of the rest of Mozilla) are initialized.  As a result, this 
00055  * interface is instantiated by somewhat unconventional means.
00056  *
00057  * To create the implementor of this interface, you call the function
00058  * NS_CreateNativeAppSupport.  This is done in the startup code
00059  * in nsAppRunner.cpp
00060  *
00061  * The interface provides these functions:
00062  *  start - You call this to inform the native app support that the  
00063  *          application is starting.  In addition, it serves as a
00064  *          query as to whether the application should continue to
00065  *          run.
00066  *
00067  *          If the returned boolean result is PR_FALSE, then the
00068  *          application should exit without further processing.  In
00069  *          such cases, the returned nsresult indicates whether the
00070  *          reason to exit is due to an error or not.
00071  *
00072  *          Win32 Note: In the case of starting a second instance
00073  *                      of this executable, this function will return
00074  *                      PR_FALSE and nsresult==NS_OK.  This means that
00075  *                      the command line arguments have been
00076  *                      successfully passed to the instance of the
00077  *                      application acting as a DDE server.
00078  *
00079  *  stop - You call this to inform the native app support that the
00080  *         application *wishes* to terminate.  If the returned boolean
00081  *         value is PR_FALSE, then the application should continue
00082  *         (as if there were still additional top-level windows open).
00083  *         
00084  *         Win32 Note: If this is the instance of the application
00085  *                     acting as the DDE server, and there are current
00086  *                     DDE conversations active with other instances
00087  *                     acting as DDE clients, then this function will
00088  *                     return PR_FALSE.
00089  * 
00090  *  quit - Like Stop, but this method *forces* termination (or more 
00091  *         precisely, indicates that the application is about to be
00092  *         terminated regardless of what a call to Stop might have
00093  *         returned.
00094  *
00095  *         This method is intended to be called when the user selects
00096  *         the "Quit" option (close all windows and exit).
00097  *
00098  *         Win32 Note: Stop is problematic in the case of "Quit" (close
00099  *                     all windows and exit the application) because
00100  *                     either we don't Quit or (potentially) we lose
00101  *                     requests coming from other instances of the
00102  *                     application.  The strategy is to give preference
00103  *                     to the user's explicit Quit request.  In the
00104  *                     unlikely event that a request is pending from
00105  *                     another instance of the application, then such
00106  *                     requests are essentially ignored.  This is
00107  *                     roughly equivalent to handling that request by
00108  *                     opening a new window, followed by immediately
00109  *                     closing it.  Since this is the same as if the
00110  *                     request came in immediately before the Quit
00111  *                     call (versus immediately after it), no harm.
00112  *
00113  *                     There is an exposure here: Upon return from this
00114  *                     function, any DDE connect request (for Mozilla)
00115  *                     will fail and other instances of the application
00116  *                     will start up as a DDE server.  In that case,
00117  *                     those instances may do things that conflict with
00118  *                     the subsequent shutting down of the instance that
00119  *                     is quitting.  For this reason, the call to Quit
00120  *                     should be deferred as long as possible.
00121  *
00122  *  onLastWindowClosing -  Called when the last window is closed. Used as a
00123  *                         "soft" shutdown, passwords are flushed.
00124  */
00125 
00126 interface nsIXULWindow;
00127 interface nsICmdLineService;
00128 
00129 [scriptable, uuid(5fdf8480-1f98-11d4-8077-00600811a9c3)]
00130 interface nsINativeAppSupport : nsISupports {
00131     // Startup/shutdown.
00132     boolean start();
00133     void    enable();
00134     boolean stop();
00135     void    quit();
00136 
00137     void onLastWindowClosing();
00138     void ReOpen();
00139 };