Back to index

lightning-sunbird  0.9+nobinonly
nsToolkitCompsModule.cpp
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is mozilla.org code.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 2001
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Joe Hewitt <hewitt@netscape.com> (Original Author)
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 #include "nsIGenericFactory.h"
00039 #include "nsAppStartup.h"
00040 #include "nsUserInfo.h"
00041 #include "nsXPFEComponentsCID.h"
00042 #include "nsToolkitCompsCID.h"
00043 #ifdef ALERTS_SERVICE
00044 #include "nsAlertsService.h"
00045 #endif
00046 
00047 #ifdef MOZ_XPINSTALL
00048 #include "nsDownloadManager.h"
00049 #include "nsDownloadProxy.h"
00050 #endif
00051 
00052 #include "nsTypeAheadFind.h"
00053 
00054 #ifndef MOZ_THUNDERBIRD
00055 #include "nsDocShellCID.h"
00056 #include "nsAutoCompleteController.h"
00057 #ifdef MOZ_MORK
00058 #include "nsAutoCompleteMdbResult.h"
00059 #endif
00060 #include "nsAutoCompleteSimpleResult.h"
00061 #include "nsFormFillController.h"
00062 
00063 // form history (satchel)
00064 #ifdef MOZ_PLACES
00065 #include "nsStorageFormHistory.h"
00066 #else
00067 #include "nsFormHistory.h"
00068 #endif
00069 
00070 #ifndef MOZ_PLACES
00071 #include "nsGlobalHistory.h"
00072 #endif
00073 #include "nsPasswordManager.h"
00074 #include "nsSingleSignonPrompt.h"
00075 #endif
00076 #ifdef MOZ_URL_CLASSIFIER
00077 #include "nsUrlClassifierDBService.h"
00078 #include "nsUrlClassifierStreamUpdater.h"
00079 #include "nsUrlClassifierUtils.h"
00080 #endif
00081 #ifdef MOZ_FEEDS
00082 #include "nsScriptableUnescapeHTML.h"
00083 #endif
00084 
00085 
00086 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAppStartup, Init)
00087 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo)
00088 
00089 #ifdef ALERTS_SERVICE
00090 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAlertsService)
00091 #endif
00092 
00093 #ifdef MOZ_XPINSTALL
00094 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDownloadManager, Init) 
00095 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy)
00096 #endif
00097 
00098 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind)
00099 
00100 #ifndef MOZ_THUNDERBIRD
00101 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteController)
00102 #ifdef MOZ_MORK
00103 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteMdbResult)
00104 #endif
00105 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteSimpleResult)
00106 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFormHistory, Init)
00107 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormFillController)
00108 #if defined(MOZ_STORAGE) && defined(MOZ_MORKREADER)
00109 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormHistoryImporter)
00110 #endif
00111 #ifndef MOZ_PLACES
00112 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGlobalHistory, Init)
00113 #endif
00114 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPasswordManager, nsPasswordManager::GetInstance)
00115 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSingleSignonPrompt)
00116 #endif
00117 #ifdef MOZ_URL_CLASSIFIER
00118 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsUrlClassifierDBService,
00119                                          nsUrlClassifierDBService::GetInstance)
00120 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierStreamUpdater)
00121 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierUtils)
00122 #endif
00123 #ifdef MOZ_FEEDS
00124 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableUnescapeHTML)
00125 #endif
00126 
00127 
00128 
00129 static void PR_CALLBACK nsToolkitCompModuleDtor(nsIModule* self)
00130 {
00131 #ifndef MOZ_THUNDERBIRD
00132   nsPasswordManager::Shutdown();
00133 #endif
00134 }
00135 
00137 
00138 static const nsModuleComponentInfo components[] =
00139 {
00140   { "App Startup Service",
00141     NS_TOOLKIT_APPSTARTUP_CID,
00142     NS_APPSTARTUP_CONTRACTID,
00143     nsAppStartupConstructor },
00144 
00145   { "User Info Service",
00146     NS_USERINFO_CID,
00147     NS_USERINFO_CONTRACTID,
00148     nsUserInfoConstructor },
00149 #ifdef ALERTS_SERVICE
00150   { "Alerts Service",
00151     NS_ALERTSSERVICE_CID, 
00152     NS_ALERTSERVICE_CONTRACTID,
00153     nsAlertsServiceConstructor },
00154 #endif
00155 #ifdef MOZ_XPINSTALL
00156   { "Download Manager",
00157     NS_DOWNLOADMANAGER_CID,
00158     NS_DOWNLOADMANAGER_CONTRACTID,
00159     nsDownloadManagerConstructor },
00160   { "Download",
00161     NS_DOWNLOAD_CID,
00162     NS_TRANSFER_CONTRACTID,
00163     nsDownloadProxyConstructor },
00164 #endif
00165   { "TypeAheadFind Component", NS_TYPEAHEADFIND_CID,
00166     NS_TYPEAHEADFIND_CONTRACTID, nsTypeAheadFindConstructor
00167   },
00168 #ifndef MOZ_THUNDERBIRD
00169   { "AutoComplete Controller",
00170     NS_AUTOCOMPLETECONTROLLER_CID, 
00171     NS_AUTOCOMPLETECONTROLLER_CONTRACTID,
00172     nsAutoCompleteControllerConstructor },
00173 
00174   { "AutoComplete Simple Result",
00175     NS_AUTOCOMPLETESIMPLERESULT_CID,
00176     NS_AUTOCOMPLETESIMPLERESULT_CONTRACTID,
00177     nsAutoCompleteSimpleResultConstructor },
00178 
00179 #ifdef MOZ_MORK
00180   { "AutoComplete Mdb Result",
00181     NS_AUTOCOMPLETEMDBRESULT_CID, 
00182     NS_AUTOCOMPLETEMDBRESULT_CONTRACTID,
00183     nsAutoCompleteMdbResultConstructor },
00184 #endif
00185 
00186   { "HTML Form History",
00187     NS_FORMHISTORY_CID, 
00188     NS_FORMHISTORY_CONTRACTID,
00189     nsFormHistoryConstructor },
00190 
00191   { "HTML Form Fill Controller",
00192     NS_FORMFILLCONTROLLER_CID, 
00193     "@mozilla.org/satchel/form-fill-controller;1",
00194     nsFormFillControllerConstructor },
00195 
00196   { "HTML Form History AutoComplete",
00197     NS_FORMFILLCONTROLLER_CID, 
00198     NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID,
00199     nsFormFillControllerConstructor },
00200 
00201 #if defined(MOZ_STORAGE) && defined(MOZ_MORKREADER)
00202   { "Form History Importer",
00203     NS_FORMHISTORYIMPORTER_CID,
00204     NS_FORMHISTORYIMPORTER_CONTRACTID,
00205     nsFormHistoryImporterConstructor },
00206 #endif
00207 
00208 #ifndef MOZ_PLACES
00209   // "places" replaces global history
00210   { "Global History",
00211     NS_GLOBALHISTORY_CID,
00212     NS_GLOBALHISTORY2_CONTRACTID,
00213     nsGlobalHistoryConstructor },
00214     
00215   { "Global History",
00216     NS_GLOBALHISTORY_CID,
00217     NS_GLOBALHISTORY_DATASOURCE_CONTRACTID,
00218     nsGlobalHistoryConstructor },
00219     
00220   { "Global History",
00221     NS_GLOBALHISTORY_CID,
00222     NS_GLOBALHISTORY_AUTOCOMPLETE_CONTRACTID,
00223     nsGlobalHistoryConstructor },
00224 #endif
00225 
00226   { "Password Manager",
00227     NS_PASSWORDMANAGER_CID,
00228     NS_PASSWORDMANAGER_CONTRACTID,
00229     nsPasswordManagerConstructor,
00230     nsPasswordManager::Register,
00231     nsPasswordManager::Unregister },
00232 
00233   { "Single Signon Prompt",
00234     NS_SINGLE_SIGNON_PROMPT_CID,
00235     "@mozilla.org/wallet/single-sign-on-prompt;1",
00236     nsSingleSignonPromptConstructor }, 
00237 #endif
00238 #ifdef MOZ_URL_CLASSIFIER
00239   { "Url Classifier DB Service",
00240     NS_URLCLASSIFIERDBSERVICE_CID,
00241     NS_URLCLASSIFIERDBSERVICE_CONTRACTID,
00242     nsUrlClassifierDBServiceConstructor },
00243   { "Url Classifier Stream Updater",
00244     NS_URLCLASSIFIERSTREAMUPDATER_CID,
00245     NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID,
00246     nsUrlClassifierStreamUpdaterConstructor },
00247   { "Url Classifier Utils",
00248     NS_URLCLASSIFIERUTILS_CID,
00249     NS_URLCLASSIFIERUTILS_CONTRACTID,
00250     nsUrlClassifierUtilsConstructor },
00251 #endif
00252 #ifdef MOZ_FEEDS
00253   { "Unescape HTML",
00254     NS_SCRIPTABLEUNESCAPEHTML_CID,
00255     NS_SCRIPTABLEUNESCAPEHTML_CONTRACTID,
00256     nsScriptableUnescapeHTMLConstructor },
00257 #endif
00258 };
00259 
00260 NS_IMPL_NSGETMODULE_WITH_DTOR(nsToolkitCompsModule, components, nsToolkitCompModuleDtor)