Back to index

lightning-sunbird  0.9+nobinonly
nsIAppStartupNotifier.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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.org 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  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsIAppStartupNotifier_h___
00039 #define nsIAppStartupNotifier_h___
00040 
00041 #include "nsIObserver.h"
00042 
00043 /*
00044  Some components need to be run at the startup of mozilla or embedding - to 
00045  start new services etc.
00046 
00047  This interface provides a generic way to start up arbitrary components 
00048  without requiring them to hack into main1() (or into NS_InitEmbedding) as 
00049  it's currently being done for services such as wallet, command line handlers 
00050  etc.
00051 
00052  We will have a category called "app-startup" which components register 
00053  themselves in using the CategoryManager.
00054 
00055  Components can also (optionally) add the word "service," as a prefix 
00056  to the "value" they pass in during a call to AddCategoryEntry() as
00057  shown below:
00058 
00059     categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "testcomp",
00060                         "service," NS_WALLETSERVICE_CONTRACTID
00061                         PR_TRUE, PR_TRUE,
00062                         getter_Copies(previous));
00063 
00064  Presence of the "service" keyword indicates the components desire to 
00065  be started as a service. When the "service" keyword is not present
00066  we just do a do_CreateInstance.
00067 
00068  When mozilla starts (and when NS_InitEmbedding()) is invoked
00069  we create an instance of the AppStartupNotifier component (which 
00070  implements nsIObserver) and invoke it's Observe() method. 
00071 
00072  Observe()  will enumerate the components registered into the
00073  APPSTARTUP_CATEGORY and notify them that startup has begun
00074  and release them.
00075 */
00076 
00077 #define NS_APPSTARTUPNOTIFIER_CONTRACTID "@mozilla.org/embedcomp/appstartup-notifier;1"
00078 #define NS_APPSTARTUPNOTIFIER_CLASSNAME  "AppStartup Notifier"
00079 
00080 #define APPSTARTUP_CATEGORY "app-startup"
00081 #define APPSTARTUP_TOPIC    "app-startup"
00082 
00083 
00084 /*
00085  Please note that there's not a new interface in this file.
00086  We're just leveraging nsIObserver instead of creating a
00087  new one
00088 
00089  This file exists solely to provide the defines above
00090 */
00091 
00092 #endif /* nsIAppStartupNotifier_h___ */