embedding/components/appstartup/src/nsIAppStartupNotifier.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:3cbf81f2e9ee
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/. */
5
6 #ifndef nsIAppStartupNotifier_h___
7 #define nsIAppStartupNotifier_h___
8
9 #include "nsIObserver.h"
10
11 /*
12 Some components need to be run at the startup of mozilla or embedding - to
13 start new services etc.
14
15 This interface provides a generic way to start up arbitrary components
16 without requiring them to hack into main1() (or into NS_InitEmbedding) as
17 it's currently being done for services such as wallet, command line handlers
18 etc.
19
20 We will have a category called "app-startup" which components register
21 themselves in using the CategoryManager.
22
23 Components can also (optionally) add the word "service," as a prefix
24 to the "value" they pass in during a call to AddCategoryEntry() as
25 shown below:
26
27 categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "testcomp",
28 "service," NS_WALLETSERVICE_CONTRACTID
29 true, true,
30 getter_Copies(previous));
31
32 Presence of the "service" keyword indicates the components desire to
33 be started as a service. When the "service" keyword is not present
34 we just do a do_CreateInstance.
35
36 When mozilla starts (and when NS_InitEmbedding()) is invoked
37 we create an instance of the AppStartupNotifier component (which
38 implements nsIObserver) and invoke its Observe() method.
39
40 Observe() will enumerate the components registered into the
41 APPSTARTUP_CATEGORY and notify them that startup has begun
42 and release them.
43 */
44
45 #define NS_APPSTARTUPNOTIFIER_CONTRACTID "@mozilla.org/embedcomp/appstartup-notifier;1"
46
47 #define APPSTARTUP_CATEGORY "app-startup"
48 #define APPSTARTUP_TOPIC "app-startup"
49
50
51 /*
52 Please note that there's not a new interface in this file.
53 We're just leveraging nsIObserver instead of creating a
54 new one
55
56 This file exists solely to provide the defines above
57 */
58
59 #endif /* nsIAppStartupNotifier_h___ */

mercurial