Fix regexp match pair end-index == -1 assumption. (r=dmandelin, a=blocker b=605754)
[mozilla-central.git] / toolkit / xre / nsINativeAppSupport.idl
blob80cad388cd53da5b873b04abced666e865c29977
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Bill Law <law@netscape.com>
24 * Blake Ross <blake@netscape.com>
25 * Benjamin Smedberg <bsmedberg@covad.net>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #include "nsISupports.idl"
43 /* nsINativeAppSupport
45 * This "pseudo" (in the XPCOM sense) interface provides for
46 * platform-specific general application support:
47 * o It manages the details of the simple DDE communication
48 * supported on the Win32 platform (it is the addition of this
49 * item that prompted the creation of this interface.
51 * Due to the nature of the beast, this interface is not a full-blown
52 * XPCOM component. The primary reason is that objects that implement
53 * this interface generally must be operational *before* XPCOM (or any
54 * of the rest of Mozilla) are initialized. As a result, this
55 * interface is instantiated by somewhat unconventional means.
57 * To create the implementor of this interface, you call the function
58 * NS_CreateNativeAppSupport. This is done in the startup code
59 * in nsAppRunner.cpp
61 * The interface provides these functions:
62 * start - You call this to inform the native app support that the
63 * application is starting. In addition, it serves as a
64 * query as to whether the application should continue to
65 * run.
67 * If the returned boolean result is PR_FALSE, then the
68 * application should exit without further processing. In
69 * such cases, the returned nsresult indicates whether the
70 * reason to exit is due to an error or not.
72 * Win32 Note: In the case of starting a second instance
73 * of this executable, this function will return
74 * PR_FALSE and nsresult==NS_OK. This means that
75 * the command line arguments have been
76 * successfully passed to the instance of the
77 * application acting as a DDE server.
79 * stop - You call this to inform the native app support that the
80 * application *wishes* to terminate. If the returned boolean
81 * value is PR_FALSE, then the application should continue
82 * (as if there were still additional top-level windows open).
84 * Win32 Note: If this is the instance of the application
85 * acting as the DDE server, and there are current
86 * DDE conversations active with other instances
87 * acting as DDE clients, then this function will
88 * return PR_FALSE.
90 * quit - Like Stop, but this method *forces* termination (or more
91 * precisely, indicates that the application is about to be
92 * terminated regardless of what a call to Stop might have
93 * returned.
95 * This method is intended to be called when the user selects
96 * the "Quit" option (close all windows and exit).
98 * Win32 Note: Stop is problematic in the case of "Quit" (close
99 * all windows and exit the application) because
100 * either we don't Quit or (potentially) we lose
101 * requests coming from other instances of the
102 * application. The strategy is to give preference
103 * to the user's explicit Quit request. In the
104 * unlikely event that a request is pending from
105 * another instance of the application, then such
106 * requests are essentially ignored. This is
107 * roughly equivalent to handling that request by
108 * opening a new window, followed by immediately
109 * closing it. Since this is the same as if the
110 * request came in immediately before the Quit
111 * call (versus immediately after it), no harm.
113 * There is an exposure here: Upon return from this
114 * function, any DDE connect request (for Mozilla)
115 * will fail and other instances of the application
116 * will start up as a DDE server. In that case,
117 * those instances may do things that conflict with
118 * the subsequent shutting down of the instance that
119 * is quitting. For this reason, the call to Quit
120 * should be deferred as long as possible.
122 * onLastWindowClosing - Called when the last window is closed. Used as a
123 * "soft" shutdown, passwords are flushed.
126 interface nsIXULWindow;
127 interface nsICmdLineService;
129 [scriptable, uuid(5fdf8480-1f98-11d4-8077-00600811a9c3)]
130 interface nsINativeAppSupport : nsISupports {
131 // Startup/shutdown.
132 boolean start();
133 void enable();
134 boolean stop();
135 void quit();
137 void onLastWindowClosing();
138 void ReOpen();