embedding/components/appstartup/src/nsIAppStartupNotifier.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial