Creation code for the new component.

This commit is contained in:
cata%netscape.com 1999-09-22 01:12:17 +00:00
Родитель 3dd7657163
Коммит 9049e4ca4d
1 изменённых файлов: 25 добавлений и 4 удалений

Просмотреть файл

@ -32,15 +32,18 @@
#include "nsITextToSubURI.h"
#include "nsTextToSubURI.h"
#include "nsIServiceManager.h"
#include "nsCharsetMenu.h"
#include "rdf.h"
#include "nsUConvDll.h"
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
static NS_DEFINE_CID(kTextToSubURICID, NS_TEXTTOSUBURI_CID);
//----------------------------------------------------------------------
// Global functions and data [declaration]
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
static NS_DEFINE_CID(kCharsetMenuCID, NS_CHARSETMENU_CID);
static NS_DEFINE_CID(kTextToSubURICID, NS_TEXTTOSUBURI_CID);
PRInt32 g_InstanceCount = 0;
PRInt32 g_LockCount = 0;
@ -133,6 +136,17 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
return res;
}
if (aClass.Equals(kCharsetMenuCID)) {
nsIFactory *factory = new nsCharsetMenuFactory();
nsresult res = factory->QueryInterface(kIFactoryIID, (void**) aFactory);
if (NS_FAILED(res)) {
*aFactory = NULL;
delete factory;
}
return res;
}
if (aClass.Equals(kTextToSubURICID)) {
nsIFactory *factory = NEW_TEXTTOSUBURI_FACTORY();
nsresult res = factory->QueryInterface(kIFactoryIID, (void**) aFactory);
@ -143,6 +157,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
return res;
}
return NS_NOINTERFACE;
}
@ -159,6 +174,12 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
rv = compMgr->RegisterComponent(kCharsetMenuCID,
NS_CHARSETMENU_PID,
NS_RDF_DATASOURCE_PROGID_PREFIX NS_CHARSETMENU_PID,
path, PR_TRUE, PR_TRUE);
if(NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
rv = compMgr->RegisterComponent(kUnicodeDecodeHelperCID,
"Unicode Decode Helper",
NS_UNICODEDECODEHELPER_PROGID,