зеркало из https://github.com/mozilla/gecko-dev.git
nsIComponentManager API Changes (bug 98553)
a) create a new nsIComponentManager with only four functions on it: CreateInstance CreateInstanceByContractID GetClassInfo GetClassInfoByContractID. b) rename the old nsIComponentManager to nsIComponentManagerObsolete. c) fixes callers which use to access the nsIComponentManager for component registration functionality. These callers will temporary use the nsIComponentManagerObsolete interface. d) Create a new API NS_GetComponentManager() which mirrors the NS_GetServiceManager() e) Perserves the old NS_GetGlobalComponentManager(). Note the cast usage. r/sr = rpotts@netscape.com alecf@netscape.com brendan@mozilla.org
This commit is contained in:
Родитель
8a9ab13265
Коммит
849d297364
|
@ -593,9 +593,16 @@ RegisterTypes(nsIComponentManager* aCompMgr,
|
|||
#ifdef NOISY_REGISTRY
|
||||
printf("Register %s => %s\n", contractid, aPath);
|
||||
#endif
|
||||
rv = aCompMgr->RegisterComponentWithType(kDocumentFactoryImplCID, "Layout",
|
||||
contractid, aPath, aLocation,
|
||||
PR_TRUE, PR_TRUE, aType);
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = obsoleteManager->RegisterComponentWithType(kDocumentFactoryImplCID, "Layout",
|
||||
contractid, aPath, aLocation,
|
||||
PR_TRUE, PR_TRUE, aType);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
// add the MIME types layotu can handle to the handlers category.
|
||||
|
@ -663,5 +670,13 @@ nsContentDLF::UnregisterDocumentFactories(nsIComponentManager* aCompMgr,
|
|||
const nsModuleComponentInfo* aInfo)
|
||||
{
|
||||
// XXXwaterson seems like this leaves the registry pretty dirty.
|
||||
return aCompMgr->UnregisterComponentSpec(kDocumentFactoryImplCID, aPath);
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return obsoleteManager->UnregisterComponentSpec(kDocumentFactoryImplCID, aPath);
|
||||
}
|
||||
|
|
|
@ -1357,7 +1357,9 @@ var nsLDAPDataSourceModule = {
|
|||
registerSelf: function (compMgr, fileSpec, location, type) {
|
||||
debug("*** Registering LDAP datasource components" +
|
||||
" (all right -- a JavaScript module!)\n");
|
||||
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(
|
||||
NS_LDAPDATASOURCE_CID,
|
||||
'LDAP RDF DataSource',
|
||||
|
|
|
@ -111,7 +111,7 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
|
|||
// XXX hack method
|
||||
NS_SetupRegistry();
|
||||
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
|
|
|
@ -581,6 +581,8 @@ var module = {
|
|||
this.firstTime = false;
|
||||
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
||||
}
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType( this.cid,
|
||||
"Mozilla Helper App Launcher Dialog",
|
||||
this.contractId,
|
||||
|
|
|
@ -281,6 +281,9 @@ ChatzillaModule.registerSelf =
|
|||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
dump("*** Registering -chat handler.\n");
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(CLINE_SERVICE_CID,
|
||||
"Chatzilla CommandLine Service",
|
||||
CLINE_SERVICE_CONTRACTID, fileSpec,
|
||||
|
@ -309,6 +312,9 @@ function (compMgr, fileSpec, location, type)
|
|||
ChatzillaModule.unregisterSelf =
|
||||
function(compMgr, fileSpec, location)
|
||||
{
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.unregisterComponentSpec(CLINE_SERVICE_CID, fileSpec);
|
||||
catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(nsICategoryManager);
|
||||
|
|
|
@ -76,6 +76,9 @@ Module.registerSelf =
|
|||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
dump("*** Registering -venkman handler.\n");
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(CLINE_SERVICE_CID,
|
||||
"Venkman CommandLine Service",
|
||||
CLINE_SERVICE_CTRID, fileSpec,
|
||||
|
@ -91,6 +94,8 @@ function (compMgr, fileSpec, location, type)
|
|||
Module.unregisterSelf =
|
||||
function(compMgr, fileSpec, location)
|
||||
{
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.unregisterComponentSpec(CLINE_SERVICE_CID, fileSpec);
|
||||
catman = Components.classes[CATMAN_CTRID].getService(nsICategoryManager);
|
||||
catman.deleteCategoryEntry("command-line-argument-handlers",
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
/*
|
||||
* nsDictionary XPCOM component
|
||||
* Version: $Revision: 1.4 $
|
||||
* Version: $Revision: 1.5 $
|
||||
*
|
||||
* $Id: nsDictionary.js,v 1.4 2000/09/13 23:51:27 rayw%netscape.com Exp $
|
||||
* $Id: nsDictionary.js,v 1.5 2001/12/19 00:11:33 dougt%netscape.com Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -83,6 +83,7 @@ nsDictionary.prototype= {
|
|||
/* nsDictionary Module (for XPCOM registration) */
|
||||
var nsDictionaryModule = {
|
||||
registerSelf: function(compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.registerComponentWithType(DICTIONARY_CID,
|
||||
"nsDictionary JS component", DICTIONARY_CONTRACTID, fileSpec, location,
|
||||
true, true, type);
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
/*
|
||||
* nsXmlRpcClient XPCOM component
|
||||
* Version: $Revision: 1.18 $
|
||||
* Version: $Revision: 1.19 $
|
||||
*
|
||||
* $Id: nsXmlRpcClient.js,v 1.18 2001/11/30 08:04:24 samuel%sieb.net Exp $
|
||||
* $Id: nsXmlRpcClient.js,v 1.19 2001/12/19 00:11:33 dougt%netscape.com Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -1176,6 +1176,8 @@ PushbackInputStream.prototype = {
|
|||
/* nsXmlRpcClient Module (for XPCOM registration) */
|
||||
var nsXmlRpcClientModule = {
|
||||
registerSelf: function(compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(XMLRPCCLIENT_CID,
|
||||
'XML-RPC Client JS component', XMLRPCCLIENT_CONTRACTID, fileSpec,
|
||||
location, true, true, type);
|
||||
|
|
|
@ -323,6 +323,9 @@ XMLtermModule.registerSelf =
|
|||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
dump("*** Registering -terminal handler.\n");
|
||||
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(XMLTERMCLINE_SERVICE_CID,
|
||||
"XMLterm CommandLine Service",
|
||||
XMLTERMCLINE_SERVICE_CONTRACTID, fileSpec,
|
||||
|
@ -351,6 +354,7 @@ function (compMgr, fileSpec, location, type)
|
|||
XMLtermModule.unregisterSelf =
|
||||
function(compMgr, fileSpec, location)
|
||||
{
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.unregisterComponentSpec(XMLTERMCLINE_SERVICE_CID, fileSpec);
|
||||
catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(nsICategoryManager);
|
||||
|
|
|
@ -298,7 +298,7 @@ Usage: %s [-i intype] [-o outtype] [-f flags] [-w wrapcol] [-c comparison_file]
|
|||
}
|
||||
else file = stdin;
|
||||
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, 0);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, 0);
|
||||
NS_SetupRegistry();
|
||||
|
||||
// Read in the string: very inefficient, but who cares?
|
||||
|
|
|
@ -142,7 +142,7 @@ getUILangCountry(PRUnichar** aUILang, PRUnichar** aCountry)
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
|
||||
// startup netlib:
|
||||
|
|
|
@ -815,9 +815,13 @@ mozJSComponentLoader::AttemptRegistration(nsIFile *component,
|
|||
nsXPIDLCString registryLocation;
|
||||
nsresult rv;
|
||||
nsIModule *module;
|
||||
|
||||
rv = mCompMgr->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -886,9 +890,13 @@ mozJSComponentLoader::UnregisterComponent(nsIFile *component)
|
|||
nsXPIDLCString registryLocation;
|
||||
nsresult rv;
|
||||
nsIModule *module;
|
||||
|
||||
rv = mCompMgr->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegistryLocationForSpec(component,
|
||||
getter_Copies(registryLocation));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -1130,8 +1138,13 @@ mozJSComponentLoader::GlobalForLocation(const char *aLocation,
|
|||
}
|
||||
|
||||
if (!component) {
|
||||
if (NS_FAILED(mCompMgr->SpecForRegistryLocation(aLocation,
|
||||
&component)))
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
return nsnull;
|
||||
|
||||
if (NS_FAILED(obsoleteManager->SpecForRegistryLocation(aLocation, &component)))
|
||||
return nsnull;
|
||||
needRelease = PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
static void SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -369,8 +369,8 @@ nsXPCComponents_Classes::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
|||
{
|
||||
case JSENUMERATE_INIT:
|
||||
{
|
||||
nsIComponentManager* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&compMgr)) ||
|
||||
nsIComponentManagerObsolete* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager((nsIComponentManager**)&compMgr)) ||
|
||||
!compMgr || NS_FAILED(compMgr->EnumerateContractIDs(&e)) || !e ||
|
||||
NS_FAILED(e->First()))
|
||||
|
||||
|
@ -529,8 +529,8 @@ nsXPCComponents_ClassesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
|||
{
|
||||
case JSENUMERATE_INIT:
|
||||
{
|
||||
nsIComponentManager* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&compMgr)) ||
|
||||
nsIComponentManagerObsolete* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager((nsIComponentManager**)&compMgr)) ||
|
||||
!compMgr || NS_FAILED(compMgr->EnumerateCLSIDs(&e)) || !e ||
|
||||
NS_FAILED(e->First()))
|
||||
|
||||
|
@ -590,8 +590,8 @@ IsRegisteredCLSID(const char* str)
|
|||
if(!id.Parse(str))
|
||||
return PR_FALSE;
|
||||
|
||||
nsIComponentManager* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&compMgr)) ||
|
||||
nsIComponentManagerObsolete* compMgr;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager((nsIComponentManager**)&compMgr)) ||
|
||||
!compMgr || NS_FAILED(compMgr->IsRegistered(id, ®istered)))
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -1612,17 +1612,7 @@ NS_IMETHODIMP
|
|||
nsXPCComponents::GetManager(nsIComponentManager * *aManager)
|
||||
{
|
||||
NS_ASSERTION(aManager, "bad param");
|
||||
|
||||
nsIComponentManager* cm;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&cm)))
|
||||
{
|
||||
*aManager = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_IF_ADDREF(cm);
|
||||
*aManager = cm;
|
||||
|
||||
return NS_OK;
|
||||
return NS_GetComponentManager(aManager);
|
||||
}
|
||||
|
||||
/**********************************************/
|
||||
|
|
|
@ -1109,8 +1109,8 @@ XPCConvert::JSValToXPCException(XPCCallContext& ccx,
|
|||
else
|
||||
{
|
||||
nsISupportsDouble* data;
|
||||
nsIComponentManager* cm;
|
||||
if(NS_FAILED(NS_GetGlobalComponentManager(&cm)) || !cm ||
|
||||
nsCOMPtr<nsIComponentManager> cm;
|
||||
if(NS_FAILED(NS_GetComponentManager(getter_AddRefs(cm))) || !cm ||
|
||||
NS_FAILED(cm->CreateInstanceByContractID(
|
||||
NS_SUPPORTS_DOUBLE_CONTRACTID,
|
||||
nsnull,
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
static void SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -593,9 +593,16 @@ RegisterTypes(nsIComponentManager* aCompMgr,
|
|||
#ifdef NOISY_REGISTRY
|
||||
printf("Register %s => %s\n", contractid, aPath);
|
||||
#endif
|
||||
rv = aCompMgr->RegisterComponentWithType(kDocumentFactoryImplCID, "Layout",
|
||||
contractid, aPath, aLocation,
|
||||
PR_TRUE, PR_TRUE, aType);
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = obsoleteManager->RegisterComponentWithType(kDocumentFactoryImplCID, "Layout",
|
||||
contractid, aPath, aLocation,
|
||||
PR_TRUE, PR_TRUE, aType);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
// add the MIME types layotu can handle to the handlers category.
|
||||
|
@ -663,5 +670,13 @@ nsContentDLF::UnregisterDocumentFactories(nsIComponentManager* aCompMgr,
|
|||
const nsModuleComponentInfo* aInfo)
|
||||
{
|
||||
// XXXwaterson seems like this leaves the registry pretty dirty.
|
||||
return aCompMgr->UnregisterComponentSpec(kDocumentFactoryImplCID, aPath);
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return obsoleteManager->UnregisterComponentSpec(kDocumentFactoryImplCID, aPath);
|
||||
}
|
||||
|
|
|
@ -278,6 +278,8 @@ var nsLDAPPrefsModule = new Object();
|
|||
nsLDAPPrefsModule.registerSelf =
|
||||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(NS_LDAPPREFSSERVICE_CID,
|
||||
"nsLDAPPrefs Service",
|
||||
NS_LDAPPREFSSERVICE_CONTRACTID, fileSpec,
|
||||
|
@ -287,6 +289,7 @@ function (compMgr, fileSpec, location, type)
|
|||
nsLDAPPrefsModule.unregisterSelf =
|
||||
function(compMgr, fileSpec, location)
|
||||
{
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.unregisterComponentSpec(NS_LDAPPREFSSERVICE_CID, fileSpec);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ SMIMEModule.registerSelf =
|
|||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
dump("*** Registering smime account manager extension.\n");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.registerComponentWithType(SMIME_EXTENSION_SERVICE_CID,
|
||||
"SMIME Account Manager Extension Service",
|
||||
SMIME_EXTENSION_SERVICE_CONTRACTID, fileSpec,
|
||||
|
@ -79,6 +80,7 @@ function (compMgr, fileSpec, location, type)
|
|||
SMIMEModule.unregisterSelf =
|
||||
function(compMgr, fileSpec, location)
|
||||
{
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.unregisterComponentSpec(SMIME_EXTENSION_SERVICE_CID, fileSpec);
|
||||
catman = Components.classes["@mozilla.org/categorymanager;1"].getService(nsICategoryManager);
|
||||
catman.deleteCategoryEntry("mailnews-accountmanager-extensions",
|
||||
|
|
|
@ -232,12 +232,7 @@ nsMimeXULEmitter::GetStatusObjForContractID(nsCString aContractID)
|
|||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
nsCID cid;
|
||||
rv = comMgr->ContractIDToClassID(aContractID.get(), &cid);
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
rv = comMgr->CreateInstance(cid, nsnull, NS_GET_IID(nsIMimeMiscStatus), (void**)&obj);
|
||||
rv = comMgr->CreateInstanceByContractID(aContractID.get(), nsnull, NS_GET_IID(nsIMimeMiscStatus), (void**)&obj);
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
else
|
||||
|
|
|
@ -399,9 +399,7 @@ pref("network.http.proxy.ssl.connect",true);
|
|||
// Idle timeout for ftp control connections - 5 minute default
|
||||
pref("network.ftp.idleConnectionTimeout", 300);
|
||||
|
||||
// until the directory view has an owner
|
||||
// necko will produce html -- dougt
|
||||
pref("network.dir.generate_html", true);
|
||||
pref("network.dir.generate_html", false);
|
||||
|
||||
// sspitzer: change this back to "news" when we get to beta.
|
||||
// for now, set this to news.mozilla.org because you can only
|
||||
|
|
|
@ -2405,6 +2405,121 @@ VR_INTERFACE(REGERR) NR_RegOpen( char *filename, HREG *hReg )
|
|||
|
||||
|
||||
|
||||
static REGERR NR_RegOpen( char *filename, HREG *hReg )
|
||||
{
|
||||
REGERR status = REGERR_OK;
|
||||
REGFILE *pReg;
|
||||
REGHANDLE *pHandle;
|
||||
|
||||
XP_ASSERT( regStartCount > 0 );
|
||||
|
||||
/* initialize output handle in case of error */
|
||||
if ( hReg == NULL ) {
|
||||
return REGERR_PARAM;
|
||||
}
|
||||
*hReg = NULL;
|
||||
|
||||
/* Look for named file in list of open registries */
|
||||
filename = nr_GetRegName( filename );
|
||||
if (filename == NULL) {
|
||||
filename = "";
|
||||
}
|
||||
pReg = vr_findRegFile( filename );
|
||||
|
||||
/* if registry not already open */
|
||||
if (pReg == NULL) {
|
||||
|
||||
/* ...then open it */
|
||||
pReg = (REGFILE*)XP_ALLOC( sizeof(REGFILE) );
|
||||
if ( pReg == NULL ) {
|
||||
status = REGERR_MEMORY;
|
||||
goto bail;
|
||||
}
|
||||
XP_MEMSET(pReg, 0, sizeof(REGFILE));
|
||||
|
||||
pReg->inInit = TRUE;
|
||||
pReg->filename = XP_STRDUP(filename);
|
||||
if (pReg->filename == NULL) {
|
||||
XP_FREE( pReg );
|
||||
status = REGERR_MEMORY;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
status = nr_OpenFile( filename, &(pReg->fh) );
|
||||
if (status == REGERR_READONLY) {
|
||||
/* Open, but read only */
|
||||
pReg->readOnly = TRUE;
|
||||
status = REGERR_OK;
|
||||
}
|
||||
if ( status != REGERR_OK ) {
|
||||
XP_FREE( pReg->filename );
|
||||
XP_FREE( pReg );
|
||||
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* ...read and validate the header */
|
||||
status = nr_ReadHdr( pReg );
|
||||
if ( status != REGERR_OK ) {
|
||||
nr_CloseFile( &(pReg->fh) );
|
||||
XP_FREE( pReg->filename );
|
||||
XP_FREE( pReg );
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* ...other misc initialization */
|
||||
pReg->refCount = 0;
|
||||
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
pReg->uniqkey = PR_Now();
|
||||
#endif
|
||||
|
||||
status = nr_InitStdRkeys( pReg );
|
||||
if ( status == REGERR_OK ) {
|
||||
/* ...and add it to the list */
|
||||
nr_AddNode( pReg );
|
||||
}
|
||||
else {
|
||||
nr_CloseFile( &(pReg->fh) );
|
||||
XP_FREE( pReg->filename );
|
||||
XP_FREE( pReg );
|
||||
goto bail;
|
||||
}
|
||||
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
pReg->lock = PR_NewLock();
|
||||
#endif
|
||||
|
||||
/* now done with everything that needs to protect the header */
|
||||
pReg->inInit = FALSE;
|
||||
}
|
||||
|
||||
/* create a new handle to the regfile */
|
||||
pHandle = (REGHANDLE*)XP_ALLOC( sizeof(REGHANDLE) );
|
||||
if ( pHandle == NULL ) {
|
||||
/* we can't create the handle */
|
||||
if ( pReg->refCount == 0 ) {
|
||||
/* we've just opened it so close it and remove node */
|
||||
nr_CloseFile( &(pReg->fh) );
|
||||
nr_DeleteNode( pReg );
|
||||
}
|
||||
|
||||
status = REGERR_MEMORY;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
pHandle->magic = MAGIC_NUMBER;
|
||||
pHandle->pReg = pReg;
|
||||
|
||||
/* success: bump the reference count and return the handle */
|
||||
pReg->refCount++;
|
||||
*hReg = (void*)pHandle;
|
||||
|
||||
bail:
|
||||
return status;
|
||||
|
||||
} /* nr_RegOpen */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegClose - Close a netscape XP registry
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
#include "nsICachingChannel.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsIProxyInfo.h"
|
||||
#include "nsObsoleteModuleLoading.h"
|
||||
|
||||
#include "nsPluginLogging.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
|
@ -2644,7 +2645,7 @@ nsresult nsPluginHostImpl::ReloadPlugins(PRBool reloadPages)
|
|||
mPluginsLoaded = PR_FALSE;
|
||||
|
||||
//refresh the component registry first
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
|
||||
// load them again
|
||||
nsresult rv = LoadPlugins();
|
||||
|
@ -3547,6 +3548,11 @@ nsresult nsPluginHostImpl::RegisterPluginMimeTypesWithLayout(nsPluginTag * plugi
|
|||
pluginTag->mFileName));
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(compManager, &rv);
|
||||
if (!obsoleteManager)
|
||||
return rv;
|
||||
|
||||
for(int i = 0; i < pluginTag->mVariants; i++)
|
||||
{
|
||||
|
@ -3555,12 +3561,13 @@ nsresult nsPluginHostImpl::RegisterPluginMimeTypesWithLayout(nsPluginTag * plugi
|
|||
nsCAutoString contractid(NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "view;1?type=");
|
||||
contractid += pluginTag->mMimeTypeArray[i];
|
||||
|
||||
rv = compManager->RegisterComponentSpec(kPluginDocLoaderFactoryCID,
|
||||
"Plugin Loader Stub",
|
||||
contractid.get(),
|
||||
path,
|
||||
PR_TRUE,
|
||||
PR_FALSE);
|
||||
|
||||
rv = obsoleteManager->RegisterComponentSpec(kPluginDocLoaderFactoryCID,
|
||||
"Plugin Loader Stub",
|
||||
contractid.get(),
|
||||
path,
|
||||
PR_TRUE,
|
||||
PR_FALSE);
|
||||
|
||||
PLUGIN_LOG(PLUGIN_LOG_NOISY,
|
||||
("nsPluginHostImpl::RegisterPluginMimeTypesWithLayout mime=%s, plugin=%s\n",
|
||||
|
@ -4630,10 +4637,15 @@ NS_IMETHODIMP nsPluginHostImpl::LoadPlugins()
|
|||
// retrieve a path for layout module. Needed for plugin mime types registration
|
||||
nsCOMPtr<nsIFile> layoutPath;
|
||||
nsCOMPtr<nsIComponentManager> compManager = do_GetService(kComponentManagerCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && compManager)
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(compManager);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && compManager && obsoleteManager)
|
||||
{
|
||||
PRBool gotLayoutPath;
|
||||
if (NS_SUCCEEDED(compManager->SpecForRegistryLocation(REL_PLUGIN_DLL, getter_AddRefs(layoutPath))))
|
||||
if (NS_SUCCEEDED(obsoleteManager->SpecForRegistryLocation(REL_PLUGIN_DLL, getter_AddRefs(layoutPath))))
|
||||
gotLayoutPath = PR_TRUE;
|
||||
else
|
||||
gotLayoutPath = PR_FALSE;
|
||||
|
@ -4739,7 +4751,11 @@ cidToDllname(nsIComponentManager* aComponentManager, nsIRegistry* aRegistry,
|
|||
rv = aRegistry->GetBytesUTF8(cidKey, "InprocServer", &count, &library);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
rv = aComponentManager->SpecForRegistryLocation(NS_REINTERPRET_CAST(const char*, library),
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aComponentManager, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->SpecForRegistryLocation(NS_REINTERPRET_CAST(const char*, library),
|
||||
getter_AddRefs(file));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
|
|
@ -67,6 +67,7 @@ var filterModule = new Object();
|
|||
filterModule.registerSelf =
|
||||
function (compMgr, fileSpec, location, type) {
|
||||
dump("*** Registering Web Filters (a Javascript module!)\n");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.registerComponentWithType(kFILTERS_CID,
|
||||
"Javascript Web Filters",
|
||||
kFILTERS_CONTRACTID,
|
||||
|
|
|
@ -188,6 +188,7 @@ var pacModule = new Object();
|
|||
|
||||
pacModule.registerSelf =
|
||||
function (compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.registerComponentWithType(kPAC_CID,
|
||||
"Proxy Auto Config",
|
||||
kPAC_CONTRACTID,
|
||||
|
|
|
@ -252,7 +252,7 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, "./components");
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, "./components");
|
||||
|
||||
testURL(argv[1]);
|
||||
return 0;
|
||||
|
|
|
@ -169,14 +169,8 @@ nsResProtocolHandler::SetSpecialDir(const char *root, const char *dir)
|
|||
rv = NS_GetSpecialDirectory(dir, getter_AddRefs(file));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString spec;
|
||||
rv = file->GetURL(getter_Copies(spec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
LOG(("root=\"%s\" -> baseURI=%s\n", root, spec.get()));
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
mIOService->NewURI(spec, nsnull, getter_AddRefs(uri));
|
||||
mIOService->NewFileURI(file, getter_AddRefs(uri));
|
||||
|
||||
return SetSubstitution(root, uri);
|
||||
}
|
||||
|
|
|
@ -439,10 +439,6 @@ nsStreamConverterService::Convert(nsIInputStream *aFromStream,
|
|||
contractID.AppendWithConversion(aToType);
|
||||
const char *cContractID = contractID.get();
|
||||
|
||||
nsIComponentManager *comMgr;
|
||||
rv = NS_GetGlobalComponentManager(&comMgr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIStreamConverter> converter(do_CreateInstance(cContractID, &rv));
|
||||
if (NS_FAILED(rv)) {
|
||||
// couldn't go direct, let's try walking the graph of converters.
|
||||
|
@ -542,10 +538,6 @@ nsStreamConverterService::AsyncConvertData(const PRUnichar *aFromType,
|
|||
contractID.AppendWithConversion(aToType);
|
||||
const char *cContractID = contractID.get();
|
||||
|
||||
nsIComponentManager *comMgr;
|
||||
rv = NS_GetGlobalComponentManager(&comMgr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIStreamConverter> listener(do_CreateInstance(cContractID, &rv));
|
||||
if (NS_FAILED(rv)) {
|
||||
// couldn't go direct, let's try walking the graph of converters.
|
||||
|
|
|
@ -151,7 +151,7 @@ main(int argc, char* argv[])
|
|||
|
||||
eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &gEventQ);
|
||||
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsICategoryManager> catman =
|
||||
|
|
|
@ -216,7 +216,7 @@ main(void)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Register components
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
|
||||
|
||||
// Get default directory
|
||||
|
|
|
@ -544,7 +544,7 @@ FillCache(nsINetDataCacheManager *aCache, PRUint32 aFlags, PRUint32 aCacheCapaci
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ ParallelReadTest(char* dirName, nsIFileTransportService* fts)
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ Test(CreateFun create, PRUint32 count,
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ NS_IMPL_ISUPPORTS1(MyOpenObserver, nsIRequestObserver);
|
|||
nsresult
|
||||
NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ MyNotifications::OnProgress(nsIRequest *req, nsISupports *ctx,
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ MyNotifications::OnProgress(nsIRequest *req, nsISupports *ctx,
|
|||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ main(int argc, char **argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL);
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
// cache the io service
|
||||
|
|
|
@ -685,7 +685,7 @@ FillCache(nsINetDataCache *cache)
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ TestAsyncRead(const char* url)
|
|||
nsresult
|
||||
NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ InputTestConsumer::OnStopRequest(nsIRequest *request, nsISupports* context,
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ void TimerCallback(nsITimer* aTimer, void* aClosure)
|
|||
nsresult NS_AutoregisterComponents();
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ static nsIEventQueue* gEventQ = nsnull;
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -197,7 +197,7 @@ TestSyncWrites(char* filenamePrefix, PRUint32 startPosition, PRInt32 length)
|
|||
nsresult
|
||||
NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ int doMakeAbsTest(const char* i_URL = 0, const char* i_relativePortion=0)
|
|||
|
||||
nsresult NS_AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ Usage: %s [-i intype] [-o outtype] [-f flags] [-w wrapcol] [-c comparison_file]
|
|||
}
|
||||
else file = stdin;
|
||||
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, 0);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, 0);
|
||||
NS_SetupRegistry();
|
||||
|
||||
// Read in the string: very inefficient, but who cares?
|
||||
|
|
|
@ -420,11 +420,29 @@ nsrefcnt nsViewManager::Release(void)
|
|||
return mRefCnt;
|
||||
}
|
||||
|
||||
static nsresult CreateRegion(nsIComponentManager* componentManager, nsIRegion* *result)
|
||||
nsresult
|
||||
nsViewManager::CreateRegion(nsIRegion* *result)
|
||||
{
|
||||
*result = nsnull;
|
||||
nsresult rv;
|
||||
|
||||
if (!mRegionFactory) {
|
||||
nsCOMPtr<nsIComponentManager> compMgr;
|
||||
rv = NS_GetComponentManager(getter_AddRefs(compMgr));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = compMgr->GetClassObject(kRegionCID,
|
||||
NS_GET_IID(nsIFactory),
|
||||
getter_AddRefs(mRegionFactory));
|
||||
|
||||
if (!mRegionFactory) {
|
||||
*result = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsIRegion* region = nsnull;
|
||||
nsresult rv = componentManager->CreateInstance(kRegionCID, nsnull, NS_GET_IID(nsIRegion), (void**)®ion);
|
||||
rv = mRegionFactory->CreateInstance(nsnull, NS_GET_IID(nsIRegion), (void**)®ion);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = region->Init();
|
||||
*result = region;
|
||||
|
@ -462,14 +480,10 @@ NS_IMETHODIMP nsViewManager::Init(nsIDeviceContext* aContext)
|
|||
// create regions
|
||||
mOpaqueRgn = nsnull;
|
||||
mTmpRgn = nsnull;
|
||||
|
||||
nsIComponentManager* componentManager = nsnull;
|
||||
rv = NS_GetGlobalComponentManager(&componentManager);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CreateRegion(componentManager, &mOpaqueRgn);
|
||||
CreateRegion(componentManager, &mTmpRgn);
|
||||
}
|
||||
|
||||
|
||||
CreateRegion(&mOpaqueRgn);
|
||||
CreateRegion(&mTmpRgn);
|
||||
|
||||
if (nsnull == mEventQueue) {
|
||||
// Cache the event queue of the current UI thread
|
||||
nsCOMPtr<nsIEventQueueService> eventService =
|
||||
|
@ -1747,12 +1761,9 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
// printf("refreshing: view: %x, %d, %d, %d, %d\n", view, damrect.x, damrect.y, damrect.width, damrect.height);
|
||||
// Refresh the view
|
||||
if (mRefreshEnabled) {
|
||||
nsIComponentManager* componentManager = nsnull;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&componentManager);
|
||||
nsCOMPtr<nsIRegion> rgn;
|
||||
nsresult rv = CreateRegion(getter_AddRefs(rgn));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = CreateRegion(componentManager, getter_AddRefs(rgn));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Eventually we would like the platform paint event to include a region
|
||||
// we can use. This could improve paint performance when the invalid area
|
||||
// is more complicated than a rectangle. Right now the event's region field
|
||||
|
@ -1761,9 +1772,9 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
rgn->SetTo(damrect.x, damrect.y, damrect.width, damrect.height);
|
||||
Refresh(view, ((nsPaintEvent*)aEvent)->renderingContext, rgn, updateFlags);
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// since we got an NS_PAINT event, we need to
|
||||
// draw something so we don't get blank areas.
|
||||
|
|
|
@ -407,6 +407,9 @@ private:
|
|||
|
||||
nsISupportsArray *mCompositeListeners;
|
||||
void DestroyZTreeNode(DisplayZTreeNode* aNode);
|
||||
|
||||
nsresult CreateRegion(nsIRegion* *result);
|
||||
nsCOMPtr<nsIFactory> mRegionFactory;
|
||||
protected:
|
||||
nsView *mRootView;
|
||||
nscoord mX;
|
||||
|
|
|
@ -255,7 +255,7 @@ NS_METHOD nsTestFormProcessor::ProvideContent(const nsString& aFormType,
|
|||
nsresult
|
||||
nsViewerApp::AutoregisterComponents()
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsresult rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "nscore.h"
|
||||
|
||||
class nsIComponentManager;
|
||||
class nsIServiceManager;
|
||||
class nsIFile;
|
||||
class nsIDirectoryServiceProvider;
|
||||
|
@ -110,6 +111,19 @@ NS_ShutdownXPCOM(nsIServiceManager* servMgr);
|
|||
extern "C" NS_COM nsresult
|
||||
NS_GetServiceManager(nsIServiceManager* *result);
|
||||
|
||||
/**
|
||||
* Public Method to access to the component manager.
|
||||
*
|
||||
* @status FROZEN
|
||||
* @param result Interface pointer to the service
|
||||
*
|
||||
* @return NS_OK for success;
|
||||
* other error codes indicate a failure during initialisation.
|
||||
*
|
||||
*/
|
||||
extern "C" NS_COM nsresult
|
||||
NS_GetComponentManager(nsIComponentManager* *result);
|
||||
|
||||
/**
|
||||
* Public Method to access to the memory manager. See nsIMemory
|
||||
*
|
||||
|
|
|
@ -183,8 +183,13 @@ RegisterGenericFactory(nsIComponentManager* compMgr,
|
|||
nsIGenericFactory* fact;
|
||||
rv = NS_NewGenericFactory(&fact, info);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = compMgr->RegisterFactory(info->mCID, info->mDescription,
|
||||
info->mContractID, fact, PR_TRUE);
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(compMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegisterFactory(info->mCID, info->mDescription,
|
||||
info->mContractID, fact, PR_TRUE);
|
||||
NS_RELEASE(fact);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -5,3 +5,6 @@ nsComponentManagerUtils.h
|
|||
nsStaticComponent.h
|
||||
nsIServiceManagerObsolete.h
|
||||
nsIServiceManagerUtils.h
|
||||
nsComponentManagerObsolete.h
|
||||
nsIComponentManagerUtils.h
|
||||
nsObsoleteModuleLoading.h
|
||||
|
|
|
@ -3,6 +3,7 @@ nsICategoryManager.idl
|
|||
nsIClassInfo.idl
|
||||
nsIComponentLoader.idl
|
||||
nsIComponentManager.idl
|
||||
nsIComponentManagerObsolete.idl
|
||||
nsIFactory.idl
|
||||
nsIRegistry.idl
|
||||
nsIServiceManager.idl
|
||||
|
|
|
@ -32,7 +32,9 @@ REQUIRES = mozreg \
|
|||
## exports
|
||||
|
||||
EXPORTS = \
|
||||
nsComponentManagerObsolete.h \
|
||||
nsComponentManagerUtils.h \
|
||||
nsIComponentManagerUtils.h \
|
||||
nsIGenericFactory.h \
|
||||
nsIRegistryUtils.h \
|
||||
nsIServiceManagerObsolete.h \
|
||||
|
@ -41,6 +43,7 @@ EXPORTS = \
|
|||
nsNativeComponentLoader.h \
|
||||
nsStaticComponent.h \
|
||||
xcDll.h \
|
||||
nsObsoleteModuleLoading.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
@ -49,6 +52,7 @@ XPIDLSRCS = \
|
|||
.\nsIClassInfo.idl \
|
||||
.\nsIComponentLoader.idl \
|
||||
.\nsIComponentManager.idl \
|
||||
.\nsIComponentManagerObsolete.idl \
|
||||
.\nsIFactory.idl \
|
||||
.\nsIModule.idl \
|
||||
.\nsIRegistry.idl \
|
||||
|
@ -74,6 +78,7 @@ LCFLAGS = $(LCFLAGS) -DENABLE_STATIC_COMPONENT_LOADER
|
|||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsComponentManager.obj \
|
||||
.\$(OBJDIR)\nsComponentManagerObsolete.obj \
|
||||
.\$(OBJDIR)\nsGenericFactory.obj \
|
||||
.\$(OBJDIR)\nsNativeComponentLoader.obj \
|
||||
.\$(OBJDIR)\nsServiceManagerObsolete.obj \
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsComponentManager.h"
|
||||
#include "nsComponentManagerObsolete.h"
|
||||
#include "nsICategoryManager.h"
|
||||
|
||||
#include "nsIEnumerator.h"
|
||||
|
@ -455,11 +456,14 @@ nsFactoryEntry::ReInit(const nsCID &aClass, nsIFactory *aFactory)
|
|||
|
||||
|
||||
nsComponentManagerImpl::nsComponentManagerImpl()
|
||||
: mMon(NULL),
|
||||
mRegistry(NULL), mPrePopulationDone(PR_FALSE),
|
||||
mNativeComponentLoader(0),
|
||||
mStaticComponentLoader(0),
|
||||
mShuttingDown(NS_SHUTDOWN_NEVERHAPPENED), mLoaderData(nsnull)
|
||||
:
|
||||
mMon(NULL),
|
||||
mRegistry(NULL),
|
||||
mPrePopulationDone(PR_FALSE),
|
||||
mNativeComponentLoader(0),
|
||||
mStaticComponentLoader(0),
|
||||
mShuttingDown(NS_SHUTDOWN_NEVERHAPPENED),
|
||||
mLoaderData(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mFactories.ops = nsnull;
|
||||
|
@ -510,7 +514,6 @@ nsresult nsComponentManagerImpl::Init(void)
|
|||
0.875,
|
||||
PL_DHASH_MIN_ALPHA(&mContractIDs, 2));
|
||||
}
|
||||
|
||||
if (mMon == NULL) {
|
||||
mMon = PR_NewMonitor();
|
||||
if (mMon == NULL)
|
||||
|
@ -614,7 +617,6 @@ nsresult nsComponentManagerImpl::Shutdown(void)
|
|||
NS_IF_RELEASE(mStaticComponentLoader);
|
||||
#endif
|
||||
|
||||
// Destroy the Lock
|
||||
if (mMon)
|
||||
PR_DestroyMonitor(mMon);
|
||||
|
||||
|
@ -639,12 +641,13 @@ nsComponentManagerImpl::~nsComponentManagerImpl()
|
|||
PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, ("nsComponentManager: Destroyed."));
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS5(nsComponentManagerImpl,
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS6(nsComponentManagerImpl,
|
||||
nsIComponentManager,
|
||||
nsIServiceManager,
|
||||
nsISupportsWeakReference,
|
||||
nsIInterfaceRequestor,
|
||||
nsIServiceManagerObsolete)
|
||||
nsIServiceManagerObsolete,
|
||||
nsIComponentManagerObsolete)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsComponentManagerImpl: Platform methods
|
||||
|
@ -1229,6 +1232,7 @@ nsComponentManagerImpl::HashContractID(const char *aContractID, nsFactoryEntry *
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
nsContractIDTableEntry* contractIDTableEntry =
|
||||
NS_STATIC_CAST(nsContractIDTableEntry*,
|
||||
PL_DHashTableOperate(&mContractIDs, aContractID,
|
||||
|
@ -1283,6 +1287,7 @@ nsComponentManagerImpl::GetFactoryEntry(const char *aContractID, int checkRegist
|
|||
{
|
||||
nsFactoryEntry *fe = nsnull;
|
||||
{
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
nsContractIDTableEntry* contractIDTableEntry =
|
||||
|
@ -1461,6 +1466,34 @@ nsComponentManagerImpl::GetClassObject(const nsCID &aClass, const nsIID &aIID,
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsComponentManagerImpl::GetClassObjectByContractID(const char *contractID,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFactory> factory;
|
||||
|
||||
if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_ALWAYS))
|
||||
{
|
||||
PR_LogPrint("nsComponentManager: GetClassObject(%s)", contractID);
|
||||
}
|
||||
|
||||
PR_ASSERT(aResult != NULL);
|
||||
|
||||
rv = FindFactory(contractID, getter_AddRefs(factory));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = factory->QueryInterface(aIID, aResult);
|
||||
|
||||
PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
|
||||
("\t\tGetClassObject() %s", NS_SUCCEEDED(rv) ? "succeeded" : "FAILED"));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* ContractIDToClassID()
|
||||
*
|
||||
|
@ -1675,16 +1708,14 @@ FreeServiceContractIDEntryEnumerate(PLDHashTable *aTable,
|
|||
nsresult
|
||||
nsComponentManagerImpl::FreeServices()
|
||||
{
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
if (mFactories.ops) {
|
||||
PR_EnterMonitor(mMon);
|
||||
PL_DHashTableEnumerate(&mFactories, FreeServiceFactoryEntryEnumerate, nsnull);
|
||||
PR_ExitMonitor(mMon);
|
||||
}
|
||||
|
||||
if (mContractIDs.ops) {
|
||||
PR_EnterMonitor(mMon);
|
||||
PL_DHashTableEnumerate(&mContractIDs, FreeServiceContractIDEntryEnumerate, nsnull);
|
||||
PR_ExitMonitor(mMon);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1726,7 +1757,9 @@ nsComponentManagerImpl::GetService(const nsCID& aClass,
|
|||
// CreateInstance, because it invokes user code which could try to re-enter
|
||||
// the service manager:
|
||||
mon.Exit();
|
||||
|
||||
rv = CreateInstance(aClass, NULL, aIID, getter_AddRefs(service));
|
||||
|
||||
mon.Enter();
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -1790,6 +1823,7 @@ nsComponentManagerImpl::UnregisterService(const nsCID& aClass)
|
|||
nsFactoryEntry* entry = nsnull;
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
nsFactoryTableEntry* factoryTableEntry =
|
||||
NS_STATIC_CAST(nsFactoryTableEntry*,
|
||||
PL_DHashTableOperate(&mFactories, &aClass,
|
||||
|
@ -1809,6 +1843,7 @@ nsComponentManagerImpl::UnregisterService(const nsCID& aClass)
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::RegisterService(const char* aContractID, nsISupports* aService)
|
||||
{
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
// check to see if we have a factory entry for the service
|
||||
|
@ -1904,7 +1939,7 @@ NS_IMETHODIMP nsComponentManagerImpl::IsServiceInstantiatedByContractID(const ch
|
|||
nsFactoryEntry *entry = nsnull;
|
||||
{
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
|
||||
nsContractIDTableEntry* contractIDTableEntry =
|
||||
NS_STATIC_CAST(nsContractIDTableEntry*,
|
||||
PL_DHashTableOperate(&mContractIDs, aContractID,
|
||||
|
@ -1928,6 +1963,7 @@ NS_IMETHODIMP
|
|||
nsComponentManagerImpl::UnregisterService(const char* aContractID)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
nsFactoryEntry *entry = nsnull;
|
||||
|
@ -1983,7 +2019,9 @@ nsComponentManagerImpl::GetServiceByContractID(const char* aContractID,
|
|||
// CreateInstance, because it invokes user code which could try to re-enter
|
||||
// the service manager:
|
||||
mon.Exit();
|
||||
|
||||
rv = CreateInstanceByContractID(aContractID, NULL, aIID, getter_AddRefs(service));
|
||||
|
||||
mon.Enter();
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -2191,9 +2229,10 @@ nsComponentManagerImpl::RegisterFactory(const nsCID &aClass,
|
|||
PRBool aReplace)
|
||||
{
|
||||
nsFactoryEntry *entry = nsnull;
|
||||
|
||||
nsIDKey key(aClass);
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
entry = GetFactoryEntry(aClass, key,
|
||||
0 /* dont check registry */);
|
||||
|
||||
|
@ -2349,6 +2388,7 @@ nsComponentManagerImpl::RegisterComponentCommon(const nsCID &aClass,
|
|||
|
||||
nsIDKey key(aClass);
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
nsFactoryEntry *entry = GetFactoryEntry(aClass, !mPrePopulationDone);
|
||||
|
||||
// Normalize proid and classname
|
||||
|
@ -2574,6 +2614,7 @@ nsComponentManagerImpl::UnregisterFactory(const nsCID &aClass,
|
|||
if (old->factory.get() == aFactory)
|
||||
{
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
PL_DHashTableOperate(&mFactories, &aClass, PL_DHASH_REMOVE);
|
||||
old = NULL;
|
||||
res = NS_OK;
|
||||
|
@ -2595,7 +2636,7 @@ nsComponentManagerImpl::UnregisterComponent(const nsCID &aClass,
|
|||
|
||||
NS_ENSURE_ARG_POINTER(registryName);
|
||||
|
||||
PR_EnterMonitor(mMon);
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
// Remove any stored factory entries
|
||||
nsIDKey key(aClass);
|
||||
|
@ -2614,8 +2655,6 @@ nsComponentManagerImpl::UnregisterComponent(const nsCID &aClass,
|
|||
delete [] cidString;
|
||||
#endif
|
||||
|
||||
PR_ExitMonitor(mMon);
|
||||
|
||||
PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
|
||||
("nsComponentManager: Factory unregister(%s) %s.", registryName,
|
||||
NS_SUCCEEDED(rv) ? "succeeded" : "FAILED"));
|
||||
|
@ -2646,7 +2685,7 @@ nsComponentManagerImpl::UnloadLibraries(nsIServiceManager *serviceMgr, PRInt32 a
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PR_EnterMonitor(mMon);
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS,
|
||||
("nsComponentManager: Unloading Libraries."));
|
||||
|
@ -2664,9 +2703,6 @@ nsComponentManagerImpl::UnloadLibraries(nsIServiceManager *serviceMgr, PRInt32 a
|
|||
|
||||
// UnloadAll the native loader
|
||||
rv = mNativeComponentLoader->UnloadAll(aWhen);
|
||||
|
||||
PR_ExitMonitor(mMon);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -3237,6 +3273,9 @@ nsComponentManagerImpl::AddLoaderType(const char *typeStr)
|
|||
NS_COM nsresult
|
||||
NS_GetGlobalComponentManager(nsIComponentManager* *result)
|
||||
{
|
||||
#ifdef DEBUG_dougt
|
||||
// NS_WARNING("DEPRECATED FUNCTION: Use NS_GetComponentManager");
|
||||
#endif
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager == NULL)
|
||||
|
@ -3248,12 +3287,38 @@ NS_GetGlobalComponentManager(nsIComponentManager* *result)
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// NO ADDREF since this is never intended to be released.
|
||||
*result = nsComponentManagerImpl::gComponentManager;
|
||||
// See nsComponentManagerObsolete.h for the reason for such
|
||||
// casting uglyness
|
||||
*result = (nsIComponentManager*)(void*)(nsIComponentManagerObsolete*) nsComponentManagerImpl::gComponentManager;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
NS_COM nsresult
|
||||
NS_GetComponentManager(nsIComponentManager* *result)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager == NULL)
|
||||
{
|
||||
// XPCOM needs initialization.
|
||||
rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
||||
*result = NS_STATIC_CAST(nsIComponentManager*,
|
||||
nsComponentManagerImpl::gComponentManager);
|
||||
NS_IF_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_COM nsresult
|
||||
NS_GetServiceManager(nsIServiceManager* *result)
|
||||
{
|
||||
|
@ -3276,233 +3341,3 @@ NS_GetServiceManager(nsIServiceManager* *result)
|
|||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global component manager interface
|
||||
|
||||
nsresult
|
||||
nsComponentManager::Initialize(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::FindFactory(const nsCID &aClass,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->FindFactory(aClass, aFactory);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::GetClassObject(const nsCID &aClass, const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->GetClassObject(aClass, aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::ContractIDToClassID(const char *aContractID,
|
||||
nsCID *aClass)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->ContractIDToClassID(aContractID, aClass);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::CLSIDToContractID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aContractID)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->CLSIDToContractID(*aClass, aClassName, aContractID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->CreateInstance(aClass, aDelegate, aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::CreateInstance(const char *aContractID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->CreateInstanceByContractID(aContractID, aDelegate, aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterFactory(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory *aFactory,
|
||||
PRBool aReplace)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterFactory(aClass, aClassName, aContractID,
|
||||
aFactory, aReplace);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterComponent(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *aLibraryPersistentDescriptor,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterComponent(aClass, aClassName, aContractID,
|
||||
aLibraryPersistentDescriptor, aReplace, aPersist);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterComponentSpec(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFile *aLibrary,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterComponentSpec(aClass, aClassName, aContractID,
|
||||
aLibrary, aReplace, aPersist);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterComponentLib(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *adllName,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterComponentLib(aClass, aClassName, aContractID,
|
||||
adllName, aReplace, aPersist);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::UnregisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->UnregisterFactory(aClass, aFactory);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::UnregisterComponent(const nsCID &aClass,
|
||||
const char *aLibrary)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->UnregisterComponent(aClass, aLibrary);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::UnregisterComponentSpec(const nsCID &aClass,
|
||||
nsIFile *aLibrarySpec)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->UnregisterComponentSpec(aClass, aLibrarySpec);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::FreeLibraries(void)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->FreeLibraries();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::AutoRegister(PRInt32 when, nsIFile *directory)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->AutoRegister(when, directory);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::AutoRegisterComponent(PRInt32 when,
|
||||
nsIFile *fullname)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->AutoRegisterComponent(when, fullname);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::AutoUnregisterComponent(PRInt32 when,
|
||||
nsIFile *fullname)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->AutoUnregisterComponent(when, fullname);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::IsRegistered(const nsCID &aClass,
|
||||
PRBool *aRegistered)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->IsRegistered(aClass, aRegistered);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::EnumerateCLSIDs(nsIEnumerator** aEnumerator)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->EnumerateCLSIDs(aEnumerator);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::EnumerateContractIDs(nsIEnumerator** aEnumerator)
|
||||
{
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->EnumerateContractIDs(aEnumerator);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsIComponentLoader.h"
|
||||
#include "nsNativeComponentLoader.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentManagerObsolete.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsRegistry.h"
|
||||
|
@ -79,19 +80,32 @@ extern const char XPCOM_LIB_PREFIX[];
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class nsComponentManagerImpl
|
||||
: public nsIComponentManager,
|
||||
public nsIServiceManager,
|
||||
public nsSupportsWeakReference,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsIServiceManagerObsolete
|
||||
public nsIServiceManagerObsolete,
|
||||
public nsIComponentManagerObsolete
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSICOMPONENTMANAGER
|
||||
NS_DECL_NSISERVICEMANAGER
|
||||
|
||||
// Since the nsIComponentManagerObsolete and nsIComponentManager share some of the
|
||||
// same interface function name, we have to manually define the functions here.
|
||||
// The only function that is in nsIComponentManagerObsolete and is in nsIComponentManager
|
||||
// is GetClassObjectContractID.
|
||||
//
|
||||
// nsIComponentManager function not in nsIComponentManagerObsolete:
|
||||
NS_IMETHOD GetClassObjectByContractID(const char *aContractID,
|
||||
const nsIID &aIID,
|
||||
void **_retval);
|
||||
|
||||
NS_DECL_NSICOMPONENTMANAGEROBSOLETE
|
||||
NS_DECL_NSISERVICEMANAGER
|
||||
|
||||
// nsIServiceManagerObsolete
|
||||
NS_IMETHOD
|
||||
RegisterService(const nsCID& aClass, nsISupports* aService);
|
||||
|
@ -196,6 +210,7 @@ protected:
|
|||
PLDHashTable mFactories;
|
||||
PLDHashTable mContractIDs;
|
||||
PRMonitor* mMon;
|
||||
|
||||
nsIRegistry* mRegistry;
|
||||
nsRegistryKey mXPCOMKey;
|
||||
nsRegistryKey mClassesKey;
|
||||
|
|
|
@ -0,0 +1,271 @@
|
|||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is XPCOM
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global Static Component Manager Methods
|
||||
// (for when you need to link with xpcom)
|
||||
|
||||
#include "nsIComponentManagerObsolete.h"
|
||||
#include "nsComponentManagerObsolete.h"
|
||||
|
||||
|
||||
nsresult
|
||||
nsComponentManager::Initialize(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::FindFactory(const nsCID &aClass,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->FindFactory(aClass, aFactory);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::GetClassObject(const nsCID &aClass, const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->GetClassObject(aClass, aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::ContractIDToClassID(const char *aContractID,
|
||||
nsCID *aClass)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->ContractIDToClassID(aContractID, aClass);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::CLSIDToContractID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aContractID)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->CLSIDToContractID(*aClass, aClassName, aContractID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->CreateInstance(aClass, aDelegate, aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::CreateInstance(const char *aContractID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->CreateInstanceByContractID(aContractID, aDelegate, aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterFactory(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory *aFactory,
|
||||
PRBool aReplace)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterFactory(aClass, aClassName, aContractID,
|
||||
aFactory, aReplace);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterComponent(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *aLibraryPersistentDescriptor,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterComponent(aClass, aClassName, aContractID,
|
||||
aLibraryPersistentDescriptor, aReplace, aPersist);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterComponentSpec(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFile *aLibrary,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterComponentSpec(aClass, aClassName, aContractID,
|
||||
aLibrary, aReplace, aPersist);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::RegisterComponentLib(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *adllName,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->RegisterComponentLib(aClass, aClassName, aContractID,
|
||||
adllName, aReplace, aPersist);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::UnregisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->UnregisterFactory(aClass, aFactory);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::UnregisterComponent(const nsCID &aClass,
|
||||
const char *aLibrary)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->UnregisterComponent(aClass, aLibrary);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::UnregisterComponentSpec(const nsCID &aClass,
|
||||
nsIFile *aLibrarySpec)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->UnregisterComponentSpec(aClass, aLibrarySpec);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::FreeLibraries(void)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->FreeLibraries();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::AutoRegister(PRInt32 when, nsIFile *directory)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->AutoRegister(when, directory);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::AutoRegisterComponent(PRInt32 when,
|
||||
nsIFile *fullname)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->AutoRegisterComponent(when, fullname);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::AutoUnregisterComponent(PRInt32 when,
|
||||
nsIFile *fullname)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->AutoUnregisterComponent(when, fullname);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::IsRegistered(const nsCID &aClass,
|
||||
PRBool *aRegistered)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->IsRegistered(aClass, aRegistered);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::EnumerateCLSIDs(nsIEnumerator** aEnumerator)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->EnumerateCLSIDs(aEnumerator);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComponentManager::EnumerateContractIDs(nsIEnumerator** aEnumerator)
|
||||
{
|
||||
nsIComponentManagerObsolete* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return cm->EnumerateContractIDs(aEnumerator);
|
||||
}
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is XPCOM
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsComponentManagerObsolete_h___
|
||||
#define nsComponentManagerObsolete_h___
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentManagerObsolete.h"
|
||||
|
||||
class nsIEnumerator;
|
||||
class nsIFactory;
|
||||
class nsIFile;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
//
|
||||
// Functions, classes, interfaces and types in this file are
|
||||
// obsolete. Use at your own risk.
|
||||
// Please see nsIComponentManager.idl for the supported interface
|
||||
// to the component manager.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// God save me from this evilness. Below is a very bad
|
||||
// function. Its out var is really a nsIComponentManagerObsolete
|
||||
// but it has been cast to a nsIComponentManager.
|
||||
// The reason for such uglyness is that this function is require for
|
||||
// backward compatiblity of some plugins. This funciton will
|
||||
// be removed at some point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_GetGlobalComponentManager(nsIComponentManager* *result);
|
||||
|
||||
|
||||
|
||||
|
||||
class NS_COM nsComponentManager {
|
||||
public:
|
||||
static nsresult Initialize(void);
|
||||
|
||||
// Finds a factory for a specific class ID
|
||||
static nsresult FindFactory(const nsCID &aClass,
|
||||
nsIFactory **aFactory);
|
||||
|
||||
// Get the singleton class object that implements the CID aClass
|
||||
static nsresult GetClassObject(const nsCID &aClass, const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Finds a class ID for a specific Program ID
|
||||
static nsresult ContractIDToClassID(const char *aContractID,
|
||||
nsCID *aClass);
|
||||
|
||||
// Finds a Program ID for a specific class ID
|
||||
// caller frees the result with delete[]
|
||||
static nsresult CLSIDToContractID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aContractID);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
static nsresult CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Convenience routine, creates a class instance for a specific ContractID
|
||||
static nsresult CreateInstance(const char *aContractID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Manually registry a factory for a class
|
||||
static nsresult RegisterFactory(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory *aFactory,
|
||||
PRBool aReplace);
|
||||
|
||||
// Manually register a dynamically loaded component.
|
||||
// The libraryPersistentDescriptor is what gets passed to the library
|
||||
// self register function from ComponentManager. The format of this string
|
||||
// is the same as nsIFile::GetPath()
|
||||
//
|
||||
// This function will go away in favour of RegisterComponentSpec. In fact,
|
||||
// it internally turns around and calls RegisterComponentSpec.
|
||||
static nsresult RegisterComponent(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *aLibraryPersistentDescriptor,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Register a component using its FileSpec as its identification
|
||||
// This is the more prevalent use.
|
||||
static nsresult RegisterComponentSpec(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFile *aLibrary,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Register a component using its dllName. This could be a dll name with
|
||||
// no path so that LD_LIBRARY_PATH on unix or PATH on win can load it. Or
|
||||
// this could be a code fragment name on the Mac.
|
||||
static nsresult RegisterComponentLib(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *adllName,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
|
||||
// Manually unregister a factory for a class
|
||||
static nsresult UnregisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory);
|
||||
|
||||
// Manually unregister a dynamically loaded component
|
||||
static nsresult UnregisterComponent(const nsCID &aClass,
|
||||
const char *aLibrary);
|
||||
|
||||
// Manually unregister a dynamically loaded component
|
||||
static nsresult UnregisterComponentSpec(const nsCID &aClass,
|
||||
nsIFile *aLibrarySpec);
|
||||
|
||||
// Unload dynamically loaded factories that are not in use
|
||||
static nsresult FreeLibraries(void);
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// DLL registration support
|
||||
|
||||
// If directory is NULL, then AutoRegister will try registering components
|
||||
// in the default components directory.
|
||||
static nsresult AutoRegister(PRInt32 when, nsIFile* directory);
|
||||
static nsresult AutoRegisterComponent(PRInt32 when, nsIFile *component);
|
||||
static nsresult AutoUnregisterComponent(PRInt32 when, nsIFile *component);
|
||||
|
||||
// Is the given CID currently registered?
|
||||
static nsresult IsRegistered(const nsCID &aClass,
|
||||
PRBool *aRegistered);
|
||||
|
||||
// Get an enumeration of all the CIDs
|
||||
static nsresult EnumerateCLSIDs(nsIEnumerator** aEmumerator);
|
||||
|
||||
// Get an enumeration of all the ContractIDs
|
||||
static nsresult EnumerateContractIDs(nsIEnumerator** aEmumerator);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -28,32 +28,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#endif
|
||||
|
||||
#ifndef OBSOLETE_MODULE_LOADING
|
||||
/*
|
||||
* Prototypes for dynamic library export functions. Your DLL/DSO needs to export
|
||||
* these methods to play in the component world.
|
||||
*
|
||||
* THIS IS OBSOLETE. Look at nsIModule.idl
|
||||
*/
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr);
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char *fullpath);
|
||||
|
||||
typedef nsresult (*nsFactoryProc)(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory **aFactory);
|
||||
typedef PRBool (*nsCanUnloadProc)(nsISupports* aServMgr);
|
||||
typedef nsresult (*nsRegisterProc)(nsISupports* aServMgr, const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(nsISupports* aServMgr, const char *path);
|
||||
#endif /* OBSOLETE_MODULE_LOADING */
|
||||
|
||||
#define NS_COMPONENTMANAGER_CID \
|
||||
{ /* 91775d60-d5dc-11d2-92fb-00e09805570f */ \
|
||||
|
@ -63,163 +37,43 @@ typedef nsresult (*nsUnregisterProc)(nsISupports* aServMgr, const char *path);
|
|||
{0x92, 0xfb, 0x00, 0xe0, 0x98, 0x05, 0x57, 0x0f} \
|
||||
}
|
||||
|
||||
#define NS_COMPONENTMANAGER_CONTRACTID "@mozilla.org/xpcom/componentmanager;1"
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_GetGlobalComponentManager(nsIComponentManager* *result);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global Static Component Manager Methods
|
||||
// (for when you need to link with xpcom)
|
||||
|
||||
class NS_COM nsComponentManager {
|
||||
class NS_COM nsCreateInstanceByCID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
static nsresult Initialize(void);
|
||||
|
||||
// Finds a factory for a specific class ID
|
||||
static nsresult FindFactory(const nsCID &aClass,
|
||||
nsIFactory **aFactory);
|
||||
|
||||
// Get the singleton class object that implements the CID aClass
|
||||
static nsresult GetClassObject(const nsCID &aClass, const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Finds a class ID for a specific Program ID
|
||||
static nsresult ContractIDToClassID(const char *aContractID,
|
||||
nsCID *aClass);
|
||||
|
||||
// Finds a Program ID for a specific class ID
|
||||
// caller frees the result with delete[]
|
||||
static nsresult CLSIDToContractID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aContractID);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
static nsresult CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Convenience routine, creates a class instance for a specific ContractID
|
||||
static nsresult CreateInstance(const char *aContractID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Manually registry a factory for a class
|
||||
static nsresult RegisterFactory(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory *aFactory,
|
||||
PRBool aReplace);
|
||||
|
||||
// Manually register a dynamically loaded component.
|
||||
// The libraryPersistentDescriptor is what gets passed to the library
|
||||
// self register function from ComponentManager. The format of this string
|
||||
// is the same as nsIFile::GetPath()
|
||||
//
|
||||
// This function will go away in favour of RegisterComponentSpec. In fact,
|
||||
// it internally turns around and calls RegisterComponentSpec.
|
||||
static nsresult RegisterComponent(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *aLibraryPersistentDescriptor,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Register a component using its FileSpec as its identification
|
||||
// This is the more prevalent use.
|
||||
static nsresult RegisterComponentSpec(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFile *aLibrary,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Register a component using its dllName. This could be a dll name with
|
||||
// no path so that LD_LIBRARY_PATH on unix or PATH on win can load it. Or
|
||||
// this could be a code fragment name on the Mac.
|
||||
static nsresult RegisterComponentLib(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *adllName,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
|
||||
// Manually unregister a factory for a class
|
||||
static nsresult UnregisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory);
|
||||
|
||||
// Manually unregister a dynamically loaded component
|
||||
static nsresult UnregisterComponent(const nsCID &aClass,
|
||||
const char *aLibrary);
|
||||
|
||||
// Manually unregister a dynamically loaded component
|
||||
static nsresult UnregisterComponentSpec(const nsCID &aClass,
|
||||
nsIFile *aLibrarySpec);
|
||||
|
||||
// Unload dynamically loaded factories that are not in use
|
||||
static nsresult FreeLibraries(void);
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// DLL registration support
|
||||
|
||||
// If directory is NULL, then AutoRegister will try registering components
|
||||
// in the default components directory.
|
||||
static nsresult AutoRegister(PRInt32 when, nsIFile* directory);
|
||||
static nsresult AutoRegisterComponent(PRInt32 when, nsIFile *component);
|
||||
static nsresult AutoUnregisterComponent(PRInt32 when, nsIFile *component);
|
||||
|
||||
// Is the given CID currently registered?
|
||||
static nsresult IsRegistered(const nsCID &aClass,
|
||||
PRBool *aRegistered);
|
||||
|
||||
// Get an enumeration of all the CIDs
|
||||
static nsresult EnumerateCLSIDs(nsIEnumerator** aEmumerator);
|
||||
nsCreateInstanceByCID( const nsCID& aCID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mCID(aCID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
// Get an enumeration of all the ContractIDs
|
||||
static nsresult EnumerateContractIDs(nsIEnumerator** aEmumerator);
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const nsCID& mCID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
|
||||
class NS_COM nsCreateInstanceByCID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsCreateInstanceByCID( const nsCID& aCID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mCID(aCID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const nsCID& mCID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
class NS_COM nsCreateInstanceByContractID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsCreateInstanceByContractID( const char* aContractID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mContractID(aContractID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
public:
|
||||
nsCreateInstanceByContractID( const char* aContractID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mContractID(aContractID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const char* mContractID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const char* mContractID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
class NS_COM nsCreateInstanceFromCategory : public nsCOMPtr_helper
|
||||
{
|
||||
|
@ -234,7 +88,7 @@ public:
|
|||
}
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
virtual ~nsCreateInstanceFromCategory() {};
|
||||
|
||||
|
||||
private:
|
||||
const char *mCategory;
|
||||
const char *mEntry;
|
||||
|
@ -245,30 +99,30 @@ private:
|
|||
inline
|
||||
const nsCreateInstanceByCID
|
||||
do_CreateInstance( const nsCID& aCID, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, 0, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, 0, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceByCID
|
||||
do_CreateInstance( const nsCID& aCID, nsISupports* aOuter, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, aOuter, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, aOuter, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceByContractID
|
||||
do_CreateInstance( const char* aContractID, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, 0, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, 0, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceByContractID
|
||||
do_CreateInstance( const char* aContractID, nsISupports* aOuter, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, aOuter, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, aOuter, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceFromCategory
|
||||
|
@ -293,26 +147,26 @@ nsresult
|
|||
CallCreateInstance( const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
|
||||
return nsComponentManager::CreateInstance(aClass, aDelegate,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
template <class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallCreateInstance( const nsCID &aClass,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
|
||||
return nsComponentManager::CreateInstance(aClass, nsnull,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
template <class DestinationType>
|
||||
inline
|
||||
|
@ -320,28 +174,29 @@ nsresult
|
|||
CallCreateInstance( const char *aContractID,
|
||||
nsISupports *aDelegate,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aContractID, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
return nsComponentManager::CreateInstance(aContractID, aDelegate,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
return nsComponentManager::CreateInstance(aContractID,
|
||||
aDelegate,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
template <class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallCreateInstance( const char *aContractID,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aContractID, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
|
||||
return nsComponentManager::CreateInstance(aContractID, nsnull,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
/* keys for registry use */
|
||||
extern const char xpcomKeyName[];
|
||||
|
@ -352,3 +207,5 @@ extern const char nativeComponentType[];
|
|||
extern const char staticComponentType[];
|
||||
|
||||
#endif /* nsComponentManagerUtils_h__ */
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsIComponentManagerObsolete.h"
|
||||
nsGenericFactory::nsGenericFactory(nsModuleComponentInfo *info)
|
||||
: mInfo(info)
|
||||
{
|
||||
|
@ -358,11 +358,15 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
|||
for (PRUint32 i = 0; i < mComponentCount; i++) {
|
||||
// Register the component only if it has a constructor
|
||||
if (cp->mConstructor) {
|
||||
rv = aCompMgr->RegisterComponentWithType(cp->mCID,
|
||||
cp->mDescription,
|
||||
cp->mContractID, aPath,
|
||||
registryLocation, PR_TRUE,
|
||||
PR_TRUE, componentType);
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegisterComponentWithType(cp->mCID,
|
||||
cp->mDescription,
|
||||
cp->mContractID, aPath,
|
||||
registryLocation, PR_TRUE,
|
||||
PR_TRUE, componentType);
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef DEBUG
|
||||
printf("nsGenericModule %s: unable to register %s component => %x\n",
|
||||
|
@ -405,8 +409,15 @@ nsGenericModule::UnregisterSelf(nsIComponentManager* aCompMgr,
|
|||
{
|
||||
cp->mUnregisterSelfProc(aCompMgr, aPath, registryLocation, cp);
|
||||
}
|
||||
|
||||
// Unregister the component
|
||||
nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath);
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->UnregisterComponentSpec(cp->mCID, aPath);
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef DEBUG
|
||||
printf("nsGenericModule %s: unable to unregister %s component => %x\n",
|
||||
|
|
|
@ -1,75 +1,78 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
` * of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* The nsIComponentManager interface.
|
||||
* @status FROZEN
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFactory.idl"
|
||||
|
||||
interface nsIFile;
|
||||
interface nsIEnumerator;
|
||||
interface nsIFactory;
|
||||
|
||||
[scriptable, uuid(8458a740-d5dc-11d2-92fb-00e09805570f)]
|
||||
[scriptable, uuid(a88e5a60-205a-4bb1-94e1-2628daf51eae)]
|
||||
interface nsIComponentManager : nsISupports
|
||||
{
|
||||
{
|
||||
/**
|
||||
* findFactory
|
||||
* getClassObject
|
||||
*
|
||||
* Returns the factory object that can be used to create instances of
|
||||
* CID aClass
|
||||
*
|
||||
* @param aClass The classid of the factory that is being requested
|
||||
*/
|
||||
nsIFactory findFactory(in nsCIDRef aClass);
|
||||
void getClassObject(in nsCIDRef aClass,
|
||||
in nsIIDRef aIID,
|
||||
[iid_is(aIID),retval] out nsQIResult result);
|
||||
|
||||
/**
|
||||
* getClassObject
|
||||
* getClassObjectByContractID
|
||||
*
|
||||
* @param aClass : CID of the class whose class object is requested
|
||||
* @param aIID : IID of an interface that the class object is known to
|
||||
* to implement. nsISupports and nsIFactory are known to
|
||||
* be implemented by the class object.
|
||||
* Returns the factory object that can be used to create instances of
|
||||
* CID aClass
|
||||
*
|
||||
* @param aClass The classid of the factory that is being requested
|
||||
*/
|
||||
[noscript] voidPtr getClassObject(in nsCIDRef aClass, in nsIIDRef aIID);
|
||||
void getClassObjectByContractID(in string aContractID,
|
||||
in nsIIDRef aIID,
|
||||
[iid_is(aIID),retval] out nsQIResult result);
|
||||
|
||||
/**
|
||||
* contractIDToClassID
|
||||
*
|
||||
* Get the ClassID for a given ContractID. Many ClassIDs may implement a
|
||||
* ContractID. In such a situation, this returns the preferred ClassID, which
|
||||
* happens to be the last registered ClassID.
|
||||
*
|
||||
* @param aContractID : Contractid for which ClassID is requested
|
||||
* @return aClass : ClassID return
|
||||
*/
|
||||
[notxpcom] nsresult contractIDToClassID(in string aContractID, out nsCID aClass);
|
||||
|
||||
/**
|
||||
* classIDToContractid
|
||||
*
|
||||
* Get the ContractID for a given ClassID. A ClassIDs may implement multiple
|
||||
* ContractIDs. This function return the last registered ContractID.
|
||||
*
|
||||
* @param aClass : ClassID for which ContractID is requested.
|
||||
* @return aClassName : returns class name asssociated with aClass
|
||||
* @return : ContractID last registered for aClass
|
||||
*/
|
||||
string CLSIDToContractID(in nsCIDRef aClass, out string aClassName);
|
||||
|
||||
/**
|
||||
/**
|
||||
* createInstance
|
||||
*
|
||||
* Create an instance of the CID aClass and return the interface aIID.
|
||||
|
@ -78,255 +81,31 @@ interface nsIComponentManager : nsISupports
|
|||
* @param aDelegate : Used for aggregation
|
||||
* @param aIID : IID of interface requested
|
||||
*/
|
||||
[noscript] voidPtr createInstance(in nsCIDRef aClass,
|
||||
in nsISupports aDelegate,
|
||||
in nsIIDRef aIID);
|
||||
void createInstance(in nsCIDRef aClass,
|
||||
in nsISupports aDelegate,
|
||||
in nsIIDRef aIID,
|
||||
[iid_is(aIID),retval] out nsQIResult result);
|
||||
|
||||
/**
|
||||
* createInstanceByContractID
|
||||
*
|
||||
* Create an instance of the CID that implements aContractID and return the
|
||||
* interface aIID. This is a convenience function that effectively does
|
||||
* ContractIDToClassID() followed by CreateInstance().
|
||||
* interface aIID.
|
||||
*
|
||||
* @param aContractID : aContractID of object instance requested
|
||||
* @param aDelegate : Used for aggregation
|
||||
* @param aIID : IID of interface requested
|
||||
*/
|
||||
[noscript] voidPtr createInstanceByContractID(in string aContractID,
|
||||
in nsISupports aDelegate,
|
||||
in nsIIDRef IID);
|
||||
/**
|
||||
* registryLocationForSpec
|
||||
*
|
||||
* Given a file specification, return the registry representation of
|
||||
* the filename. Files that are found relative to the components
|
||||
* directory will have a registry representation
|
||||
* "rel:<relative-native-path>" while filenames that are not, will have
|
||||
* "abs:<full-native-path>".
|
||||
*/
|
||||
string registryLocationForSpec(in nsIFile aSpec);
|
||||
|
||||
/**
|
||||
* specForRegistyLocation
|
||||
*
|
||||
* Create a file specification for the registry representation (rel:/abs:)
|
||||
* got via registryLocationForSpec.
|
||||
*/
|
||||
nsIFile specForRegistryLocation(in string aLocation);
|
||||
|
||||
/**
|
||||
* registerFactory
|
||||
*
|
||||
* Register a factory and ContractID associated with CID aClass
|
||||
*
|
||||
* @param aClass : CID of object
|
||||
* @param aClassName : Class Name of CID
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aFactory : Factory that will be registered for CID aClass
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* registration for the CID aClass.
|
||||
*/
|
||||
void registerFactory(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in nsIFactory aFactory,
|
||||
in boolean aReplace);
|
||||
|
||||
/**
|
||||
* registerComponent
|
||||
*
|
||||
* Register a native dll module via its registry representation as returned
|
||||
* by registryLocationForSpec() as the container of CID implemenation
|
||||
* aClass and associate aContractID and aClassName to the CID aClass. Native
|
||||
* dll component type is assumed.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aLocation : Location of module (dll). Format of this is the
|
||||
* registry representation as returned by
|
||||
* registryLocationForSpec()
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* module registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
*/
|
||||
void registerComponent(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in string aLocation,
|
||||
in boolean aReplace, in boolean aPersist);
|
||||
|
||||
/**
|
||||
* registerComponentWithType
|
||||
*
|
||||
* Register a module's location via its registry representation
|
||||
* as returned by registryLocationForSpec() as the container of CID implemenation
|
||||
* aClass of type aType and associate aContractID and aClassName to the CID aClass.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aSpec : Filename spec for module's location.
|
||||
* @param aLocation : Location of module of type aType. Format of this string
|
||||
* is the registry representation as returned by
|
||||
* registryLocationForSpec()
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* loader registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
* @param aType : Component Type of CID aClass.
|
||||
*/
|
||||
void registerComponentWithType(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in nsIFile aSpec,
|
||||
in string aLocation, in boolean aReplace,
|
||||
in boolean aPersist, in string aType);
|
||||
|
||||
/**
|
||||
* registerComponentSpec
|
||||
*
|
||||
* Register a native dll module via its file specification as the container
|
||||
* of CID implemenation aClass and associate aContractID and aClassName to the
|
||||
* CID aClass. Native dll component type is assumed.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aLibrary : File specification Location of module (dll).
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* module registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
*/
|
||||
void registerComponentSpec(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in nsIFile aLibrary,
|
||||
in boolean aReplace, in boolean aPersist);
|
||||
|
||||
/**
|
||||
* registerComponentLib
|
||||
*
|
||||
* Register a native dll module via its dll name (not full path) as the
|
||||
* container of CID implemenation aClass and associate aContractID and aClassName
|
||||
* to the CID aClass. Native dll component type is assumed and the system
|
||||
* services will be used to load this dll.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aDllNameLocation : Dll name of module.
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* module registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
*/
|
||||
void registerComponentLib(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in string aDllName,
|
||||
in boolean aReplace, in boolean aPersist);
|
||||
|
||||
/**
|
||||
* unregisterFactory
|
||||
*
|
||||
* Unregister a factory associated with CID aClass.
|
||||
*
|
||||
* @param aClass : ClassID being unregistered
|
||||
* @param aFactory : Factory previously registered to create instances of
|
||||
* ClassID aClass.
|
||||
*/
|
||||
void unregisterFactory(in nsCIDRef aClass, in nsIFactory aFactory);
|
||||
|
||||
/**
|
||||
* unregisterComponent
|
||||
*
|
||||
* Disassociate module aLocation represented as registry location as returned
|
||||
* by registryLocationForSpec() as containing ClassID aClass.
|
||||
*
|
||||
* @param aClass : ClassID being unregistered
|
||||
* @param aLocation : Location of module. Format of this is the registry
|
||||
* representation as returned by registryLocationForSpec().
|
||||
* Components of any type will be unregistered.
|
||||
*/
|
||||
void unregisterComponent(in nsCIDRef aClass, in string aLocation);
|
||||
|
||||
/**
|
||||
* unregisterComponentSpec
|
||||
*
|
||||
* Disassociate module references by file specification aLibrarySpec as
|
||||
* containing ClassID aClass.
|
||||
*/
|
||||
void unregisterComponentSpec(in nsCIDRef aClass, in nsIFile aLibrarySpec);
|
||||
|
||||
/**
|
||||
* freeLibraries
|
||||
*
|
||||
* Enumerates all loaded modules and unloads unused modules.
|
||||
*/
|
||||
void freeLibraries();
|
||||
|
||||
/**
|
||||
* ID values for 'when'
|
||||
*/
|
||||
const long NS_Startup = 0;
|
||||
const long NS_Script = 1;
|
||||
const long NS_Timer = 2;
|
||||
const long NS_Shutdown = 3;
|
||||
|
||||
/**
|
||||
* autoRegister
|
||||
*
|
||||
* Enumerates directory looking for modules of all types and registers
|
||||
* modules who have changed (modtime or size) since the last time
|
||||
* autoRegister() was invoked.
|
||||
*
|
||||
* @param when : ID values of when the call is being made.
|
||||
* @param directory : Directory the will be enumerated.
|
||||
*/
|
||||
void autoRegister(in long when, in nsIFile directory);
|
||||
|
||||
/**
|
||||
* autoRegisterComponent
|
||||
*
|
||||
* Loads module using appropriate loader and gives it an opportunity to
|
||||
* register its CIDs if module's modtime or size changed since the last
|
||||
* time this was called.
|
||||
*
|
||||
* @param when : ID values of when the call is being made.
|
||||
* @param aFileLocation : File specification of module.
|
||||
*/
|
||||
void autoRegisterComponent(in long when, in nsIFile aFileLocation);
|
||||
|
||||
/**
|
||||
* autoUnregisterComponent
|
||||
*
|
||||
* Loads module using approriate loader and gives it an opportunity to
|
||||
* unregister its CIDs
|
||||
*/
|
||||
void autoUnregisterComponent(in long when, in nsIFile aFileLocation);
|
||||
|
||||
/**
|
||||
* isRegistered
|
||||
*
|
||||
* Returns true if a factory or module is registered for CID aClass.
|
||||
*
|
||||
* @param aClass : ClassID queried for registeration
|
||||
* @return : true if a factory or module is registered for CID aClass.
|
||||
* false otherwise.
|
||||
*/
|
||||
boolean isRegistered(in nsCIDRef aClass);
|
||||
|
||||
/**
|
||||
* enumerateCLSIDs
|
||||
*
|
||||
* Enumerate the list of all registered ClassIDs.
|
||||
*
|
||||
* @return : enumerator for ClassIDs.
|
||||
*/
|
||||
nsIEnumerator enumerateCLSIDs();
|
||||
|
||||
/**
|
||||
* enumerateContractIDs
|
||||
*
|
||||
* Enumerate the list of all registered ContractIDs.
|
||||
*
|
||||
* @return : enumerator for ContractIDs.
|
||||
*/
|
||||
nsIEnumerator enumerateContractIDs();
|
||||
void createInstanceByContractID(in string aContractID,
|
||||
in nsISupports aDelegate,
|
||||
in nsIIDRef aIID,
|
||||
[iid_is(aIID),retval] out nsQIResult result);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
/* include after the class def'n, because it needs to see it. */
|
||||
#include "nsComponentManagerUtils.h"
|
||||
%} C++
|
||||
|
||||
%{ C++
|
||||
#ifndef MOZILLA_STRICT_API
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsComponentManagerObsolete.h"
|
||||
#endif
|
||||
%} C++
|
||||
|
|
|
@ -0,0 +1,332 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFactory.idl"
|
||||
|
||||
interface nsIFile;
|
||||
interface nsIEnumerator;
|
||||
|
||||
[scriptable, uuid(8458a740-d5dc-11d2-92fb-00e09805570f)]
|
||||
interface nsIComponentManagerObsolete : nsISupports
|
||||
{
|
||||
/**
|
||||
* findFactory
|
||||
*
|
||||
* Returns the factory object that can be used to create instances of
|
||||
* CID aClass
|
||||
*
|
||||
* @param aClass The classid of the factory that is being requested
|
||||
*/
|
||||
nsIFactory findFactory(in nsCIDRef aClass);
|
||||
|
||||
/**
|
||||
* getClassObject
|
||||
*
|
||||
* @param aClass : CID of the class whose class object is requested
|
||||
* @param aIID : IID of an interface that the class object is known to
|
||||
* to implement. nsISupports and nsIFactory are known to
|
||||
* be implemented by the class object.
|
||||
*/
|
||||
[noscript] voidPtr getClassObject(in nsCIDRef aClass, in nsIIDRef aIID);
|
||||
|
||||
/**
|
||||
* contractIDToClassID
|
||||
*
|
||||
* Get the ClassID for a given ContractID. Many ClassIDs may implement a
|
||||
* ContractID. In such a situation, this returns the preferred ClassID, which
|
||||
* happens to be the last registered ClassID.
|
||||
*
|
||||
* @param aContractID : Contractid for which ClassID is requested
|
||||
* @return aClass : ClassID return
|
||||
*/
|
||||
[notxpcom] nsresult contractIDToClassID(in string aContractID, out nsCID aClass);
|
||||
|
||||
/**
|
||||
* classIDToContractid
|
||||
*
|
||||
* Get the ContractID for a given ClassID. A ClassIDs may implement multiple
|
||||
* ContractIDs. This function return the last registered ContractID.
|
||||
*
|
||||
* @param aClass : ClassID for which ContractID is requested.
|
||||
* @return aClassName : returns class name asssociated with aClass
|
||||
* @return : ContractID last registered for aClass
|
||||
*/
|
||||
string CLSIDToContractID(in nsCIDRef aClass, out string aClassName);
|
||||
|
||||
/**
|
||||
* createInstance
|
||||
*
|
||||
* Create an instance of the CID aClass and return the interface aIID.
|
||||
*
|
||||
* @param aClass : ClassID of object instance requested
|
||||
* @param aDelegate : Used for aggregation
|
||||
* @param aIID : IID of interface requested
|
||||
*/
|
||||
[noscript] voidPtr createInstance(in nsCIDRef aClass,
|
||||
in nsISupports aDelegate,
|
||||
in nsIIDRef aIID);
|
||||
|
||||
/**
|
||||
* createInstanceByContractID
|
||||
*
|
||||
* Create an instance of the CID that implements aContractID and return the
|
||||
* interface aIID. This is a convenience function that effectively does
|
||||
* ContractIDToClassID() followed by CreateInstance().
|
||||
*
|
||||
* @param aContractID : aContractID of object instance requested
|
||||
* @param aDelegate : Used for aggregation
|
||||
* @param aIID : IID of interface requested
|
||||
*/
|
||||
[noscript] voidPtr createInstanceByContractID(in string aContractID,
|
||||
in nsISupports aDelegate,
|
||||
in nsIIDRef IID);
|
||||
/**
|
||||
* registryLocationForSpec
|
||||
*
|
||||
* Given a file specification, return the registry representation of
|
||||
* the filename. Files that are found relative to the components
|
||||
* directory will have a registry representation
|
||||
* "rel:<relative-native-path>" while filenames that are not, will have
|
||||
* "abs:<full-native-path>".
|
||||
*/
|
||||
string registryLocationForSpec(in nsIFile aSpec);
|
||||
|
||||
/**
|
||||
* specForRegistyLocation
|
||||
*
|
||||
* Create a file specification for the registry representation (rel:/abs:)
|
||||
* got via registryLocationForSpec.
|
||||
*/
|
||||
nsIFile specForRegistryLocation(in string aLocation);
|
||||
|
||||
/**
|
||||
* registerFactory
|
||||
*
|
||||
* Register a factory and ContractID associated with CID aClass
|
||||
*
|
||||
* @param aClass : CID of object
|
||||
* @param aClassName : Class Name of CID
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aFactory : Factory that will be registered for CID aClass
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* registration for the CID aClass.
|
||||
*/
|
||||
void registerFactory(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in nsIFactory aFactory,
|
||||
in boolean aReplace);
|
||||
|
||||
/**
|
||||
* registerComponent
|
||||
*
|
||||
* Register a native dll module via its registry representation as returned
|
||||
* by registryLocationForSpec() as the container of CID implemenation
|
||||
* aClass and associate aContractID and aClassName to the CID aClass. Native
|
||||
* dll component type is assumed.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aLocation : Location of module (dll). Format of this is the
|
||||
* registry representation as returned by
|
||||
* registryLocationForSpec()
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* module registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
*/
|
||||
void registerComponent(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in string aLocation,
|
||||
in boolean aReplace, in boolean aPersist);
|
||||
|
||||
/**
|
||||
* registerComponentWithType
|
||||
*
|
||||
* Register a module's location via its registry representation
|
||||
* as returned by registryLocationForSpec() as the container of CID implemenation
|
||||
* aClass of type aType and associate aContractID and aClassName to the CID aClass.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aSpec : Filename spec for module's location.
|
||||
* @param aLocation : Location of module of type aType. Format of this string
|
||||
* is the registry representation as returned by
|
||||
* registryLocationForSpec()
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* loader registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
* @param aType : Component Type of CID aClass.
|
||||
*/
|
||||
void registerComponentWithType(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in nsIFile aSpec,
|
||||
in string aLocation, in boolean aReplace,
|
||||
in boolean aPersist, in string aType);
|
||||
|
||||
/**
|
||||
* registerComponentSpec
|
||||
*
|
||||
* Register a native dll module via its file specification as the container
|
||||
* of CID implemenation aClass and associate aContractID and aClassName to the
|
||||
* CID aClass. Native dll component type is assumed.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aLibrary : File specification Location of module (dll).
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* module registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
*/
|
||||
void registerComponentSpec(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in nsIFile aLibrary,
|
||||
in boolean aReplace, in boolean aPersist);
|
||||
|
||||
/**
|
||||
* registerComponentLib
|
||||
*
|
||||
* Register a native dll module via its dll name (not full path) as the
|
||||
* container of CID implemenation aClass and associate aContractID and aClassName
|
||||
* to the CID aClass. Native dll component type is assumed and the system
|
||||
* services will be used to load this dll.
|
||||
*
|
||||
* @param aClass : CID implemenation contained in module
|
||||
* @param aClassName : Class name associated with CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass
|
||||
* @param aDllNameLocation : Dll name of module.
|
||||
* @param aReplace : Boolean that indicates whether to replace a previous
|
||||
* module registration for aClass.
|
||||
* @param aPersist : Remember this registration across sessions.
|
||||
*/
|
||||
void registerComponentLib(in nsCIDRef aClass, in string aClassName,
|
||||
in string aContractID, in string aDllName,
|
||||
in boolean aReplace, in boolean aPersist);
|
||||
|
||||
/**
|
||||
* unregisterFactory
|
||||
*
|
||||
* Unregister a factory associated with CID aClass.
|
||||
*
|
||||
* @param aClass : ClassID being unregistered
|
||||
* @param aFactory : Factory previously registered to create instances of
|
||||
* ClassID aClass.
|
||||
*/
|
||||
void unregisterFactory(in nsCIDRef aClass, in nsIFactory aFactory);
|
||||
|
||||
/**
|
||||
* unregisterComponent
|
||||
*
|
||||
* Disassociate module aLocation represented as registry location as returned
|
||||
* by registryLocationForSpec() as containing ClassID aClass.
|
||||
*
|
||||
* @param aClass : ClassID being unregistered
|
||||
* @param aLocation : Location of module. Format of this is the registry
|
||||
* representation as returned by registryLocationForSpec().
|
||||
* Components of any type will be unregistered.
|
||||
*/
|
||||
void unregisterComponent(in nsCIDRef aClass, in string aLocation);
|
||||
|
||||
/**
|
||||
* unregisterComponentSpec
|
||||
*
|
||||
* Disassociate module references by file specification aLibrarySpec as
|
||||
* containing ClassID aClass.
|
||||
*/
|
||||
void unregisterComponentSpec(in nsCIDRef aClass, in nsIFile aLibrarySpec);
|
||||
|
||||
/**
|
||||
* freeLibraries
|
||||
*
|
||||
* Enumerates all loaded modules and unloads unused modules.
|
||||
*/
|
||||
void freeLibraries();
|
||||
|
||||
/**
|
||||
* ID values for 'when'
|
||||
*/
|
||||
const long NS_Startup = 0;
|
||||
const long NS_Script = 1;
|
||||
const long NS_Timer = 2;
|
||||
const long NS_Shutdown = 3;
|
||||
|
||||
/**
|
||||
* autoRegister
|
||||
*
|
||||
* Enumerates directory looking for modules of all types and registers
|
||||
* modules who have changed (modtime or size) since the last time
|
||||
* autoRegister() was invoked.
|
||||
*
|
||||
* @param when : ID values of when the call is being made.
|
||||
* @param directory : Directory the will be enumerated.
|
||||
*/
|
||||
void autoRegister(in long when, in nsIFile directory);
|
||||
|
||||
/**
|
||||
* autoRegisterComponent
|
||||
*
|
||||
* Loads module using appropriate loader and gives it an opportunity to
|
||||
* register its CIDs if module's modtime or size changed since the last
|
||||
* time this was called.
|
||||
*
|
||||
* @param when : ID values of when the call is being made.
|
||||
* @param aFileLocation : File specification of module.
|
||||
*/
|
||||
void autoRegisterComponent(in long when, in nsIFile aFileLocation);
|
||||
|
||||
/**
|
||||
* autoUnregisterComponent
|
||||
*
|
||||
* Loads module using approriate loader and gives it an opportunity to
|
||||
* unregister its CIDs
|
||||
*/
|
||||
void autoUnregisterComponent(in long when, in nsIFile aFileLocation);
|
||||
|
||||
/**
|
||||
* isRegistered
|
||||
*
|
||||
* Returns true if a factory or module is registered for CID aClass.
|
||||
*
|
||||
* @param aClass : ClassID queried for registeration
|
||||
* @return : true if a factory or module is registered for CID aClass.
|
||||
* false otherwise.
|
||||
*/
|
||||
boolean isRegistered(in nsCIDRef aClass);
|
||||
|
||||
/**
|
||||
* enumerateCLSIDs
|
||||
*
|
||||
* Enumerate the list of all registered ClassIDs.
|
||||
*
|
||||
* @return : enumerator for ClassIDs.
|
||||
*/
|
||||
nsIEnumerator enumerateCLSIDs();
|
||||
|
||||
/**
|
||||
* enumerateContractIDs
|
||||
*
|
||||
* Enumerate the list of all registered ContractIDs.
|
||||
*
|
||||
* @return : enumerator for ContractIDs.
|
||||
*/
|
||||
nsIEnumerator enumerateContractIDs();
|
||||
};
|
||||
|
||||
%{ C++
|
||||
/* include after the class def'n, because it needs to see it. */
|
||||
#include "nsComponentManagerUtils.h"
|
||||
%} C++
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is XPCOM
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIComponentManagerUtils_h__
|
||||
#define nsIComponentManagerUtils_h__
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -44,6 +44,10 @@
|
|||
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#ifndef OBSOLETE_MODULE_LOADING
|
||||
#include "nsObsoleteModuleLoading.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC) // sdagley dougt fix
|
||||
#include <Files.h>
|
||||
#include <Errors.h>
|
||||
|
@ -372,7 +376,7 @@ nsFreeLibrary(nsDll *dll, nsIServiceManager *serviceMgr, PRInt32 when)
|
|||
|
||||
// When shutting down, whether we can unload the dll or not,
|
||||
// we will shutdown the dll to release any memory it has got
|
||||
if (when == nsIComponentManager::NS_Shutdown)
|
||||
if (when == nsIComponentManagerObsolete::NS_Shutdown)
|
||||
{
|
||||
dll->Shutdown();
|
||||
}
|
||||
|
@ -426,7 +430,7 @@ nsFreeLibraryEnum(nsHashKey *aKey, void *aData, void* closure)
|
|||
struct freeLibrariesClosure *callData = (struct freeLibrariesClosure *) closure;
|
||||
nsFreeLibrary(dll,
|
||||
(callData ? callData->serviceMgr : NULL),
|
||||
(callData ? callData->when : nsIComponentManager::NS_Timer));
|
||||
(callData ? callData->when : nsIComponentManagerObsolete::NS_Timer));
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -634,7 +638,13 @@ nsNativeComponentLoader::SelfUnregisterDll(nsDll *dll)
|
|||
if (NS_FAILED(res)) return res;
|
||||
// Get registry location for spec
|
||||
nsXPIDLCString registryName;
|
||||
res = mCompMgr->RegistryLocationForSpec(fs, getter_Copies(registryName));
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &res);
|
||||
if (obsoleteManager)
|
||||
res = obsoleteManager->RegistryLocationForSpec(fs, getter_Copies(registryName));
|
||||
|
||||
if (NS_FAILED(res)) return res;
|
||||
mobj->UnregisterSelf(mCompMgr, fs, registryName);
|
||||
}
|
||||
|
@ -662,8 +672,12 @@ nsNativeComponentLoader::AutoUnregisterComponent(PRInt32 when,
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString persistentDescriptor;
|
||||
rv = mCompMgr->RegistryLocationForSpec(component,
|
||||
getter_Copies(persistentDescriptor));
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegistryLocationForSpec(component,
|
||||
getter_Copies(persistentDescriptor));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Notify observers, if any, of autoregistration work
|
||||
|
@ -784,8 +798,12 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when,
|
|||
return NS_OK;
|
||||
|
||||
nsXPIDLCString persistentDescriptor;
|
||||
rv = mCompMgr->RegistryLocationForSpec(component,
|
||||
getter_Copies(persistentDescriptor));
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegistryLocationForSpec(component,
|
||||
getter_Copies(persistentDescriptor));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -1132,8 +1150,12 @@ nsNativeComponentLoader::CreateDll(nsIFile *aSpec, const char *aLocation,
|
|||
dll = new nsDll(aLocation+4, 1 /* dumb magic flag */);
|
||||
if (!dll) return NS_ERROR_OUT_OF_MEMORY;
|
||||
} else {
|
||||
rv = mCompMgr->SpecForRegistryLocation(aLocation,
|
||||
getter_AddRefs(spec));
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(mCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->SpecForRegistryLocation(aLocation,
|
||||
getter_AddRefs(spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
#ifndef OBSOLETE_MODULE_LOADING
|
||||
/*
|
||||
* Prototypes for dynamic library export functions. Your DLL/DSO needs to export
|
||||
* these methods to play in the component world.
|
||||
*
|
||||
* THIS IS OBSOLETE. Look at nsIModule.idl
|
||||
*/
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr);
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char *fullpath);
|
||||
|
||||
typedef nsresult (*nsFactoryProc)(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory **aFactory);
|
||||
typedef PRBool (*nsCanUnloadProc)(nsISupports* aServMgr);
|
||||
typedef nsresult (*nsRegisterProc)(nsISupports* aServMgr, const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(nsISupports* aServMgr, const char *path);
|
||||
#endif /* OBSOLETE_MODULE_LOADING */
|
|
@ -1,3 +1,40 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is XPCOM
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerObsolete.h"
|
||||
#include "nsComponentManager.h"
|
||||
|
|
|
@ -418,8 +418,8 @@ nsresult nsDll::GetDllSpec(nsIFile **fsobj)
|
|||
|
||||
nsresult nsDll::GetModule(nsISupports *servMgr, nsIModule **cobj)
|
||||
{
|
||||
nsIComponentManager *compMgr;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&compMgr);
|
||||
nsCOMPtr<nsIComponentManager> compMgr;
|
||||
nsresult rv = NS_GetComponentManager(getter_AddRefs(compMgr));
|
||||
NS_ASSERTION(compMgr, "Global Component Manager is null" );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -28,32 +28,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#endif
|
||||
|
||||
#ifndef OBSOLETE_MODULE_LOADING
|
||||
/*
|
||||
* Prototypes for dynamic library export functions. Your DLL/DSO needs to export
|
||||
* these methods to play in the component world.
|
||||
*
|
||||
* THIS IS OBSOLETE. Look at nsIModule.idl
|
||||
*/
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr);
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char *fullpath);
|
||||
|
||||
typedef nsresult (*nsFactoryProc)(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory **aFactory);
|
||||
typedef PRBool (*nsCanUnloadProc)(nsISupports* aServMgr);
|
||||
typedef nsresult (*nsRegisterProc)(nsISupports* aServMgr, const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(nsISupports* aServMgr, const char *path);
|
||||
#endif /* OBSOLETE_MODULE_LOADING */
|
||||
|
||||
#define NS_COMPONENTMANAGER_CID \
|
||||
{ /* 91775d60-d5dc-11d2-92fb-00e09805570f */ \
|
||||
|
@ -63,163 +37,43 @@ typedef nsresult (*nsUnregisterProc)(nsISupports* aServMgr, const char *path);
|
|||
{0x92, 0xfb, 0x00, 0xe0, 0x98, 0x05, 0x57, 0x0f} \
|
||||
}
|
||||
|
||||
#define NS_COMPONENTMANAGER_CONTRACTID "@mozilla.org/xpcom/componentmanager;1"
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_GetGlobalComponentManager(nsIComponentManager* *result);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global Static Component Manager Methods
|
||||
// (for when you need to link with xpcom)
|
||||
|
||||
class NS_COM nsComponentManager {
|
||||
class NS_COM nsCreateInstanceByCID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
static nsresult Initialize(void);
|
||||
|
||||
// Finds a factory for a specific class ID
|
||||
static nsresult FindFactory(const nsCID &aClass,
|
||||
nsIFactory **aFactory);
|
||||
|
||||
// Get the singleton class object that implements the CID aClass
|
||||
static nsresult GetClassObject(const nsCID &aClass, const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Finds a class ID for a specific Program ID
|
||||
static nsresult ContractIDToClassID(const char *aContractID,
|
||||
nsCID *aClass);
|
||||
|
||||
// Finds a Program ID for a specific class ID
|
||||
// caller frees the result with delete[]
|
||||
static nsresult CLSIDToContractID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aContractID);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
static nsresult CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Convenience routine, creates a class instance for a specific ContractID
|
||||
static nsresult CreateInstance(const char *aContractID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Manually registry a factory for a class
|
||||
static nsresult RegisterFactory(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory *aFactory,
|
||||
PRBool aReplace);
|
||||
|
||||
// Manually register a dynamically loaded component.
|
||||
// The libraryPersistentDescriptor is what gets passed to the library
|
||||
// self register function from ComponentManager. The format of this string
|
||||
// is the same as nsIFile::GetPath()
|
||||
//
|
||||
// This function will go away in favour of RegisterComponentSpec. In fact,
|
||||
// it internally turns around and calls RegisterComponentSpec.
|
||||
static nsresult RegisterComponent(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *aLibraryPersistentDescriptor,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Register a component using its FileSpec as its identification
|
||||
// This is the more prevalent use.
|
||||
static nsresult RegisterComponentSpec(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFile *aLibrary,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
// Register a component using its dllName. This could be a dll name with
|
||||
// no path so that LD_LIBRARY_PATH on unix or PATH on win can load it. Or
|
||||
// this could be a code fragment name on the Mac.
|
||||
static nsresult RegisterComponentLib(const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
const char *adllName,
|
||||
PRBool aReplace,
|
||||
PRBool aPersist);
|
||||
|
||||
|
||||
// Manually unregister a factory for a class
|
||||
static nsresult UnregisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory);
|
||||
|
||||
// Manually unregister a dynamically loaded component
|
||||
static nsresult UnregisterComponent(const nsCID &aClass,
|
||||
const char *aLibrary);
|
||||
|
||||
// Manually unregister a dynamically loaded component
|
||||
static nsresult UnregisterComponentSpec(const nsCID &aClass,
|
||||
nsIFile *aLibrarySpec);
|
||||
|
||||
// Unload dynamically loaded factories that are not in use
|
||||
static nsresult FreeLibraries(void);
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// DLL registration support
|
||||
|
||||
// If directory is NULL, then AutoRegister will try registering components
|
||||
// in the default components directory.
|
||||
static nsresult AutoRegister(PRInt32 when, nsIFile* directory);
|
||||
static nsresult AutoRegisterComponent(PRInt32 when, nsIFile *component);
|
||||
static nsresult AutoUnregisterComponent(PRInt32 when, nsIFile *component);
|
||||
|
||||
// Is the given CID currently registered?
|
||||
static nsresult IsRegistered(const nsCID &aClass,
|
||||
PRBool *aRegistered);
|
||||
|
||||
// Get an enumeration of all the CIDs
|
||||
static nsresult EnumerateCLSIDs(nsIEnumerator** aEmumerator);
|
||||
nsCreateInstanceByCID( const nsCID& aCID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mCID(aCID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
// Get an enumeration of all the ContractIDs
|
||||
static nsresult EnumerateContractIDs(nsIEnumerator** aEmumerator);
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const nsCID& mCID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
|
||||
class NS_COM nsCreateInstanceByCID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsCreateInstanceByCID( const nsCID& aCID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mCID(aCID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const nsCID& mCID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
class NS_COM nsCreateInstanceByContractID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsCreateInstanceByContractID( const char* aContractID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mContractID(aContractID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
public:
|
||||
nsCreateInstanceByContractID( const char* aContractID, nsISupports* aOuter, nsresult* aErrorPtr )
|
||||
: mContractID(aContractID),
|
||||
mOuter(aOuter),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do here
|
||||
}
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const char* mContractID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const char* mContractID;
|
||||
nsISupports* mOuter;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
class NS_COM nsCreateInstanceFromCategory : public nsCOMPtr_helper
|
||||
{
|
||||
|
@ -234,7 +88,7 @@ public:
|
|||
}
|
||||
virtual nsresult operator()( const nsIID&, void** ) const;
|
||||
virtual ~nsCreateInstanceFromCategory() {};
|
||||
|
||||
|
||||
private:
|
||||
const char *mCategory;
|
||||
const char *mEntry;
|
||||
|
@ -245,30 +99,30 @@ private:
|
|||
inline
|
||||
const nsCreateInstanceByCID
|
||||
do_CreateInstance( const nsCID& aCID, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, 0, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, 0, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceByCID
|
||||
do_CreateInstance( const nsCID& aCID, nsISupports* aOuter, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, aOuter, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByCID(aCID, aOuter, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceByContractID
|
||||
do_CreateInstance( const char* aContractID, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, 0, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, 0, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceByContractID
|
||||
do_CreateInstance( const char* aContractID, nsISupports* aOuter, nsresult* error = 0 )
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, aOuter, error);
|
||||
}
|
||||
{
|
||||
return nsCreateInstanceByContractID(aContractID, aOuter, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsCreateInstanceFromCategory
|
||||
|
@ -293,26 +147,26 @@ nsresult
|
|||
CallCreateInstance( const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
|
||||
return nsComponentManager::CreateInstance(aClass, aDelegate,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
template <class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallCreateInstance( const nsCID &aClass,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
|
||||
return nsComponentManager::CreateInstance(aClass, nsnull,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
template <class DestinationType>
|
||||
inline
|
||||
|
@ -320,28 +174,29 @@ nsresult
|
|||
CallCreateInstance( const char *aContractID,
|
||||
nsISupports *aDelegate,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aContractID, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
return nsComponentManager::CreateInstance(aContractID, aDelegate,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
return nsComponentManager::CreateInstance(aContractID,
|
||||
aDelegate,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
template <class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallCreateInstance( const char *aContractID,
|
||||
DestinationType** aDestination )
|
||||
{
|
||||
{
|
||||
NS_PRECONDITION(aContractID, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
|
||||
return nsComponentManager::CreateInstance(aContractID, nsnull,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
/* keys for registry use */
|
||||
extern const char xpcomKeyName[];
|
||||
|
@ -352,3 +207,5 @@ extern const char nativeComponentType[];
|
|||
extern const char staticComponentType[];
|
||||
|
||||
#endif /* nsComponentManagerUtils_h__ */
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsIComponentManagerObsolete.h"
|
||||
nsGenericFactory::nsGenericFactory(nsModuleComponentInfo *info)
|
||||
: mInfo(info)
|
||||
{
|
||||
|
@ -358,11 +358,15 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
|||
for (PRUint32 i = 0; i < mComponentCount; i++) {
|
||||
// Register the component only if it has a constructor
|
||||
if (cp->mConstructor) {
|
||||
rv = aCompMgr->RegisterComponentWithType(cp->mCID,
|
||||
cp->mDescription,
|
||||
cp->mContractID, aPath,
|
||||
registryLocation, PR_TRUE,
|
||||
PR_TRUE, componentType);
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->RegisterComponentWithType(cp->mCID,
|
||||
cp->mDescription,
|
||||
cp->mContractID, aPath,
|
||||
registryLocation, PR_TRUE,
|
||||
PR_TRUE, componentType);
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef DEBUG
|
||||
printf("nsGenericModule %s: unable to register %s component => %x\n",
|
||||
|
@ -405,8 +409,15 @@ nsGenericModule::UnregisterSelf(nsIComponentManager* aCompMgr,
|
|||
{
|
||||
cp->mUnregisterSelfProc(aCompMgr, aPath, registryLocation, cp);
|
||||
}
|
||||
|
||||
// Unregister the component
|
||||
nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath);
|
||||
|
||||
// what I want to do here is QI for a Component Registration Manager. Since this
|
||||
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIComponentManagerObsolete> obsoleteManager = do_QueryInterface(aCompMgr, &rv);
|
||||
if (obsoleteManager)
|
||||
rv = obsoleteManager->UnregisterComponentSpec(cp->mCID, aPath);
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef DEBUG
|
||||
printf("nsGenericModule %s: unable to unregister %s component => %x\n",
|
||||
|
|
|
@ -2469,18 +2469,19 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
|
|||
// Escape the path with the directory mask
|
||||
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
escPath.Insert("file:///", 0);
|
||||
|
||||
if (escPath[escPath.Length() - 1] != '/') {
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
*aURL = ToNewCString(escPath);
|
||||
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
if (NS_SUCCEEDED(rv) && dir && ) {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
}
|
||||
escPath.Insert("file:///", 0);
|
||||
|
||||
*aURL = ToNewCString(escPath);
|
||||
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
CRTFREEIF(ePath);
|
||||
|
|
|
@ -1492,16 +1492,18 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
|
|||
// Escape the path with the directory mask
|
||||
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
if (escPath[escPath.Length() - 1] != '/') {
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir && ) {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
}
|
||||
|
||||
escPath.Insert("file://", 0);
|
||||
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
*aURL = ToNewCString(escPath);
|
||||
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -300,7 +300,6 @@ nsLocalFile::MakeDirty()
|
|||
// this function will walk the native path of |this| resolving any symbolic
|
||||
// links found. The new resulting path will be placed into mResolvedPath.
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
nsLocalFile::ResolvePath(const char* workingPath, PRBool resolveTerminal, char** resolvedPath)
|
||||
{
|
||||
|
@ -589,13 +588,10 @@ NS_IMETHODIMP
|
|||
nsLocalFile::Clone(nsIFile **file)
|
||||
{
|
||||
nsresult rv;
|
||||
char * aFilePath;
|
||||
GetPath(&aFilePath);
|
||||
|
||||
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
|
||||
rv = NS_NewLocalFile(aFilePath, mFollowSymlinks, getter_AddRefs(localFile));
|
||||
nsMemory::Free(aFilePath);
|
||||
rv = NS_NewLocalFile(mWorkingPath.get(), mFollowSymlinks, getter_AddRefs(localFile));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && localFile)
|
||||
{
|
||||
|
@ -1862,19 +1858,19 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
|
|||
// Escape the path with the directory mask
|
||||
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
escPath.Insert("file:///", 0);
|
||||
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
if (escPath[escPath.Length() - 1] != '/') {
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir) {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
}
|
||||
escPath.Insert("file:///", 0);
|
||||
*aURL = ToNewCString(escPath);
|
||||
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
}
|
||||
CRTFREEIF(ePath);
|
||||
return rv;
|
||||
|
|
|
@ -906,6 +906,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIComponentManagerObsolete.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIRunnable.idl</PATH>
|
||||
|
@ -1343,6 +1350,13 @@
|
|||
<PATH>nsIComponentLoader.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIComponentManagerObsolete.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIComponentManager.idl</PATH>
|
||||
|
@ -2453,6 +2467,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIComponentManagerObsolete.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIRunnable.idl</PATH>
|
||||
|
@ -2895,6 +2916,11 @@
|
|||
<PATH>nsIComponentManager.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIComponentManagerObsolete.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIRunnable.idl</PATH>
|
||||
|
@ -3221,6 +3247,12 @@
|
|||
<PATH>nsIComponentManager.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIComponentManagerObsolete.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
|
|
@ -1156,6 +1156,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsComponentManagerObsolete.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsEmptyEnumerator.cpp</PATH>
|
||||
|
@ -1974,6 +1981,11 @@
|
|||
<PATH>nsComponentManager.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsComponentManagerObsolete.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsEmptyEnumerator.cpp</PATH>
|
||||
|
@ -3596,6 +3608,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsComponentManagerObsolete.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsEmptyEnumerator.cpp</PATH>
|
||||
|
@ -4419,6 +4438,11 @@
|
|||
<PATH>nsComponentManager.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsComponentManagerObsolete.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsEmptyEnumerator.cpp</PATH>
|
||||
|
@ -5054,6 +5078,12 @@
|
|||
<PATH>nsComponentManager.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpcom.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsComponentManagerObsolete.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpcom.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "xptcall.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerObsolete.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsComponentManagerObsolete.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsIEventQueueService.h"
|
||||
|
|
|
@ -58,7 +58,7 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
|||
extern "C" void
|
||||
NS_SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL /* default */);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
nsSampleImpl::nsSampleImpl() : mValue(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_INIT_ISUPPORTS();
|
||||
mValue = PL_strdup("initial value");
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ var myModule = {
|
|||
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
||||
}
|
||||
dump("*** Registering sample JS components\n");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.registerComponentWithType(this.myCID,
|
||||
"Sample JS Component",
|
||||
this.myProgID, fileSpec,
|
||||
|
|
|
@ -72,7 +72,7 @@ main(void)
|
|||
// To break free from such dependencies, we can GetService() the component
|
||||
// manager from the service manager that is returned from NS_InitXPCOM().
|
||||
// We feel that linkage dependency to XPCOM library is inevitable.
|
||||
(void) nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
(void) nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
|
||||
// Create an instance of our component
|
||||
nsCOMPtr<nsISample> mysample = do_CreateInstance(NS_SAMPLE_CONTRACTID, &rv);
|
||||
|
|
|
@ -83,7 +83,7 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
|||
extern "C" void
|
||||
NS_SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
|
||||
// startup netlib:
|
||||
|
|
|
@ -71,7 +71,7 @@ nsresult Register(const char *path)
|
|||
if (NS_FAILED(res)) return res;
|
||||
res = spec->SetNativePath((char *)path);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = nsComponentManager::AutoRegisterComponent(nsIComponentManager::NS_Startup, spec);
|
||||
res = nsComponentManager::AutoRegisterComponent(nsIComponentManagerObsolete::NS_Startup, spec);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ int main(int argc, char *argv[])
|
|||
if (argc <= 1)
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(
|
||||
nsIComponentManager::NS_Startup,
|
||||
nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default location */);
|
||||
ret = (NS_FAILED(rv)) ? -1 : 0;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ NS_DEFINE_CID(kTestLoadedFactoryCID, NS_TESTLOADEDFACTORY_CID);
|
|||
int main(int argc, char **argv) {
|
||||
nsresult rv;
|
||||
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ main(int argc, char* argv[])
|
|||
rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL);
|
||||
|
||||
if (argc > 1 && argv[1] != nsnull)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ void GetPaths(nsILocalFile* file)
|
|||
extern "C" void
|
||||
NS_SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, NULL);
|
||||
}
|
||||
|
||||
void InitTest(const char* creationPath, const char* appendPath)
|
||||
|
|
|
@ -57,7 +57,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInstance, LPSTR lpszCmdLine,
|
|||
return -1;
|
||||
}
|
||||
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, nsnull);
|
||||
|
||||
nsCOMPtr<nsINativeApp> nativeAppService(do_GetService(kNativeAppCID, &rv));
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ REQUIRES = string \
|
|||
EXPORTS = \
|
||||
nsAutoLock.h \
|
||||
plevent.h \
|
||||
nsProcess.h \
|
||||
nsProcess.h \
|
||||
nsITimer.h \
|
||||
nsITimerCallback.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -68,7 +68,7 @@ nsresult Register(const char *path)
|
|||
|
||||
rv = spec->InitWithPath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsComponentManager::AutoRegisterComponent(nsIComponentManager::NS_Startup, spec);
|
||||
rv = nsComponentManager::AutoRegisterComponent(nsIComponentManagerObsolete::NS_Startup, spec);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ nsresult Unregister(const char *path)
|
|||
|
||||
rv = spec->InitWithPath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsComponentManager::AutoUnregisterComponent(nsIComponentManager::NS_Startup, spec);
|
||||
rv = nsComponentManager::AutoUnregisterComponent(nsIComponentManagerObsolete::NS_Startup, spec);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
|||
if (argc <= 1)
|
||||
{
|
||||
nsresult rv = nsComponentManager::AutoRegister(
|
||||
nsIComponentManager::NS_Startup,
|
||||
nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default location */);
|
||||
ret = (NS_FAILED(rv)) ? -1 : 0;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ var module = {
|
|||
this.firstTime = false;
|
||||
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
||||
}
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.registerComponentWithType( this.cid,
|
||||
"Close All Windows",
|
||||
this.contractId,
|
||||
|
|
|
@ -52,7 +52,7 @@ extern "C" void
|
|||
NS_SetupRegistry_1( PRBool needAutoreg )
|
||||
{
|
||||
if ( needAutoreg )
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
NULL /* default */);
|
||||
|
||||
/*
|
||||
|
|
|
@ -58,6 +58,8 @@ jsConsoleHandler.prototype = {
|
|||
/* jsConsoleHandler Module (for XPCOM registration) */
|
||||
var jsConsoleHandlerModule = {
|
||||
registerSelf: function(compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(JSCONSOLEHANDLER_CID,
|
||||
'JS Console Commandline Handler component',
|
||||
JSCONSOLEHANDLER_CONTRACTID, fileSpec,
|
||||
|
@ -70,6 +72,7 @@ var jsConsoleHandlerModule = {
|
|||
},
|
||||
|
||||
unregisterSelf: function(compMgr, fileSpec, location) {
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.unregisterComponentSpec(JSCONSOLEHANDLER_CID, fileSpec);
|
||||
var catman = Components.classes["@mozilla.org/categorymanager;1"]
|
||||
.getService(Components.interfaces.nsICategoryManager);
|
||||
|
|
|
@ -207,6 +207,8 @@ filePickerModule.registerSelf =
|
|||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
debug("registering (all right -- a JavaScript module!)");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(FILEPICKER_CID, "FilePicker JS Component",
|
||||
FILEPICKER_CONTRACTID, fileSpec, location,
|
||||
true, true, type);
|
||||
|
|
|
@ -207,6 +207,8 @@ filePickerModule.registerSelf =
|
|||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
debug("registering (all right -- a JavaScript module!)");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(FILEPICKER_CID, "FilePicker JS Component",
|
||||
FILEPICKER_CONTRACTID, fileSpec, location,
|
||||
true, true, type);
|
||||
|
|
|
@ -345,6 +345,8 @@ sidebarModule.registerSelf =
|
|||
function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
debug("registering (all right -- a JavaScript module!)");
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
|
||||
compMgr.registerComponentWithType(SIDEBAR_CID, "Sidebar JS Component",
|
||||
SIDEBAR_CONTRACTID, fileSpec, location,
|
||||
true, true, type);
|
||||
|
|
|
@ -92,6 +92,7 @@ var module = {
|
|||
this.firstTime = false;
|
||||
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
||||
}
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
|
||||
compMgr.registerComponentWithType( this.cid,
|
||||
"Close All Windows",
|
||||
this.contractId,
|
||||
|
|
|
@ -435,7 +435,7 @@ nsSoftwareUpdate::StartupTasks( PRBool *needAutoreg )
|
|||
// is not the actual BuildID, or if we couldn't get the BuildID
|
||||
if ( autoReg || NS_FAILED(rv) || buildID != NS_BUILD_ID )
|
||||
{
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,0);
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,0);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ static NS_DEFINE_IID(kSoftwareUpdateCID, NS_SoftwareUpdate_CID);
|
|||
extern "C" void
|
||||
NS_SetupRegistry()
|
||||
{
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
nsnull /* default */);
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -155,10 +155,10 @@ PR_PUBLIC_API(nsresult) XPI_Init(
|
|||
return rv;
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_MAC)
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
compDir);
|
||||
#else
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup,
|
||||
nsnull);
|
||||
#endif
|
||||
if (NS_FAILED(rv))
|
||||
|
|
Загрузка…
Ссылка в новой задаче