add nsFontPackage for font downloading trigger code. sr=erik

This commit is contained in:
ftang%netscape.com 2001-02-06 12:40:23 +00:00
Родитель 379776ed20
Коммит a2a345d205
2 изменённых файлов: 25 добавлений и 1 удалений

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

@ -39,6 +39,7 @@
#include "nsCollationCID.h"
#include "nsIServiceManager.h"
#include "nsILanguageAtomService.h"
#include "nsIFontPackageService.h"
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
@ -55,6 +56,10 @@ NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
// for language atoms
//
NS_DEFINE_CID(kLanguageAtomServiceCID, NS_LANGUAGEATOMSERVICE_CID);
//
// for font package service
//
NS_DEFINE_CID(kFontPackageServiceCID, NS_FONTPACKAGESERVICE_CID);
//
// for the collation and formatting interfaces
@ -229,6 +234,16 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *
"nsLocaleTest: Register LanguageAtomService failed.");
if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
//
// register the font package service
//
rv = compMgr->RegisterComponent(kFontPackageServiceCID,
"Font Package Service", NS_FONTPACKAGESERVICE_CONTRACTID, path, PR_TRUE,
PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(rv),
"nsLocaleTest: Register FontPackageService failed.");
if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
@ -272,6 +287,8 @@ extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char
rv = compMgr->UnregisterComponent(kLanguageAtomServiceCID, path);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kFontPackageServiceCID, path);
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;

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

@ -19,6 +19,7 @@
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Frank Yung-Fong Tang <ftang@netscape.com>
*/
#include "nscore.h"
@ -30,6 +31,7 @@
#include "nsIScriptableDateFormat.h"
#include "nsLocalefactoryWin.h"
#include "nsLanguageAtomService.h"
#include "nsFontPackageService.h"
NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -39,7 +41,7 @@ NS_DEFINE_IID(kICollationIID, NS_ICOLLATION_IID);
NS_DEFINE_IID(kIDateTimeFormatIID, NS_IDATETIMEFORMAT_IID);
NS_DEFINE_CID(kScriptableDateFormatCID, NS_SCRIPTABLEDATEFORMAT_CID);
NS_DEFINE_CID(kLanguageAtomServiceCID, NS_LANGUAGEATOMSERVICE_CID);
static NS_DEFINE_CID(kFontPackageServiceCID, NS_FONTPACKAGESERVICE_CID);
nsLocaleWinFactory::nsLocaleWinFactory(const nsCID &aClass)
{
@ -83,6 +85,11 @@ nsresult nsLocaleWinFactory::CreateInstance(nsISupports *aOuter,
else if (mClassID.Equals(kLanguageAtomServiceCID)) {
NS_NEWXPCOM(inst, nsLanguageAtomService);
}
else if (mClassID.Equals(kFontPackageServiceCID)) {
nsIFontPackageService * pt = nsnull;
NS_NEWXPCOM(pt, nsFontPackageService);
inst = pt;
}
else
{
return NS_NOINTERFACE;