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: #include "mozilla/ModuleUtils.h" michael@0: #include "nsAppStartup.h" michael@0: #include "nsUserInfo.h" michael@0: #include "nsToolkitCompsCID.h" michael@0: #include "nsFindService.h" michael@0: #if defined(USE_MOZ_UPDATER) michael@0: #include "nsUpdateDriver.h" michael@0: #endif michael@0: michael@0: #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS) michael@0: #include "nsParentalControlsServiceWin.h" michael@0: #endif michael@0: michael@0: #include "nsAlertsService.h" michael@0: michael@0: #include "nsDownloadManager.h" michael@0: #include "DownloadPlatform.h" michael@0: #include "nsDownloadProxy.h" michael@0: #include "nsCharsetMenu.h" michael@0: #include "rdf.h" michael@0: michael@0: #include "nsTypeAheadFind.h" michael@0: michael@0: #ifdef MOZ_URL_CLASSIFIER michael@0: #include "ApplicationReputation.h" michael@0: #include "nsUrlClassifierDBService.h" michael@0: #include "nsUrlClassifierStreamUpdater.h" michael@0: #include "nsUrlClassifierUtils.h" michael@0: #include "nsUrlClassifierPrefixSet.h" michael@0: #endif michael@0: michael@0: #include "nsBrowserStatusFilter.h" michael@0: #include "mozilla/FinalizationWitnessService.h" michael@0: #include "mozilla/NativeOSFileInternals.h" michael@0: michael@0: using namespace mozilla; michael@0: michael@0: ///////////////////////////////////////////////////////////////////////////// michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAppStartup, Init) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsFindService) michael@0: michael@0: #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsParentalControlsServiceWin) michael@0: #endif michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsAlertsService) michael@0: michael@0: NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDownloadManager, michael@0: nsDownloadManager::GetSingleton) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(DownloadPlatform) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy) michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind) michael@0: michael@0: #ifdef MOZ_URL_CLASSIFIER michael@0: NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ApplicationReputationService, michael@0: ApplicationReputationService::GetSingleton) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierPrefixSet) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierStreamUpdater) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUrlClassifierUtils, Init) michael@0: michael@0: static nsresult michael@0: nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID, michael@0: void **aResult) michael@0: { michael@0: nsresult rv; michael@0: NS_ENSURE_ARG_POINTER(aResult); michael@0: NS_ENSURE_NO_AGGREGATION(aOuter); michael@0: michael@0: nsUrlClassifierDBService *inst = nsUrlClassifierDBService::GetInstance(&rv); michael@0: if (nullptr == inst) { michael@0: return rv; michael@0: } michael@0: /* NS_ADDREF(inst); */ michael@0: rv = inst->QueryInterface(aIID, aResult); michael@0: NS_RELEASE(inst); michael@0: michael@0: return rv; michael@0: } michael@0: #endif michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter) michael@0: #if defined(USE_MOZ_UPDATER) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsUpdateProcessor) michael@0: #endif michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(FinalizationWitnessService) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(NativeOSFileInternalsService) michael@0: michael@0: NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID); michael@0: NS_DEFINE_NAMED_CID(NS_USERINFO_CID); michael@0: NS_DEFINE_NAMED_CID(NS_ALERTSSERVICE_CID); michael@0: #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS) michael@0: NS_DEFINE_NAMED_CID(NS_PARENTALCONTROLSSERVICE_CID); michael@0: #endif michael@0: NS_DEFINE_NAMED_CID(NS_DOWNLOADMANAGER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DOWNLOADPLATFORM_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DOWNLOAD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_FIND_SERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_TYPEAHEADFIND_CID); michael@0: #ifdef MOZ_URL_CLASSIFIER michael@0: NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERPREFIXSET_CID); michael@0: NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERDBSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID); michael@0: #endif michael@0: NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CHARSETMENU_CID); michael@0: #if defined(USE_MOZ_UPDATER) michael@0: NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID); michael@0: #endif michael@0: NS_DEFINE_NAMED_CID(FINALIZATIONWITNESSSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NATIVE_OSFILE_INTERNALS_SERVICE_CID); michael@0: michael@0: static const Module::CIDEntry kToolkitCIDs[] = { michael@0: { &kNS_TOOLKIT_APPSTARTUP_CID, false, nullptr, nsAppStartupConstructor }, michael@0: { &kNS_USERINFO_CID, false, nullptr, nsUserInfoConstructor }, michael@0: { &kNS_ALERTSSERVICE_CID, false, nullptr, nsAlertsServiceConstructor }, michael@0: #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS) michael@0: { &kNS_PARENTALCONTROLSSERVICE_CID, false, nullptr, nsParentalControlsServiceWinConstructor }, michael@0: #endif michael@0: { &kNS_DOWNLOADMANAGER_CID, false, nullptr, nsDownloadManagerConstructor }, michael@0: { &kNS_DOWNLOADPLATFORM_CID, false, nullptr, DownloadPlatformConstructor }, michael@0: { &kNS_DOWNLOAD_CID, false, nullptr, nsDownloadProxyConstructor }, michael@0: { &kNS_FIND_SERVICE_CID, false, nullptr, nsFindServiceConstructor }, michael@0: { &kNS_TYPEAHEADFIND_CID, false, nullptr, nsTypeAheadFindConstructor }, michael@0: #ifdef MOZ_URL_CLASSIFIER michael@0: { &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr, ApplicationReputationServiceConstructor }, michael@0: { &kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr, nsUrlClassifierPrefixSetConstructor }, michael@0: { &kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr, nsUrlClassifierDBServiceConstructor }, michael@0: { &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr, nsUrlClassifierStreamUpdaterConstructor }, michael@0: { &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor }, michael@0: #endif michael@0: { &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor }, michael@0: { &kNS_CHARSETMENU_CID, false, nullptr, NS_NewCharsetMenu }, michael@0: #if defined(USE_MOZ_UPDATER) michael@0: { &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor }, michael@0: #endif michael@0: { &kFINALIZATIONWITNESSSERVICE_CID, false, nullptr, FinalizationWitnessServiceConstructor }, michael@0: { &kNATIVE_OSFILE_INTERNALS_SERVICE_CID, false, nullptr, NativeOSFileInternalsServiceConstructor }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const Module::ContractIDEntry kToolkitContracts[] = { michael@0: { NS_APPSTARTUP_CONTRACTID, &kNS_TOOLKIT_APPSTARTUP_CID }, michael@0: { NS_USERINFO_CONTRACTID, &kNS_USERINFO_CID }, michael@0: { NS_ALERTSERVICE_CONTRACTID, &kNS_ALERTSSERVICE_CID }, michael@0: #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS) michael@0: { NS_PARENTALCONTROLSSERVICE_CONTRACTID, &kNS_PARENTALCONTROLSSERVICE_CID }, michael@0: #endif michael@0: { NS_DOWNLOADMANAGER_CONTRACTID, &kNS_DOWNLOADMANAGER_CID }, michael@0: { NS_DOWNLOADPLATFORM_CONTRACTID, &kNS_DOWNLOADPLATFORM_CID }, michael@0: { NS_TRANSFER_CONTRACTID, &kNS_DOWNLOAD_CID }, michael@0: { NS_FIND_SERVICE_CONTRACTID, &kNS_FIND_SERVICE_CID }, michael@0: { NS_TYPEAHEADFIND_CONTRACTID, &kNS_TYPEAHEADFIND_CID }, michael@0: #ifdef MOZ_URL_CLASSIFIER michael@0: { NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID, &kNS_APPLICATION_REPUTATION_SERVICE_CID }, michael@0: { NS_URLCLASSIFIERPREFIXSET_CONTRACTID, &kNS_URLCLASSIFIERPREFIXSET_CID }, michael@0: { NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID }, michael@0: { NS_URICLASSIFIERSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID }, michael@0: { NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID, &kNS_URLCLASSIFIERSTREAMUPDATER_CID }, michael@0: { NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID }, michael@0: #endif michael@0: { NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID }, michael@0: { NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CHARSETMENU_PID, &kNS_CHARSETMENU_CID }, michael@0: #if defined(USE_MOZ_UPDATER) michael@0: { NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID }, michael@0: #endif michael@0: { FINALIZATIONWITNESSSERVICE_CONTRACTID, &kFINALIZATIONWITNESSSERVICE_CID }, michael@0: { NATIVE_OSFILE_INTERNALS_SERVICE_CONTRACTID, &kNATIVE_OSFILE_INTERNALS_SERVICE_CID }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const Module kToolkitModule = { michael@0: Module::kVersion, michael@0: kToolkitCIDs, michael@0: kToolkitContracts michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsToolkitCompsModule) = &kToolkitModule;