michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsIAppStartupNotifier_h___ michael@0: #define nsIAppStartupNotifier_h___ michael@0: michael@0: #include "nsIObserver.h" michael@0: michael@0: /* michael@0: Some components need to be run at the startup of mozilla or embedding - to michael@0: start new services etc. michael@0: michael@0: This interface provides a generic way to start up arbitrary components michael@0: without requiring them to hack into main1() (or into NS_InitEmbedding) as michael@0: it's currently being done for services such as wallet, command line handlers michael@0: etc. michael@0: michael@0: We will have a category called "app-startup" which components register michael@0: themselves in using the CategoryManager. michael@0: michael@0: Components can also (optionally) add the word "service," as a prefix michael@0: to the "value" they pass in during a call to AddCategoryEntry() as michael@0: shown below: michael@0: michael@0: categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "testcomp", michael@0: "service," NS_WALLETSERVICE_CONTRACTID michael@0: true, true, michael@0: getter_Copies(previous)); michael@0: michael@0: Presence of the "service" keyword indicates the components desire to michael@0: be started as a service. When the "service" keyword is not present michael@0: we just do a do_CreateInstance. michael@0: michael@0: When mozilla starts (and when NS_InitEmbedding()) is invoked michael@0: we create an instance of the AppStartupNotifier component (which michael@0: implements nsIObserver) and invoke its Observe() method. michael@0: michael@0: Observe() will enumerate the components registered into the michael@0: APPSTARTUP_CATEGORY and notify them that startup has begun michael@0: and release them. michael@0: */ michael@0: michael@0: #define NS_APPSTARTUPNOTIFIER_CONTRACTID "@mozilla.org/embedcomp/appstartup-notifier;1" michael@0: michael@0: #define APPSTARTUP_CATEGORY "app-startup" michael@0: #define APPSTARTUP_TOPIC "app-startup" michael@0: michael@0: michael@0: /* michael@0: Please note that there's not a new interface in this file. michael@0: We're just leveraging nsIObserver instead of creating a michael@0: new one michael@0: michael@0: This file exists solely to provide the defines above michael@0: */ michael@0: michael@0: #endif /* nsIAppStartupNotifier_h___ */