Bug 568691 part B - mechanical changes to in-tree binary modules needed to get them building and registering correctly. After this patch, xpcshell appears to work.

This commit is contained in:
Benjamin Smedberg 2010-06-10 14:11:40 -04:00
parent 9045c05660
commit f13550a209
446 changed files with 3215 additions and 5412 deletions

View File

@ -36,8 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
@ -45,7 +44,7 @@
#include "nsIAccessibleRetrieval.h"
#include "nscore.h"
static NS_IMETHODIMP
static nsresult
NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
@ -62,21 +61,26 @@ NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aRes
return rv;
}
// The list of components we register
static const nsModuleComponentInfo components[] =
{
{ "AccessibilityService",
NS_ACCESSIBILITY_SERVICE_CID,
"@mozilla.org/accessibilityService;1",
NS_ConstructAccessibilityService
},
{ "AccessibleRetrieval",
NS_ACCESSIBLE_RETRIEVAL_CID,
"@mozilla.org/accessibleRetrieval;1",
NS_ConstructAccessibilityService
},
NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_ACCESSIBLE_RETRIEVAL_CID);
static const mozilla::Module::CIDEntry kA11yCIDs[] = {
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, NULL, NS_ConstructAccessibilityService },
{ NULL }
};
NS_IMPL_NSGETMODULE(nsAccessibilityModule, components)
static const mozilla::Module::ContractIDEntry kA11yContracts[] = {
{ "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ NULL }
};
static const mozilla::Module kA11yModule = {
mozilla::Module::kVersion,
kA11yCIDs,
kA11yContracts
};
NSMODULE_DEFN(nsAccessibilityModule) = &kA11yModule;

View File

@ -177,7 +177,7 @@ AboutRedirector::GetURIFlags(nsIURI *aURI, PRUint32 *result)
return NS_ERROR_ILLEGAL_VALUE;
}
NS_METHOD
nsresult
AboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **result)
{
AboutRedirector* about = new AboutRedirector();

View File

@ -54,7 +54,7 @@ public:
AboutRedirector() {}
virtual ~AboutRedirector() {}
static NS_METHOD
static nsresult
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
protected:

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsBrowserCompsCID.h"
#include "DirectoryProvider.h"
@ -120,152 +120,125 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrivateBrowsingServiceWrapper, Init)
/////////////////////////////////////////////////////////////////////////////
static const nsModuleComponentInfo components[] =
{
{ "Browser Directory Provider",
NS_BROWSERDIRECTORYPROVIDER_CID,
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
DirectoryProviderConstructor,
DirectoryProvider::Register,
DirectoryProvider::Unregister
},
NS_DEFINE_NAMED_CID(NS_BROWSERDIRECTORYPROVIDER_CID);
#if defined(XP_WIN)
{ "Browser Shell Service",
NS_SHELLSERVICE_CID,
NS_SHELLSERVICE_CONTRACTID,
nsWindowsShellServiceConstructor},
NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
#elif defined(MOZ_WIDGET_GTK2)
{ "Browser Shell Service",
NS_SHELLSERVICE_CID,
NS_SHELLSERVICE_CONTRACTID,
nsGNOMEShellServiceConstructor },
NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
#endif
{ "Feed Sniffer",
NS_FEEDSNIFFER_CID,
NS_FEEDSNIFFER_CONTRACTID,
nsFeedSnifferConstructor,
nsFeedSniffer::Register },
#ifdef MOZ_SAFE_BROWSING
{ "about:blocked",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked",
AboutRedirector::Create },
#endif
{ "about:certerror",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror",
AboutRedirector::Create },
{ "about:feeds",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "feeds",
AboutRedirector::Create },
{ "about:privatebrowsing",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing",
AboutRedirector::Create },
{ "about:rights",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights",
AboutRedirector::Create },
{ "about:robots",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots",
AboutRedirector::Create },
{ "about:sessionrestore",
NS_BROWSER_ABOUT_REDIRECTOR_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore",
AboutRedirector::Create },
NS_DEFINE_NAMED_CID(NS_FEEDSNIFFER_CID);
NS_DEFINE_NAMED_CID(NS_BROWSER_ABOUT_REDIRECTOR_CID);
#ifndef WINCE
{ "Profile Migrator",
NS_FIREFOX_PROFILEMIGRATOR_CID,
NS_PROFILEMIGRATOR_CONTRACTID,
nsProfileMigratorConstructor },
NS_DEFINE_NAMED_CID(NS_FIREFOX_PROFILEMIGRATOR_CID);
#if defined(XP_WIN) && !defined(__MINGW32__)
{ "Internet Explorer (Windows) Profile Migrator",
NS_WINIEPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie",
nsIEProfileMigratorConstructor },
NS_DEFINE_NAMED_CID(NS_WINIEPROFILEMIGRATOR_CID);
#elif defined(XP_MACOSX)
{ "Browser Shell Service",
NS_SHELLSERVICE_CID,
NS_SHELLSERVICE_CONTRACTID,
nsMacShellServiceConstructor },
{ "Safari Profile Migrator",
NS_SAFARIPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "safari",
nsSafariProfileMigratorConstructor },
{ "Internet Explorer (Macintosh) Profile Migrator",
NS_MACIEPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "macie",
nsMacIEProfileMigratorConstructor },
{ "OmniWeb Profile Migrator",
NS_OMNIWEBPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "omniweb",
nsOmniWebProfileMigratorConstructor },
{ "Camino Profile Migrator",
NS_CAMINOPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "camino",
nsCaminoProfileMigratorConstructor },
{ "iCab Profile Migrator",
NS_ICABPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "icab",
nsICabProfileMigratorConstructor },
NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_SAFARIPROFILEMIGRATOR_CID);
NS_DEFINE_NAMED_CID(NS_MACIEPROFILEMIGRATOR_CID);
NS_DEFINE_NAMED_CID(NS_OMNIWEBPROFILEMIGRATOR_CID);
NS_DEFINE_NAMED_CID(NS_CAMINOPROFILEMIGRATOR_CID);
NS_DEFINE_NAMED_CID(NS_ICABPROFILEMIGRATOR_CID);
#endif
#if !defined(XP_OS2)
{ "Opera Profile Migrator",
NS_OPERAPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "opera",
nsOperaProfileMigratorConstructor },
NS_DEFINE_NAMED_CID(NS_OPERAPROFILEMIGRATOR_CID);
#endif
#if !defined(XP_BEOS)
{ "Netscape 4.x Profile Migrator",
NS_DOGBERTPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert",
nsDogbertProfileMigratorConstructor },
NS_DEFINE_NAMED_CID(NS_DOGBERTPROFILEMIGRATOR_CID);
#endif
{ "Phoenix Profile Migrator",
NS_PHOENIXPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix",
nsPhoenixProfileMigratorConstructor },
{ "Seamonkey Profile Migrator",
NS_SEAMONKEYPROFILEMIGRATOR_CID,
NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey",
nsSeamonkeyProfileMigratorConstructor },
NS_DEFINE_NAMED_CID(NS_PHOENIXPROFILEMIGRATOR_CID);
NS_DEFINE_NAMED_CID(NS_SEAMONKEYPROFILEMIGRATOR_CID);
#endif /* WINCE */
NS_DEFINE_NAMED_CID(NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID);
{ "PrivateBrowsing Service C++ Wrapper",
NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID,
NS_PRIVATE_BROWSING_SERVICE_CONTRACTID,
nsPrivateBrowsingServiceWrapperConstructor }
static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, NULL, DirectoryProviderConstructor },
#if defined(XP_WIN)
{ &kNS_SHELLSERVICE_CID, false, NULL, nsWindowsShellServiceConstructor },
#elif defined(MOZ_WIDGET_GTK2)
{ &kNS_SHELLSERVICE_CID, false, NULL, nsGNOMEShellServiceConstructor },
#endif
{ &kNS_FEEDSNIFFER_CID, false, NULL, nsFeedSnifferConstructor },
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create },
#ifndef WINCE
{ &kNS_FIREFOX_PROFILEMIGRATOR_CID, false, NULL, nsProfileMigratorConstructor },
#if defined(XP_WIN) && !defined(__MINGW32__)
{ &kNS_WINIEPROFILEMIGRATOR_CID, false, NULL, nsIEProfileMigratorConstructor },
#elif defined(XP_MACOSX)
{ &kNS_SHELLSERVICE_CID, false, NULL, nsMacShellServiceConstructor },
{ &kNS_SAFARIPROFILEMIGRATOR_CID, false, NULL, nsSafariProfileMigratorConstructor },
{ &kNS_MACIEPROFILEMIGRATOR_CID, false, NULL, nsMacIEProfileMigratorConstructor },
{ &kNS_OMNIWEBPROFILEMIGRATOR_CID, false, NULL, nsOmniWebProfileMigratorConstructor },
{ &kNS_CAMINOPROFILEMIGRATOR_CID, false, NULL, nsCaminoProfileMigratorConstructor },
{ &kNS_ICABPROFILEMIGRATOR_CID, false, NULL, nsICabProfileMigratorConstructor },
#endif
#if !defined(XP_OS2)
{ &kNS_OPERAPROFILEMIGRATOR_CID, false, NULL, nsOperaProfileMigratorConstructor },
#endif
#if !defined(XP_BEOS)
{ &kNS_DOGBERTPROFILEMIGRATOR_CID, false, NULL, nsDogbertProfileMigratorConstructor },
#endif
{ &kNS_PHOENIXPROFILEMIGRATOR_CID, false, NULL, nsPhoenixProfileMigratorConstructor },
{ &kNS_SEAMONKEYPROFILEMIGRATOR_CID, false, NULL, nsSeamonkeyProfileMigratorConstructor },
#endif /* WINCE */
{ &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID, false, NULL, nsPrivateBrowsingServiceWrapperConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(nsBrowserCompsModule, components)
static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_BROWSERDIRECTORYPROVIDER_CONTRACTID, &kNS_BROWSERDIRECTORYPROVIDER_CID },
#if defined(XP_WIN)
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
#elif defined(MOZ_WIDGET_GTK2)
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
#endif
{ NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID },
#ifdef MOZ_SAFE_BROWSING
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "feeds", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#ifndef WINCE
{ NS_PROFILEMIGRATOR_CONTRACTID, &kNS_FIREFOX_PROFILEMIGRATOR_CID },
#if defined(XP_WIN) && !defined(__MINGW32__)
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie", &kNS_WINIEPROFILEMIGRATOR_CID },
#elif defined(XP_MACOSX)
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "safari", &kNS_SAFARIPROFILEMIGRATOR_CID },
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "macie", &kNS_MACIEPROFILEMIGRATOR_CID },
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "omniweb", &kNS_OMNIWEBPROFILEMIGRATOR_CID },
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "camino", &kNS_CAMINOPROFILEMIGRATOR_CID },
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "icab", &kNS_ICABPROFILEMIGRATOR_CID },
#endif
#if !defined(XP_OS2)
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "opera", &kNS_OPERAPROFILEMIGRATOR_CID },
#endif
#if !defined(XP_BEOS)
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert", &kNS_DOGBERTPROFILEMIGRATOR_CID },
#endif
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix", &kNS_PHOENIXPROFILEMIGRATOR_CID },
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey", &kNS_SEAMONKEYPROFILEMIGRATOR_CID },
#endif /* WINCE */
{ NS_PRIVATE_BROWSING_SERVICE_CONTRACTID, &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID },
{ NULL }
};
static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
{ XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
{ NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
{ NULL }
};
static const mozilla::Module kBrowserModule = {
mozilla::Module::kVersion,
kBrowserCIDs,
kBrowserContracts,
kBrowserCategories
};
NSMODULE_DEFN(nsBrowserCompsModule) = &kBrowserModule;

View File

@ -52,7 +52,7 @@
#include "nsComponentManagerUtils.h"
#include "nsCOMArray.h"
#include "nsDirectoryServiceUtils.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsStringAPI.h"
#include "nsXULAppAPI.h"
@ -276,43 +276,6 @@ DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult)
return NS_ERROR_FAILURE;
}
NS_METHOD
DirectoryProvider::Register(nsIComponentManager* aCompMgr, nsIFile* aPath,
const char *aLoaderStr, const char *aType,
const nsModuleComponentInfo *aInfo)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catMan
(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
if (!catMan)
return NS_ERROR_FAILURE;
rv = catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
"browser-directory-provider",
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
return rv;
}
NS_METHOD
DirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catMan
(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
if (!catMan)
return NS_ERROR_FAILURE;
rv = catMan->DeleteCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
"browser-directory-provider", PR_TRUE);
return rv;
}
NS_IMPL_ISUPPORTS1(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
NS_IMETHODIMP

View File

@ -42,7 +42,6 @@
#include "nsComponentManagerUtils.h"
#include "nsISimpleEnumerator.h"
#include "nsIFile.h"
#include "nsIGenericFactory.h"
#define NS_BROWSERDIRECTORYPROVIDER_CONTRACTID \
"@mozilla.org/browser/directory-provider;1"
@ -57,15 +56,6 @@ public:
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
static NS_METHOD Register(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo);
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo);
private:
class AppendingEnumerator : public nsISimpleEnumerator
{

View File

@ -423,19 +423,3 @@ nsFeedSniffer::OnStopRequest(nsIRequest* request, nsISupports* context,
{
return NS_OK;
}
NS_METHOD
nsFeedSniffer::Register(nsIComponentManager *compMgr, nsIFile *path,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
return catman->AddCategoryEntry(NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer",
NS_FEEDSNIFFER_CONTRACTID, PR_TRUE, PR_TRUE,
nsnull);
}

View File

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "nsIContentSniffer.h"
#include "nsIStreamListener.h"
#include "nsStringAPI.h"
@ -56,11 +55,6 @@ public:
PRUint32 count,
PRUint32* writeCount);
static NS_METHOD Register(nsIComponentManager* compMgr, nsIFile* path,
const char* registryLocation,
const char* componentType,
const nsModuleComponentInfo *info);
protected:
nsresult ConvertEncodedData(nsIRequest* request, const PRUint8* data,
PRUint32 length);

View File

@ -53,6 +53,7 @@
#include "nsDOMError.h"
#include "nsScriptSecurityManager.h"
NS_IMPL_CLASSINFO(nsNullPrincipal, NULL, nsIClassInfo::MAIN_THREAD_ONLY)
NS_IMPL_QUERY_INTERFACE2_CI(nsNullPrincipal,
nsIPrincipal,
nsISerializable)

View File

@ -140,6 +140,7 @@ PRInt32 nsPrincipal::sCapabilitiesOrdinal = 0;
const char nsPrincipal::sInvalid[] = "Invalid";
NS_IMPL_CLASSINFO(nsPrincipal, NULL, nsIClassInfo::MAIN_THREAD_ONLY)
NS_IMPL_QUERY_INTERFACE2_CI(nsPrincipal,
nsIPrincipal,
nsISerializable)

View File

@ -37,8 +37,6 @@
/*Factory for internal browser security resource managers*/
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsIScriptSecurityManager.h"
#include "nsScriptSecurityManager.h"
#include "nsIPrincipal.h"

View File

@ -49,7 +49,8 @@
#include "nsString.h"
#include "nsIClassInfoImpl.h"
NS_IMPL_CLASSINFO(nsSystemPrincipal, NULL,
nsIClassInfo::SINGLETON | nsIClassInfo::MAIN_THREAD_ONLY)
NS_IMPL_QUERY_INTERFACE2_CI(nsSystemPrincipal,
nsIPrincipal,
nsISerializable)

View File

@ -36,8 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
@ -49,21 +48,26 @@
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsChromeRegistry, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeProtocolHandler)
// The list of components we register
static const nsModuleComponentInfo components[] =
{
{ "Chrome Registry",
NS_CHROMEREGISTRY_CID,
NS_CHROMEREGISTRY_CONTRACTID,
nsChromeRegistryConstructor
},
NS_DEFINE_NAMED_CID(NS_CHROMEREGISTRY_CID);
NS_DEFINE_NAMED_CID(NS_CHROMEPROTOCOLHANDLER_CID);
{ "Chrome Protocol Handler",
NS_CHROMEPROTOCOLHANDLER_CID,
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome",
nsChromeProtocolHandlerConstructor
}
static const mozilla::Module::CIDEntry kChromeCIDs[] = {
{ &kNS_CHROMEREGISTRY_CID, false, NULL, nsChromeRegistryConstructor },
{ &kNS_CHROMEPROTOCOLHANDLER_CID, false, NULL, nsChromeProtocolHandlerConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(nsChromeModule, components)
static const mozilla::Module::ContractIDEntry kChromeContracts[] = {
{ NS_CHROMEREGISTRY_CONTRACTID, &kNS_CHROMEREGISTRY_CID },
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome", &kNS_CHROMEPROTOCOLHANDLER_CID },
{ NULL }
};
static const mozilla::Module kChromeModule = {
mozilla::Module::kVersion,
kChromeCIDs,
kChromeContracts
};
NSMODULE_DEFN(nsChromeModule) = &kChromeModule;

View File

@ -72,7 +72,7 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIXULPrototypeCache, NS_IXULPROTOTYPECACHE_IID)
NS_IMETHODIMP
nsresult
NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult);

View File

@ -79,7 +79,7 @@ nsXULControllers::DeleteControllers()
}
NS_IMETHODIMP
nsresult
NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aOuter == nsnull, "no aggregation");

View File

@ -77,13 +77,13 @@ public:
};
NS_IMETHODIMP NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
class nsXULControllers : public nsIControllers,
public nsISecurityCheckedComponent
{
public:
friend NS_IMETHODIMP
friend nsresult
NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS

View File

@ -112,7 +112,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS2(nsXULPrototypeCache,
nsIObserver)
NS_IMETHODIMP
nsresult
NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(! aOuter, "no aggregation");

View File

@ -145,7 +145,7 @@ public:
}
protected:
friend NS_IMETHODIMP
friend nsresult
NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult);
nsXULPrototypeCache();

View File

@ -117,7 +117,7 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
protected:
friend NS_IMETHODIMP
friend nsresult
NS_NewXULContentBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
nsXULContentBuilder();
@ -370,7 +370,7 @@ protected:
nsSortState mSortState;
};
NS_IMETHODIMP
nsresult
NS_NewXULContentBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aOuter == nsnull, "no aggregation");

View File

@ -90,7 +90,7 @@ public:
virtual void NodeWillBeDestroyed(const nsINode* aNode);
protected:
friend NS_IMETHODIMP
friend nsresult
NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
nsXULTreeBuilder();
@ -270,7 +270,7 @@ protected:
//----------------------------------------------------------------------
NS_IMETHODIMP
nsresult
NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
*aResult = nsnull;

View File

@ -94,8 +94,6 @@ CPPSRCS = \
nsDocShellEnumerator.cpp \
nsDSURIContentListener.cpp \
nsDefaultURIFixup.cpp \
nsGlobalHistoryAdapter.cpp \
nsGlobalHistory2Adapter.cpp \
nsWebNavigationInfo.cpp \
nsAboutRedirector.cpp \
nsDownloadHistory.cpp \

View File

@ -174,7 +174,7 @@ nsAboutRedirector::GetURIFlags(nsIURI *aURI, PRUint32 *result)
return NS_ERROR_ILLEGAL_VALUE;
}
NS_METHOD
nsresult
nsAboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsAboutRedirector* about = new nsAboutRedirector();

View File

@ -51,7 +51,7 @@ public:
nsAboutRedirector() {}
virtual ~nsAboutRedirector() {}
static NS_METHOD
static nsresult
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
protected:

View File

@ -52,35 +52,6 @@
NS_IMPL_ISUPPORTS1(nsDownloadHistory, nsIDownloadHistory)
nsresult
nsDownloadHistory::RegisterSelf(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo)
{
nsCOMPtr<nsIComponentRegistrar> compReg(do_QueryInterface(aCompMgr));
if (!compReg)
return NS_ERROR_UNEXPECTED;
PRBool registered;
nsresult rv = compReg->IsContractIDRegistered(NS_DOWNLOADHISTORY_CONTRACTID,
&registered);
NS_ENSURE_SUCCESS(rv, rv);
// If someone has already registered the contractID, we don't want to register
// it ourselves. We do want to register though in case someone wants to access
// this implementation (by CID).
if (registered) {
return compReg->RegisterFactoryLocation(GetCID(), "nsDownloadHistory",
nsnull, aPath, aLoaderStr, aType);
}
return compReg->RegisterFactoryLocation(GetCID(), "nsDownloadHistory",
NS_DOWNLOADHISTORY_CONTRACTID,
aPath, aLoaderStr, aType);
}
////////////////////////////////////////////////////////////////////////////////
//// nsIDownloadHistory

View File

@ -41,7 +41,6 @@
#define __nsDownloadHistory_h__
#include "nsIDownloadHistory.h"
#include "nsIGenericFactory.h"
#define NS_DOWNLOADHISTORY_CID \
{0x2ee83680, 0x2af0, 0x4bcb, {0xbf, 0xa0, 0xc9, 0x70, 0x5f, 0x65, 0x54, 0xf1}}
@ -52,12 +51,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOWNLOADHISTORY
static NS_METHOD RegisterSelf(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo);
NS_DEFINE_STATIC_CID_ACCESSOR(NS_DOWNLOADHISTORY_CID)
};

View File

@ -1,176 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Mozilla gecko code.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <bsmedberg@covad.net>
* Portions created by the Initial Developer are Copyright (C) 2004
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGlobalHistory2Adapter.h"
#include "nsDocShellCID.h"
#include "nsServiceManagerUtils.h"
#include "nsIComponentRegistrar.h"
#include "nsGlobalHistoryAdapter.h"
#include "nsIURI.h"
#include "nsString.h"
#include "nsNetUtil.h"
// we should really have a nsIGenericFactory macro to make this a static
// member function
nsresult
nsGlobalHistory2Adapter::Create(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
{
nsresult rv;
if (aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
nsGlobalHistory2Adapter* adapter = new nsGlobalHistory2Adapter();
if (!adapter) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
NS_ADDREF(adapter);
rv = adapter->Init();
if (NS_SUCCEEDED(rv)) {
rv = adapter->QueryInterface(aIID, aResult);
}
NS_RELEASE(adapter);
return rv;
}
nsresult
nsGlobalHistory2Adapter::RegisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aLoaderStr,
const char* aType,
const nsModuleComponentInfo *aInfo)
{
nsresult rv;
PRBool registered;
nsCOMPtr<nsIComponentRegistrar> compReg( do_QueryInterface(aCompMgr) );
if (!compReg) {
rv = NS_ERROR_UNEXPECTED;
return rv;
}
rv = compReg->IsContractIDRegistered(NS_GLOBALHISTORY_CONTRACTID, &registered);
if (NS_FAILED(rv)) return rv;
// If the embedder has already registered the contractID, we don't want to
// register ourself. Ideally the component manager would handle this for us.
if (registered) {
rv = NS_OK;
return rv;
}
return compReg->RegisterFactoryLocation(GetCID(),
"nsGlobalHistory2Adapter",
NS_GLOBALHISTORY_CONTRACTID,
aPath, aLoaderStr, aType);
}
nsGlobalHistory2Adapter::nsGlobalHistory2Adapter()
{ }
nsGlobalHistory2Adapter::~nsGlobalHistory2Adapter()
{ }
nsresult
nsGlobalHistory2Adapter::Init()
{
nsresult rv;
nsCOMPtr<nsIComponentRegistrar> compReg;
rv = NS_GetComponentRegistrar(getter_AddRefs(compReg));
NS_ENSURE_SUCCESS(rv, rv);
nsCID *cid;
rv = compReg->ContractIDToCID(NS_GLOBALHISTORY2_CONTRACTID, &cid);
if (NS_FAILED(rv)) {
rv = NS_ERROR_FACTORY_NOT_REGISTERED;
return rv;
}
if (cid->Equals(nsGlobalHistoryAdapter::GetCID())) {
rv = NS_ERROR_FACTORY_NOT_REGISTERED;
return rv;
}
NS_WARNING("Using nsIGlobalHistory->nsIGlobalHistory2 adapter.");
mHistory = do_GetService(NS_GLOBALHISTORY2_CONTRACTID, &rv);
return rv;
}
NS_IMPL_ISUPPORTS1(nsGlobalHistory2Adapter, nsIGlobalHistory)
NS_IMETHODIMP
nsGlobalHistory2Adapter::AddPage(const char* aURI)
{
NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_TRUE(*aURI, NS_ERROR_ILLEGAL_VALUE);
nsresult rv;
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), nsDependentCString(aURI));
if (NS_SUCCEEDED(rv)) {
rv = mHistory->AddURI(uri, PR_FALSE, PR_FALSE, nsnull);
}
return rv;
}
NS_IMETHODIMP
nsGlobalHistory2Adapter::IsVisited(const char* aURI, PRBool* aRetval)
{
NS_ENSURE_ARG_POINTER(aURI);
nsresult rv;
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), nsDependentCString(aURI));
if (NS_SUCCEEDED(rv)) {
rv = mHistory->IsVisited(uri, aRetval);
}
return rv;
}

View File

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Mozilla gecko code.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <bsmedberg@covad.net>
* Portions created by the Initial Developer are Copyright (C) 2004
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGlobalHistory2.h"
#include "nsIGlobalHistory.h"
#include "nsIGenericFactory.h"
#include "nsCOMPtr.h"
/**
* A compatibility wrapper for the nsIGlobalHistory2 interface. It provides
* the old nsIGlobalHistory interface for extensions which still use it.
*/
// {a772eee4-0464-40d5-a329-a29dfda3791a}
#define NS_GLOBALHISTORY2ADAPTER_CID \
{ 0xa772eee4, 0x0464, 0x405d, { 0xa3, 0x29, 0xa2, 0x9d, 0xfd, 0xa3, 0x79, 0x1a } }
class nsGlobalHistory2Adapter : public nsIGlobalHistory
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGLOBALHISTORY
static NS_METHOD Create(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
static NS_METHOD RegisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aLoaderStr,
const char* aType,
const nsModuleComponentInfo *aInfo);
NS_DEFINE_STATIC_CID_ACCESSOR(NS_GLOBALHISTORY2ADAPTER_CID)
private:
nsGlobalHistory2Adapter();
~nsGlobalHistory2Adapter();
nsresult Init();
nsCOMPtr<nsIGlobalHistory2> mHistory;
};

View File

@ -1,199 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Mozilla gecko code.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <bsmedberg@covad.net>
* Portions created by the Initial Developer are Copyright (C) 2004
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGlobalHistoryAdapter.h"
#include "nsDocShellCID.h"
#include "nsServiceManagerUtils.h"
#include "nsIComponentRegistrar.h"
#include "nsGlobalHistory2Adapter.h"
#include "nsIURI.h"
#include "nsString.h"
nsresult
nsGlobalHistoryAdapter::Create(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
{
nsresult rv;
if (aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
nsGlobalHistoryAdapter* adapter = new nsGlobalHistoryAdapter();
if (!adapter) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
NS_ADDREF(adapter);
rv = adapter->Init();
if (NS_SUCCEEDED(rv)) {
rv = adapter->QueryInterface(aIID, aResult);
}
NS_RELEASE(adapter);
return rv;
}
nsresult
nsGlobalHistoryAdapter::RegisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aLoaderStr,
const char* aType,
const nsModuleComponentInfo *aInfo)
{
nsresult rv;
PRBool registered;
nsCOMPtr<nsIComponentRegistrar> compReg( do_QueryInterface(aCompMgr) );
if (!compReg) {
rv = NS_ERROR_UNEXPECTED;
return rv;
}
rv = compReg->IsContractIDRegistered(NS_GLOBALHISTORY2_CONTRACTID, &registered);
if (NS_FAILED(rv)) return rv;
// If the embedder has already registered the contractID, we don't want to
// register ourself. Ideally the component manager would handle this for us.
if (registered) {
rv = NS_OK;
return rv;
}
return compReg->RegisterFactoryLocation(GetCID(),
"nsGlobalHistoryAdapter",
NS_GLOBALHISTORY2_CONTRACTID,
aPath, aLoaderStr, aType);
}
nsGlobalHistoryAdapter::nsGlobalHistoryAdapter()
{ }
nsGlobalHistoryAdapter::~nsGlobalHistoryAdapter()
{ }
nsresult
nsGlobalHistoryAdapter::Init()
{
nsresult rv;
nsCOMPtr<nsIComponentRegistrar> compReg;
rv = NS_GetComponentRegistrar(getter_AddRefs(compReg));
NS_ENSURE_SUCCESS(rv, rv);
nsCID *cid;
rv = compReg->ContractIDToCID(NS_GLOBALHISTORY_CONTRACTID, &cid);
if (NS_FAILED(rv)) {
rv = NS_ERROR_FACTORY_NOT_REGISTERED;
return rv;
}
if (cid->Equals(nsGlobalHistory2Adapter::GetCID())) {
rv = NS_ERROR_FACTORY_NOT_REGISTERED;
return rv;
}
NS_WARNING("Using nsIGlobalHistory2->nsIGlobalHistory adapter.");
mHistory = do_GetService(NS_GLOBALHISTORY_CONTRACTID, &rv);
return rv;
}
NS_IMPL_ISUPPORTS1(nsGlobalHistoryAdapter, nsIGlobalHistory2)
NS_IMETHODIMP
nsGlobalHistoryAdapter::AddURI(nsIURI* aURI, PRBool aRedirect,
PRBool aToplevel, nsIURI* aReferrer)
{
NS_ENSURE_ARG_POINTER(aURI);
nsresult rv;
// The model is really if we don't know differently then add which basically
// means we are supposed to try all the things we know not to allow in and
// then if we don't bail go on and allow it in. But here lets compare
// against the most common case we know to allow in and go on and say yes
// to it.
PRBool isHTTP = PR_FALSE;
PRBool isHTTPS = PR_FALSE;
NS_ENSURE_SUCCESS(rv = aURI->SchemeIs("http", &isHTTP), rv);
NS_ENSURE_SUCCESS(rv = aURI->SchemeIs("https", &isHTTPS), rv);
if (!isHTTP && !isHTTPS) {
PRBool isAbout, isImap, isNews, isMailbox, isViewSource, isChrome, isData;
rv = aURI->SchemeIs("about", &isAbout);
rv |= aURI->SchemeIs("imap", &isImap);
rv |= aURI->SchemeIs("news", &isNews);
rv |= aURI->SchemeIs("mailbox", &isMailbox);
rv |= aURI->SchemeIs("view-source", &isViewSource);
rv |= aURI->SchemeIs("chrome", &isChrome);
rv |= aURI->SchemeIs("data", &isData);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
if (isAbout || isImap || isNews || isMailbox || isViewSource || isChrome || isData) {
return NS_OK;
}
}
nsCAutoString spec;
rv = aURI->GetSpec(spec);
NS_ENSURE_SUCCESS(rv, rv);
return mHistory->AddPage(spec.get());
}
NS_IMETHODIMP
nsGlobalHistoryAdapter::IsVisited(nsIURI* aURI, PRBool* aRetval)
{
NS_ENSURE_ARG_POINTER(aURI);
nsCAutoString spec;
nsresult rv = aURI->GetSpec(spec);
NS_ENSURE_SUCCESS(rv, rv);
return mHistory->IsVisited(spec.get(), aRetval);
}
NS_IMETHODIMP
nsGlobalHistoryAdapter::SetPageTitle(nsIURI* aURI, const nsAString& aTitle)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Mozilla gecko code.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <bsmedberg@covad.net>
* Portions created by the Initial Developer are Copyright (C) 2004
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGlobalHistory2.h"
#include "nsIGlobalHistory.h"
#include "nsIGenericFactory.h"
#include "nsCOMPtr.h"
/**
* A compatibility wrapper for the old nsIGlobalHistory interface. It provides
* the new nsIGlobalHistory2 interface for embedders who haven't implemented it
* themselves.
*/
// {2e9b69dd-9087-438c-8b5d-f77b553abefb}
#define NS_GLOBALHISTORYADAPTER_CID \
{ 0x2e9b69dd, 0x9087, 0x438c, { 0x8b, 0x5d, 0xf7, 0x7b, 0x55, 0x3a, 0xbe, 0xfb } }
class nsGlobalHistoryAdapter : public nsIGlobalHistory2
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGLOBALHISTORY2
static NS_METHOD Create(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
static NS_METHOD RegisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aLoaderStr,
const char* aType,
const nsModuleComponentInfo *aInfo);
NS_DEFINE_STATIC_CID_ACCESSOR(NS_GLOBALHISTORYADAPTER_CID)
private:
nsGlobalHistoryAdapter();
~nsGlobalHistoryAdapter();
nsresult Init();
nsCOMPtr<nsIGlobalHistory> mHistory;
};

View File

@ -37,9 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsDocShellCID.h"
#include "nsDocShell.h"
@ -65,19 +63,14 @@
#include "nsSHistory.h"
#include "nsSHTransaction.h"
// global history
#include "nsGlobalHistoryAdapter.h"
#include "nsGlobalHistory2Adapter.h"
// download history
#include "nsDownloadHistory.h"
static PRBool gInitialized = PR_FALSE;
// The one time initialization for this module
// static
static nsresult
Initialize(nsIModule* aSelf)
Initialize()
{
NS_PRECONDITION(!gInitialized, "docshell module already initialized");
if (gInitialized) {
@ -93,7 +86,7 @@ Initialize(nsIModule* aSelf)
}
static void
Shutdown(nsIModule* aSelf)
Shutdown()
{
nsSHEntry::Shutdown();
gInitialized = PR_FALSE;
@ -126,150 +119,103 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHistory)
// download history
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadHistory)
static const nsModuleComponentInfo gDocShellModuleInfo[] = {
// docshell
{ "DocShell",
NS_DOCSHELL_CID,
"@mozilla.org/docshell;1",
nsDocShellConstructor
},
{ "Default keyword fixup",
NS_DEFAULTURIFIXUP_CID,
NS_URIFIXUP_CONTRACTID,
nsDefaultURIFixupConstructor
},
{ "Webnavigation info service",
NS_WEBNAVIGATION_INFO_CID,
NS_WEBNAVIGATION_INFO_CONTRACTID,
nsWebNavigationInfoConstructor
},
// about redirector
{ "about:about",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "about",
nsAboutRedirector::Create
},
{ "about:config",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "config",
nsAboutRedirector::Create
},
#ifdef MOZ_CRASHREPORTER
{ "about:crashes",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes",
nsAboutRedirector::Create
},
#endif
{ "about:credits",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits",
nsAboutRedirector::Create
},
{ "about:plugins",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "plugins",
nsAboutRedirector::Create
},
{ "about:mozilla",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "mozilla",
nsAboutRedirector::Create
},
{ "about:logo",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "logo",
nsAboutRedirector::Create
},
{ "about:buildconfig",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig",
nsAboutRedirector::Create
},
{ "about:license",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "license",
nsAboutRedirector::Create
},
{ "about:licence",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "licence",
nsAboutRedirector::Create
},
{ "about:neterror",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror",
nsAboutRedirector::Create
},
{ "about:memory",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory",
nsAboutRedirector::Create
},
{ "about:addons",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "addons",
nsAboutRedirector::Create
},
{ "about:support",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "support",
nsAboutRedirector::Create
},
// uriloader
{ "Netscape URI Loader Service", NS_URI_LOADER_CID, NS_URI_LOADER_CONTRACTID, nsURILoaderConstructor, },
{ "Netscape Doc Loader Service", NS_DOCUMENTLOADER_SERVICE_CID, NS_DOCUMENTLOADER_SERVICE_CONTRACTID,
nsDocLoaderConstructor, },
{ "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALHELPERAPPSERVICE_CONTRACTID,
nsOSHelperAppServiceConstructor, },
{ "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALPROTOCOLSERVICE_CONTRACTID,
nsOSHelperAppServiceConstructor, },
{ "Netscape Mime Mapping Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_MIMESERVICE_CONTRACTID,
nsOSHelperAppServiceConstructor, },
{ "Netscape Default Protocol Handler", NS_EXTERNALPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default",
nsExternalProtocolHandlerConstructor, },
{ NS_PREFETCHSERVICE_CLASSNAME, NS_PREFETCHSERVICE_CID, NS_PREFETCHSERVICE_CONTRACTID,
nsPrefetchServiceConstructor, },
{ NS_OFFLINECACHEUPDATESERVICE_CLASSNAME, NS_OFFLINECACHEUPDATESERVICE_CID, NS_OFFLINECACHEUPDATESERVICE_CONTRACTID,
nsOfflineCacheUpdateServiceConstructor, },
{ NS_OFFLINECACHEUPDATE_CLASSNAME, NS_OFFLINECACHEUPDATE_CID, NS_OFFLINECACHEUPDATE_CONTRACTID,
nsOfflineCacheUpdateConstructor, },
{ "Local Application Handler App", NS_LOCALHANDLERAPP_CID,
NS_LOCALHANDLERAPP_CONTRACTID, PlatformLocalHandlerApp_tConstructor, },
NS_DEFINE_NAMED_CID(NS_DOCSHELL_CID);
NS_DEFINE_NAMED_CID(NS_DEFAULTURIFIXUP_CID);
NS_DEFINE_NAMED_CID(NS_WEBNAVIGATION_INFO_CID);
NS_DEFINE_NAMED_CID(NS_ABOUT_REDIRECTOR_MODULE_CID);
NS_DEFINE_NAMED_CID(NS_URI_LOADER_CID);
NS_DEFINE_NAMED_CID(NS_DOCUMENTLOADER_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_EXTERNALHELPERAPPSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_EXTERNALPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_PREFETCHSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_OFFLINECACHEUPDATESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_OFFLINECACHEUPDATE_CID);
NS_DEFINE_NAMED_CID(NS_LOCALHANDLERAPP_CID);
#ifdef MOZ_ENABLE_DBUS
{ "DBus Handler App", NS_DBUSHANDLERAPP_CID,
NS_DBUSHANDLERAPP_CONTRACTID, nsDBusHandlerAppConstructor},
NS_DEFINE_NAMED_CID(NS_DBUSHANDLERAPP_CID);
#endif
// session history
{ "nsSHEntry", NS_SHENTRY_CID,
NS_SHENTRY_CONTRACTID, nsSHEntryConstructor },
{ "nsSHEntry", NS_HISTORYENTRY_CID,
NS_HISTORYENTRY_CONTRACTID, nsSHEntryConstructor },
{ "nsSHTransaction", NS_SHTRANSACTION_CID,
NS_SHTRANSACTION_CONTRACTID, nsSHTransactionConstructor },
{ "nsSHistory", NS_SHISTORY_CID,
NS_SHISTORY_CONTRACTID, nsSHistoryConstructor },
{ "nsSHistory", NS_SHISTORY_INTERNAL_CID,
NS_SHISTORY_INTERNAL_CONTRACTID, nsSHistoryConstructor },
NS_DEFINE_NAMED_CID(NS_SHENTRY_CID);
NS_DEFINE_NAMED_CID(NS_HISTORYENTRY_CID);
NS_DEFINE_NAMED_CID(NS_SHTRANSACTION_CID);
NS_DEFINE_NAMED_CID(NS_SHISTORY_CID);
NS_DEFINE_NAMED_CID(NS_SHISTORY_INTERNAL_CID);
NS_DEFINE_NAMED_CID(NS_DOWNLOADHISTORY_CID);
// global history adapters
{ "nsGlobalHistoryAdapter", NS_GLOBALHISTORYADAPTER_CID,
nsnull, nsGlobalHistoryAdapter::Create,
nsGlobalHistoryAdapter::RegisterSelf },
{ "nsGlobalHistory2Adapter", NS_GLOBALHISTORY2ADAPTER_CID,
nsnull, nsGlobalHistory2Adapter::Create,
nsGlobalHistory2Adapter::RegisterSelf },
// download history
{ "nsDownloadHistory", NS_DOWNLOADHISTORY_CID,
nsnull, nsDownloadHistoryConstructor,
nsDownloadHistory::RegisterSelf }
const mozilla::Module::CIDEntry kDocShellCIDs[] = {
{ &kNS_DOCSHELL_CID, false, NULL, nsDocShellConstructor },
{ &kNS_DEFAULTURIFIXUP_CID, false, NULL, nsDefaultURIFixupConstructor },
{ &kNS_WEBNAVIGATION_INFO_CID, false, NULL, nsWebNavigationInfoConstructor },
{ &kNS_ABOUT_REDIRECTOR_MODULE_CID, false, NULL, nsAboutRedirector::Create },
{ &kNS_URI_LOADER_CID, false, NULL, nsURILoaderConstructor },
{ &kNS_DOCUMENTLOADER_SERVICE_CID, false, NULL, nsDocLoaderConstructor },
{ &kNS_EXTERNALHELPERAPPSERVICE_CID, false, NULL, nsOSHelperAppServiceConstructor },
{ &kNS_EXTERNALPROTOCOLHANDLER_CID, false, NULL, nsExternalProtocolHandlerConstructor },
{ &kNS_PREFETCHSERVICE_CID, false, NULL, nsPrefetchServiceConstructor },
{ &kNS_OFFLINECACHEUPDATESERVICE_CID, false, NULL, nsOfflineCacheUpdateServiceConstructor },
{ &kNS_OFFLINECACHEUPDATE_CID, false, NULL, nsOfflineCacheUpdateConstructor },
{ &kNS_LOCALHANDLERAPP_CID, false, NULL, PlatformLocalHandlerApp_tConstructor },
#ifdef MOZ_ENABLE_DBUS
{ &kNS_DBUSHANDLERAPP_CID, false, NULL, nsDBusHandlerAppConstructor },
#endif
{ &kNS_SHENTRY_CID, false, NULL, nsSHEntryConstructor },
{ &kNS_HISTORYENTRY_CID, false, NULL, nsSHEntryConstructor },
{ &kNS_SHTRANSACTION_CID, false, NULL, nsSHTransactionConstructor },
{ &kNS_SHISTORY_CID, false, NULL, nsSHistoryConstructor },
{ &kNS_SHISTORY_INTERNAL_CID, false, NULL, nsSHistoryConstructor },
{ &kNS_DOWNLOADHISTORY_CID, false, NULL, nsDownloadHistoryConstructor },
{ NULL }
};
// "docshell provider" to illustrate that this thing really *should*
// be dispensing docshells rather than webshells.
NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(docshell_provider, gDocShellModuleInfo,
Initialize, Shutdown)
const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
{ "@mozilla.org/docshell;1", &kNS_DOCSHELL_CID },
{ NS_URIFIXUP_CONTRACTID, &kNS_DEFAULTURIFIXUP_CID },
{ NS_WEBNAVIGATION_INFO_CONTRACTID, &kNS_WEBNAVIGATION_INFO_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "about", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifdef MOZ_CRASHREPORTER
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "plugins", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "mozilla", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "logo", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "license", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "addons", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "support", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_URI_LOADER_CONTRACTID, &kNS_URI_LOADER_CID },
{ NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &kNS_DOCUMENTLOADER_SERVICE_CID },
{ NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID },
{ NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID },
{ NS_MIMESERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID },
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default", &kNS_EXTERNALPROTOCOLHANDLER_CID },
{ NS_PREFETCHSERVICE_CONTRACTID, &kNS_PREFETCHSERVICE_CID },
{ NS_OFFLINECACHEUPDATESERVICE_CONTRACTID, &kNS_OFFLINECACHEUPDATESERVICE_CID },
{ NS_OFFLINECACHEUPDATE_CONTRACTID, &kNS_OFFLINECACHEUPDATE_CID },
{ NS_LOCALHANDLERAPP_CONTRACTID, &kNS_LOCALHANDLERAPP_CID },
#ifdef MOZ_ENABLE_DBUS
{ NS_DBUSHANDLERAPP_CONTRACTID, &kNS_DBUSHANDLERAPP_CID },
#endif
{ NS_SHENTRY_CONTRACTID, &kNS_SHENTRY_CID },
{ NS_HISTORYENTRY_CONTRACTID, &kNS_HISTORYENTRY_CID },
{ NS_SHTRANSACTION_CONTRACTID, &kNS_SHTRANSACTION_CID },
{ NS_SHISTORY_CONTRACTID, &kNS_SHISTORY_CID },
{ NS_SHISTORY_INTERNAL_CONTRACTID, &kNS_SHISTORY_INTERNAL_CID },
{ NS_DOWNLOADHISTORY_CONTRACTID, &kNS_DOWNLOADHISTORY_CID },
{ NULL }
};
static const mozilla::Module kDocShellModule = {
mozilla::Module::kVersion,
kDocShellCIDs,
kDocShellContracts,
NULL,
NULL,
Initialize,
Shutdown
};
NSMODULE_DEFN(docshell_provider) = &kDocShellModule;

View File

@ -37,7 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsEditingSession.h" // for the CID
#include "nsComposerController.h" // for the CID
@ -75,7 +75,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditorSpellCheck)
// Here we are creating the same object with two different contract IDs
// and then initializing it different.
// Basically, we need to tell the filter whether it is doing mail or not
static NS_METHOD
static nsresult
nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult, PRBool aIsForMail)
{
@ -97,7 +97,7 @@ nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
return rv;
}
static NS_METHOD
static nsresult
nsComposeTxtSrvFilterConstructorForComposer(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
@ -105,7 +105,7 @@ nsComposeTxtSrvFilterConstructorForComposer(nsISupports *aOuter,
return nsComposeTxtSrvFilterConstructor(aOuter, aIID, aResult, PR_FALSE);
}
static NS_METHOD
static nsresult
nsComposeTxtSrvFilterConstructorForMail(nsISupports *aOuter,
REFNSIID aIID,
void **aResult)
@ -148,7 +148,7 @@ CreateControllerWithSingletonCommandTable(const nsCID& inCommandTableCID, nsICon
// Here we make an instance of the controller that holds doc state commands.
// We set it up with a singleton command table.
static NS_METHOD
static nsresult
nsHTMLEditorDocStateControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
@ -161,7 +161,7 @@ nsHTMLEditorDocStateControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
// Tere we make an instance of the controller that holds composer commands.
// We set it up with a singleton command table.
static NS_METHOD
static nsresult
nsHTMLEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsCOMPtr<nsIController> controller;
@ -172,7 +172,7 @@ nsHTMLEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aRe
}
// Constructor for a command table that is pref-filled with HTML editor commands
static NS_METHOD
static nsresult
nsHTMLEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
@ -192,7 +192,7 @@ nsHTMLEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
// Constructor for a command table that is pref-filled with HTML editor doc state commands
static NS_METHOD
static nsresult
nsHTMLEditorDocStateCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
@ -210,47 +210,42 @@ nsHTMLEditorDocStateCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
return commandTable->QueryInterface(aIID, aResult);
}
////////////////////////////////////////////////////////////////////////
// Define a table of CIDs implemented by this module along with other
// information like the function to create an instance, contractid, and
// class name.
//
static const nsModuleComponentInfo components[] = {
NS_DEFINE_NAMED_CID(NS_HTMLEDITORCONTROLLER_CID);
NS_DEFINE_NAMED_CID(NS_EDITORDOCSTATECONTROLLER_CID);
NS_DEFINE_NAMED_CID(NS_HTMLEDITOR_COMMANDTABLE_CID);
NS_DEFINE_NAMED_CID(NS_HTMLEDITOR_DOCSTATE_COMMANDTABLE_CID);
NS_DEFINE_NAMED_CID(NS_EDITINGSESSION_CID);
NS_DEFINE_NAMED_CID(NS_EDITORSPELLCHECK_CID);
NS_DEFINE_NAMED_CID(NS_COMPOSERTXTSRVFILTER_CID);
NS_DEFINE_NAMED_CID(NS_COMPOSERTXTSRVFILTERMAIL_CID);
{ "HTML Editor Controller", NS_HTMLEDITORCONTROLLER_CID,
"@mozilla.org/editor/htmleditorcontroller;1",
nsHTMLEditorControllerConstructor, },
{ "HTML Editor DocState Controller", NS_EDITORDOCSTATECONTROLLER_CID,
"@mozilla.org/editor/editordocstatecontroller;1",
nsHTMLEditorDocStateControllerConstructor, },
{ "HTML Editor command table", NS_HTMLEDITOR_COMMANDTABLE_CID,
"", // no point using a contract-ID
nsHTMLEditorCommandTableConstructor, },
{ "HTML Editor doc state command table", NS_HTMLEDITOR_DOCSTATE_COMMANDTABLE_CID,
"", // no point using a contract-ID
nsHTMLEditorDocStateCommandTableConstructor, },
{ "Editing Session", NS_EDITINGSESSION_CID,
"@mozilla.org/editor/editingsession;1", nsEditingSessionConstructor, },
{ "Editor Spell Checker", NS_EDITORSPELLCHECK_CID,
"@mozilla.org/editor/editorspellchecker;1",
nsEditorSpellCheckConstructor,},
{ "TxtSrv Filter", NS_COMPOSERTXTSRVFILTER_CID,
COMPOSER_TXTSRVFILTER_CONTRACTID,
nsComposeTxtSrvFilterConstructorForComposer, },
{ "TxtSrv Filter For Mail", NS_COMPOSERTXTSRVFILTERMAIL_CID,
COMPOSER_TXTSRVFILTERMAIL_CONTRACTID,
nsComposeTxtSrvFilterConstructorForMail, },
static const mozilla::Module::CIDEntry kComposerCIDs[] = {
{ &kNS_HTMLEDITORCONTROLLER_CID, false, NULL, nsHTMLEditorControllerConstructor },
{ &kNS_EDITORDOCSTATECONTROLLER_CID, false, NULL, nsHTMLEditorDocStateControllerConstructor },
{ &kNS_HTMLEDITOR_COMMANDTABLE_CID, false, NULL, nsHTMLEditorCommandTableConstructor },
{ &kNS_HTMLEDITOR_DOCSTATE_COMMANDTABLE_CID, false, NULL, nsHTMLEditorDocStateCommandTableConstructor },
{ &kNS_EDITINGSESSION_CID, false, NULL, nsEditingSessionConstructor },
{ &kNS_EDITORSPELLCHECK_CID, false, NULL, nsEditorSpellCheckConstructor },
{ &kNS_COMPOSERTXTSRVFILTER_CID, false, NULL, nsComposeTxtSrvFilterConstructorForComposer },
{ &kNS_COMPOSERTXTSRVFILTERMAIL_CID, false, NULL, nsComposeTxtSrvFilterConstructorForMail },
{ NULL }
};
////////////////////////////////////////////////////////////////////////
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE(nsComposerModule, components)
static const mozilla::Module::ContractIDEntry kComposerContracts[] = {
{ "@mozilla.org/editor/htmleditorcontroller;1", &kNS_HTMLEDITORCONTROLLER_CID },
{ "@mozilla.org/editor/editordocstatecontroller;1", &kNS_EDITORDOCSTATECONTROLLER_CID },
{ "@mozilla.org/editor/editingsession;1", &kNS_EDITINGSESSION_CID },
{ "@mozilla.org/editor/editorspellchecker;1", &kNS_EDITORSPELLCHECK_CID },
{ COMPOSER_TXTSRVFILTER_CONTRACTID, &kNS_COMPOSERTXTSRVFILTER_CID },
{ COMPOSER_TXTSRVFILTERMAIL_CONTRACTID, &kNS_COMPOSERTXTSRVFILTERMAIL_CID },
{ NULL }
};
static const mozilla::Module kComposerModule = {
mozilla::Module::kVersion,
kComposerCIDs,
kComposerContracts
};
NSMODULE_DEFN(nsComposerModule) = &kComposerModule;

View File

@ -35,8 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsTransactionManagerCID.h"
#include "nsTransactionStack.h"
#include "nsTransactionManager.h"
@ -47,18 +46,21 @@
// NOTE: This creates an instance of objects by using the default constructor
//
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransactionManager)
NS_DEFINE_NAMED_CID(NS_TRANSACTIONMANAGER_CID);
////////////////////////////////////////////////////////////////////////
// Define a table of CIDs implemented by this module along with other
// information like the function to create an instance, contractid, and
// class name.
//
static const nsModuleComponentInfo components[] = {
{ "nsTransactionManager", NS_TRANSACTIONMANAGER_CID, NS_TRANSACTIONMANAGER_CONTRACTID, nsTransactionManagerConstructor },
static const mozilla::Module::CIDEntry kTxMgrCIDs[] = {
{ &kNS_TRANSACTIONMANAGER_CID, false, NULL, nsTransactionManagerConstructor },
{ NULL }
};
////////////////////////////////////////////////////////////////////////
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE(nsTransactionManagerModule, components)
static const mozilla::Module::ContractIDEntry kTxMgrContracts[] = {
{ NS_TRANSACTIONMANAGER_CONTRACTID, &kNS_TRANSACTIONMANAGER_CID },
{ NULL }
};
static const mozilla::Module kTxMgrModule = {
mozilla::Module::kVersion,
kTxMgrCIDs,
kTxMgrContracts
};
NSMODULE_DEFN(nsTransactionManagerModule) = &kTxMgrModule;

View File

@ -37,10 +37,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIModule.h"
#include "mozilla/ModuleUtils.h"
#include "nsIServiceManager.h"
#include "nsIGenericFactory.h"
#include "nsICategoryManager.h"
#include "nsXPIDLString.h"
#include "nsEmbedCID.h"
@ -55,56 +53,37 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowser)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserContentPolicy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandHandler)
static NS_METHOD
RegisterContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath,
const char *registryLocation, const char *componentType,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catman =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsXPIDLCString previous;
return catman->AddCategoryEntry("content-policy",
NS_WEBBROWSERCONTENTPOLICY_CONTRACTID,
NS_WEBBROWSERCONTENTPOLICY_CONTRACTID,
PR_TRUE, PR_TRUE, getter_Copies(previous));
}
NS_DEFINE_NAMED_CID(NS_WEBBROWSER_CID);
NS_DEFINE_NAMED_CID(NS_COMMANDHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_WEBBROWSERCONTENTPOLICY_CID);
static NS_METHOD
UnregisterContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath,
const char *registryLocation,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catman =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
return catman->DeleteCategoryEntry("content-policy",
NS_WEBBROWSERCONTENTPOLICY_CONTRACTID,
PR_TRUE);
}
// Component Table
static const nsModuleComponentInfo components[] =
{
{ "WebBrowser Component", NS_WEBBROWSER_CID,
NS_WEBBROWSER_CONTRACTID, nsWebBrowserConstructor },
{ "CommandHandler Component", NS_COMMANDHANDLER_CID,
NS_COMMANDHANDLER_CONTRACTID, nsCommandHandlerConstructor },
{ "nsIWebBrowserSetup content policy enforcer",
NS_WEBBROWSERCONTENTPOLICY_CID,
NS_WEBBROWSERCONTENTPOLICY_CONTRACTID,
nsWebBrowserContentPolicyConstructor,
RegisterContentPolicy, UnregisterContentPolicy }
static const mozilla::Module::CIDEntry kWebBrowserCIDs[] = {
{ &kNS_WEBBROWSER_CID, false, NULL, nsWebBrowserConstructor },
{ &kNS_COMMANDHANDLER_CID, false, NULL, nsCommandHandlerConstructor },
{ &kNS_WEBBROWSERCONTENTPOLICY_CID, false, NULL, nsWebBrowserContentPolicyConstructor },
{ NULL }
};
static const mozilla::Module::ContractIDEntry kWebBrowserContracts[] = {
{ NS_WEBBROWSER_CONTRACTID, &kNS_WEBBROWSER_CID },
{ NS_COMMANDHANDLER_CONTRACTID, &kNS_COMMANDHANDLER_CID },
{ NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, &kNS_WEBBROWSERCONTENTPOLICY_CID },
{ NULL }
};
// NSGetModule implementation.
static const mozilla::Module::CategoryEntry kWebBrowserCategories[] = {
{ "content-policy", NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, NS_WEBBROWSERCONTENTPOLICY_CONTRACTID },
{ NULL }
};
NS_IMPL_NSGETMODULE(Browser_Embedding_Module, components)
static const mozilla::Module kWebBrowserModule = {
mozilla::Module::kVersion,
kWebBrowserCIDs,
kWebBrowserContracts,
kWebBrowserCategories
};
NSMODULE_DEFN(Browser_Embedding_Module) = &kWebBrowserModule;

View File

@ -45,7 +45,6 @@
#include "nsWebBrowser.h"
// Helper Classes
#include "nsIGenericFactory.h"
#include "nsStyleCoord.h"
#include "nsSize.h"
#include "nsHTMLReflowState.h"

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsDialogParamBlock.h"
#include "nsPromptService.h"
#include "nsWindowWatcher.h"
@ -90,7 +90,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBaseCommandController)
{0x88, 0xfa, 0x44, 0x90, 0xd4, 0x23, 0xa8, 0xef} \
}
static NS_METHOD
static nsresult
nsDefaultPromptConstructor(nsISupports *outer, const nsIID &iid, void **result)
{
if (outer)
@ -104,7 +104,7 @@ nsDefaultPromptConstructor(nsISupports *outer, const nsIID &iid, void **result)
return prompt->QueryInterface(iid, result);
}
static NS_METHOD
static nsresult
nsDefaultAuthPromptConstructor(nsISupports *outer, const nsIID &iid, void **result)
{
if (outer)
@ -128,30 +128,84 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintingPromptService, Init)
#endif
#endif
static const nsModuleComponentInfo gComponents[] = {
#ifdef MOZ_XUL
{ "Dialog ParamBlock", NS_DIALOGPARAMBLOCK_CID, NS_DIALOGPARAMBLOCK_CONTRACTID, nsDialogParamBlockConstructor },
{ "Prompt Service", NS_PROMPTSERVICE_CID, NS_PROMPTSERVICE_CONTRACTID, nsPromptServiceConstructor },
NS_DEFINE_NAMED_CID(NS_DIALOGPARAMBLOCK_CID);
NS_DEFINE_NAMED_CID(NS_PROMPTSERVICE_CID);
#ifdef NS_PRINTING
#ifndef WINCE
{ "Printing Prompt Service", NS_PRINTINGPROMPTSERVICE_CID, NS_PRINTINGPROMPTSERVICE_CONTRACTID, nsPrintingPromptServiceConstructor },
NS_DEFINE_NAMED_CID(NS_PRINTINGPROMPTSERVICE_CID);
#endif
#endif
#endif
{ "Window Watcher", NS_WINDOWWATCHER_CID, NS_WINDOWWATCHER_CONTRACTID, nsWindowWatcherConstructor },
{ "Window Watcher", NS_WINDOWWATCHER_CID, NS_AUTHPROMPT_ADAPTER_FACTORY_CONTRACTID, nsWindowWatcherConstructor },
{ "Find", NS_FIND_CID, NS_FIND_CONTRACTID, nsFindConstructor },
{ "WebBrowserFind", NS_WEB_BROWSER_FIND_CID, NS_WEB_BROWSER_FIND_CONTRACTID, nsWebBrowserFindConstructor },
{ NS_APPSTARTUPNOTIFIER_CLASSNAME, NS_APPSTARTUPNOTIFIER_CID, NS_APPSTARTUPNOTIFIER_CONTRACTID, nsAppStartupNotifierConstructor },
{ "WebBrowserPersist Component", NS_WEBBROWSERPERSIST_CID, NS_WEBBROWSERPERSIST_CONTRACTID, nsWebBrowserPersistConstructor },
{ "Controller Command Table", NS_CONTROLLERCOMMANDTABLE_CID, NS_CONTROLLERCOMMANDTABLE_CONTRACTID, nsControllerCommandTableConstructor },
{ "Command Manager", NS_COMMAND_MANAGER_CID, NS_COMMAND_MANAGER_CONTRACTID, nsCommandManagerConstructor },
{ "Command Params", NS_COMMAND_PARAMS_CID, NS_COMMAND_PARAMS_CONTRACTID, nsCommandParamsConstructor },
{ "Command Group", NS_CONTROLLER_COMMAND_GROUP_CID, NS_CONTROLLER_COMMAND_GROUP_CONTRACTID, nsControllerCommandGroupConstructor },
{ "Base Command Controller", NS_BASECOMMANDCONTROLLER_CID, NS_BASECOMMANDCONTROLLER_CONTRACTID, nsBaseCommandControllerConstructor },
{ NS_DEFAULTPROMPT_CLASSNAME, NS_DEFAULTPROMPT_CID, NS_DEFAULTPROMPT_CONTRACTID, nsDefaultPromptConstructor },
{ NS_DEFAULTAUTHPROMPT_CLASSNAME, NS_DEFAULTAUTHPROMPT_CID, NS_DEFAULTAUTHPROMPT_CONTRACTID, nsDefaultAuthPromptConstructor }
NS_DEFINE_NAMED_CID(NS_WINDOWWATCHER_CID);
NS_DEFINE_NAMED_CID(NS_FIND_CID);
NS_DEFINE_NAMED_CID(NS_WEB_BROWSER_FIND_CID);
NS_DEFINE_NAMED_CID(NS_APPSTARTUPNOTIFIER_CID);
NS_DEFINE_NAMED_CID(NS_WEBBROWSERPERSIST_CID);
NS_DEFINE_NAMED_CID(NS_CONTROLLERCOMMANDTABLE_CID);
NS_DEFINE_NAMED_CID(NS_COMMAND_MANAGER_CID);
NS_DEFINE_NAMED_CID(NS_COMMAND_PARAMS_CID);
NS_DEFINE_NAMED_CID(NS_CONTROLLER_COMMAND_GROUP_CID);
NS_DEFINE_NAMED_CID(NS_BASECOMMANDCONTROLLER_CID);
NS_DEFINE_NAMED_CID(NS_DEFAULTPROMPT_CID);
NS_DEFINE_NAMED_CID(NS_DEFAULTAUTHPROMPT_CID);
static const mozilla::Module::CIDEntry kEmbeddingCIDs[] = {
#ifdef MOZ_XUL
{ &kNS_DIALOGPARAMBLOCK_CID, false, NULL, nsDialogParamBlockConstructor },
{ &kNS_PROMPTSERVICE_CID, false, NULL, nsPromptServiceConstructor },
#ifdef NS_PRINTING
#ifndef WINCE
{ &kNS_PRINTINGPROMPTSERVICE_CID, false, NULL, nsPrintingPromptServiceConstructor },
#endif
#endif
#endif
{ &kNS_WINDOWWATCHER_CID, false, NULL, nsWindowWatcherConstructor },
{ &kNS_FIND_CID, false, NULL, nsFindConstructor },
{ &kNS_WEB_BROWSER_FIND_CID, false, NULL, nsWebBrowserFindConstructor },
{ &kNS_APPSTARTUPNOTIFIER_CID, false, NULL, nsAppStartupNotifierConstructor },
{ &kNS_WEBBROWSERPERSIST_CID, false, NULL, nsWebBrowserPersistConstructor },
{ &kNS_CONTROLLERCOMMANDTABLE_CID, false, NULL, nsControllerCommandTableConstructor },
{ &kNS_COMMAND_MANAGER_CID, false, NULL, nsCommandManagerConstructor },
{ &kNS_COMMAND_PARAMS_CID, false, NULL, nsCommandParamsConstructor },
{ &kNS_CONTROLLER_COMMAND_GROUP_CID, false, NULL, nsControllerCommandGroupConstructor },
{ &kNS_BASECOMMANDCONTROLLER_CID, false, NULL, nsBaseCommandControllerConstructor },
{ &kNS_DEFAULTPROMPT_CID, false, NULL, nsDefaultPromptConstructor },
{ &kNS_DEFAULTAUTHPROMPT_CID, false, NULL, nsDefaultAuthPromptConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(embedcomponents, gComponents)
static const mozilla::Module::ContractIDEntry kEmbeddingContracts[] = {
#ifdef MOZ_XUL
{ NS_DIALOGPARAMBLOCK_CONTRACTID, &kNS_DIALOGPARAMBLOCK_CID },
{ NS_PROMPTSERVICE_CONTRACTID, &kNS_PROMPTSERVICE_CID },
#ifdef NS_PRINTING
#ifndef WINCE
{ NS_PRINTINGPROMPTSERVICE_CONTRACTID, &kNS_PRINTINGPROMPTSERVICE_CID },
#endif
#endif
#endif
{ NS_WINDOWWATCHER_CONTRACTID, &kNS_WINDOWWATCHER_CID },
{ NS_AUTHPROMPT_ADAPTER_FACTORY_CONTRACTID, &kNS_WINDOWWATCHER_CID },
{ NS_FIND_CONTRACTID, &kNS_FIND_CID },
{ NS_WEB_BROWSER_FIND_CONTRACTID, &kNS_WEB_BROWSER_FIND_CID },
{ NS_APPSTARTUPNOTIFIER_CONTRACTID, &kNS_APPSTARTUPNOTIFIER_CID },
{ NS_WEBBROWSERPERSIST_CONTRACTID, &kNS_WEBBROWSERPERSIST_CID },
{ NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &kNS_CONTROLLERCOMMANDTABLE_CID },
{ NS_COMMAND_MANAGER_CONTRACTID, &kNS_COMMAND_MANAGER_CID },
{ NS_COMMAND_PARAMS_CONTRACTID, &kNS_COMMAND_PARAMS_CID },
{ NS_CONTROLLER_COMMAND_GROUP_CONTRACTID, &kNS_CONTROLLER_COMMAND_GROUP_CID },
{ NS_BASECOMMANDCONTROLLER_CONTRACTID, &kNS_BASECOMMANDCONTROLLER_CID },
{ NS_DEFAULTPROMPT_CONTRACTID, &kNS_DEFAULTPROMPT_CID },
{ NS_DEFAULTAUTHPROMPT_CONTRACTID, &kNS_DEFAULTAUTHPROMPT_CID },
{ NULL }
};
static const mozilla::Module kEmbeddingModule = {
mozilla::Module::kVersion,
kEmbeddingCIDs,
kEmbeddingContracts
};
NSMODULE_DEFN(embedcomponents) = &kEmbeddingModule;

View File

@ -66,7 +66,6 @@
#include "nsIScreen.h"
#include "nsIScreenManager.h"
#include "nsIScriptContext.h"
#include "nsIGenericFactory.h"
#include "nsIJSContextStack.h"
#include "nsIObserverService.h"
#include "nsIScriptGlobalObject.h"

View File

@ -34,7 +34,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsAuth.h"
//-----------------------------------------------------------------------------
@ -71,7 +71,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpNegotiateAuth)
#if defined( USE_SSPI )
#include "nsAuthSSPI.h"
static NS_METHOD
static nsresult
nsSysNTLMAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
{
if (outer)
@ -87,7 +87,7 @@ nsSysNTLMAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
return rv;
}
static NS_METHOD
static nsresult
nsKerbSSPIAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
{
if (outer)
@ -138,7 +138,7 @@ nsKerbSSPIAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
}
#include "nsAuthSambaNTLM.h"
static NS_METHOD
static nsresult
nsSambaNTLMAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
{
if (outer)
@ -159,7 +159,7 @@ nsSambaNTLMAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
#endif
static NS_METHOD
static nsresult
nsKerbGSSAPIAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
{
if (outer)
@ -175,7 +175,7 @@ nsKerbGSSAPIAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
return rv;
}
static NS_METHOD
static nsresult
nsGSSAPIAuthConstructor(nsISupports *outer, REFNSIID iid, void **result)
{
if (outer)
@ -207,52 +207,47 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAuthSSPI)
#include "nsAuthSASL.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAuthSASL)
//-----------------------------------------------------------------------------
static const nsModuleComponentInfo components[] = {
{ "nsAuthKerbGSS",
NS_GSSAUTH_CID,
NS_AUTH_MODULE_CONTRACTID_PREFIX "kerb-gss",
nsKerbGSSAPIAuthConstructor
},
{ "nsAuthNegoGSSAPI",
NS_NEGOTIATEAUTH_CID,
NS_AUTH_MODULE_CONTRACTID_PREFIX "negotiate-gss",
nsGSSAPIAuthConstructor
},
NS_DEFINE_NAMED_CID(NS_GSSAUTH_CID);
NS_DEFINE_NAMED_CID(NS_NEGOTIATEAUTH_CID);
#if defined( USE_SSPI )
{ "nsAuthNegoSSPI",
NS_NEGOTIATEAUTHSSPI_CID,
NS_AUTH_MODULE_CONTRACTID_PREFIX "negotiate-sspi",
nsAuthSSPIConstructor
},
{ "nsAuthKerbSSPI",
NS_KERBAUTHSSPI_CID,
NS_AUTH_MODULE_CONTRACTID_PREFIX "kerb-sspi",
nsKerbSSPIAuthConstructor
},
{ "nsAuthSYSNTLM",
NS_SYSNTLMAUTH_CID,
NS_AUTH_MODULE_CONTRACTID_PREFIX "sys-ntlm",
nsSysNTLMAuthConstructor
},
NS_DEFINE_NAMED_CID(NS_NEGOTIATEAUTHSSPI_CID);
NS_DEFINE_NAMED_CID(NS_KERBAUTHSSPI_CID);
NS_DEFINE_NAMED_CID(NS_SYSNTLMAUTH_CID);
#else
{ "nsAuthSambaNTLM",
NS_SAMBANTLMAUTH_CID,
NS_AUTH_MODULE_CONTRACTID_PREFIX "sys-ntlm",
nsSambaNTLMAuthConstructor
},
NS_DEFINE_NAMED_CID(NS_SAMBANTLMAUTH_CID);
#endif
{ "nsHttpNegotiateAuth",
NS_HTTPNEGOTIATEAUTH_CID,
NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "negotiate",
nsHttpNegotiateAuthConstructor
},
{ "nsAuthSASL",
NS_AUTHSASL_CID,
NS_AUTH_MODULE_CONTRACTID_PREFIX "sasl-gssapi",
nsAuthSASLConstructor
}
NS_DEFINE_NAMED_CID(NS_HTTPNEGOTIATEAUTH_CID);
NS_DEFINE_NAMED_CID(NS_AUTHSASL_CID);
static const mozilla::Module::CIDEntry kAuthCIDs[] = {
{ &kNS_GSSAUTH_CID, false, NULL, nsKerbGSSAPIAuthConstructor },
{ &kNS_NEGOTIATEAUTH_CID, false, NULL, nsGSSAPIAuthConstructor },
#if defined( USE_SSPI )
{ &kNS_NEGOTIATEAUTHSSPI_CID, false, NULL, nsAuthSSPIConstructor },
{ &kNS_KERBAUTHSSPI_CID, false, NULL, nsKerbSSPIAuthConstructor },
{ &kNS_SYSNTLMAUTH_CID, false, NULL, nsSysNTLMAuthConstructor },
#else
{ &kNS_SAMBANTLMAUTH_CID, false, NULL, nsSambaNTLMAuthConstructor },
#endif
{ &kNS_HTTPNEGOTIATEAUTH_CID, false, NULL, nsHttpNegotiateAuthConstructor },
{ &kNS_AUTHSASL_CID, false, NULL, nsAuthSASLConstructor },
{ NULL }
};
static const mozilla::Module::ContractIDEntry kAuthContracts[] = {
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "kerb-gss", &kNS_GSSAUTH_CID },
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "negotiate-gss", &kNS_NEGOTIATEAUTH_CID },
#if defined( USE_SSPI )
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "negotiate-sspi", &kNS_NEGOTIATEAUTHSSPI_CID },
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "kerb-sspi", &kNS_KERBAUTHSSPI_CID },
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "sys-ntlm", &kNS_SYSNTLMAUTH_CID },
#else
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "sys-ntlm", &kNS_SAMBANTLMAUTH_CID },
#endif
{ NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "negotiate", &kNS_HTTPNEGOTIATEAUTH_CID },
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "sasl-gssapi", &kNS_AUTHSASL_CID },
{ NULL }
};
//-----------------------------------------------------------------------------
@ -261,7 +256,7 @@ PRLogModuleInfo *gNegotiateLog;
// setup nspr logging ...
static nsresult
InitNegotiateAuth(nsIModule *self)
InitNegotiateAuth()
{
gNegotiateLog = PR_NewLogModule("negotiateauth");
return NS_OK;
@ -271,10 +266,19 @@ InitNegotiateAuth(nsIModule *self)
#endif
static void
DestroyNegotiateAuth(nsIModule *self)
DestroyNegotiateAuth()
{
nsAuthGSSAPI::Shutdown();
}
NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(nsAuthModule, components,
InitNegotiateAuth, DestroyNegotiateAuth)
static const mozilla::Module kAuthModule = {
mozilla::Module::kVersion,
kAuthCIDs,
kAuthContracts,
NULL,
NULL,
InitNegotiateAuth,
DestroyNegotiateAuth
};
NSMODULE_DEFN(nsAuthModule) = &kAuthModule;

View File

@ -36,8 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsIServiceManager.h"
#include "nsPermissionManager.h"
#include "nsPopupWindowManager.h"
@ -52,28 +51,32 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPopupWindowManager, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCookiePermission, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCookiePromptService)
// The list of components we register
static const nsModuleComponentInfo components[] = {
{ "PermissionManager",
NS_PERMISSIONMANAGER_CID,
NS_PERMISSIONMANAGER_CONTRACTID,
nsPermissionManagerConstructor
},
{ "PopupWindowManager",
NS_POPUPWINDOWMANAGER_CID,
NS_POPUPWINDOWMANAGER_CONTRACTID,
nsPopupWindowManagerConstructor
},
{ "CookiePromptService",
NS_COOKIEPROMPTSERVICE_CID,
NS_COOKIEPROMPTSERVICE_CONTRACTID,
nsCookiePromptServiceConstructor
},
{ "CookiePermission",
NS_COOKIEPERMISSION_CID,
NS_COOKIEPERMISSION_CONTRACTID,
nsCookiePermissionConstructor
}
NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_POPUPWINDOWMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_COOKIEPROMPTSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_COOKIEPERMISSION_CID);
static const mozilla::Module::CIDEntry kCookieCIDs[] = {
{ &kNS_PERMISSIONMANAGER_CID, false, NULL, nsPermissionManagerConstructor },
{ &kNS_POPUPWINDOWMANAGER_CID, false, NULL, nsPopupWindowManagerConstructor },
{ &kNS_COOKIEPROMPTSERVICE_CID, false, NULL, nsCookiePromptServiceConstructor },
{ &kNS_COOKIEPERMISSION_CID, false, NULL, nsCookiePermissionConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(nsCookieModule, components)
static const mozilla::Module::ContractIDEntry kCookieContracts[] = {
{ NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID },
{ NS_POPUPWINDOWMANAGER_CONTRACTID, &kNS_POPUPWINDOWMANAGER_CID },
{ NS_COOKIEPROMPTSERVICE_CONTRACTID, &kNS_COOKIEPROMPTSERVICE_CID },
{ NS_COOKIEPERMISSION_CONTRACTID, &kNS_COOKIEPERMISSION_CID },
{ NULL }
};
static const mozilla::Module kCookieModule = {
mozilla::Module::kVersion,
kCookieCIDs,
kCookieContracts
};
NSMODULE_DEFN(nsCookieModule) = &kCookieModule;

View File

@ -34,55 +34,36 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsIServiceManager.h"
#include "nsContentBlocker.h"
#include "nsXPIDLString.h"
#include "nsICategoryManager.h"
// Define the constructor function for the objects
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsContentBlocker, Init)
static NS_METHOD
RegisterContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath,
const char *registryLocation, const char *componentType,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catman =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsXPIDLCString previous;
return catman->AddCategoryEntry("content-policy",
NS_CONTENTBLOCKER_CONTRACTID,
NS_CONTENTBLOCKER_CONTRACTID,
PR_TRUE, PR_TRUE, getter_Copies(previous));
}
NS_DEFINE_NAMED_CID(NS_CONTENTBLOCKER_CID);
static NS_METHOD
UnregisterContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath,
const char *registryLocation,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catman =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
return catman->DeleteCategoryEntry("content-policy",
NS_CONTENTBLOCKER_CONTRACTID,
PR_TRUE);
}
// The list of components we register
static const nsModuleComponentInfo components[] = {
{ "ContentBlocker",
NS_CONTENTBLOCKER_CID,
NS_CONTENTBLOCKER_CONTRACTID,
nsContentBlockerConstructor,
RegisterContentPolicy, UnregisterContentPolicy
}
static const mozilla::Module::CIDEntry kPermissionsCIDs[] = {
{ &kNS_CONTENTBLOCKER_CID, false, NULL, nsContentBlockerConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(nsPermissionsModule, components)
static const mozilla::Module::ContractIDEntry kPermissionsContracts[] = {
{ NS_CONTENTBLOCKER_CONTRACTID, &kNS_CONTENTBLOCKER_CID },
{ NULL }
};
static const mozilla::Module::CategoryEntry kPermissionsCategories[] = {
{ "content-policy", NS_CONTENTBLOCKER_CONTRACTID, NS_CONTENTBLOCKER_CONTRACTID },
{ NULL }
};
static const mozilla::Module kPermissionsModule = {
mozilla::Module::kVersion,
kPermissionsCIDs,
kPermissionsContracts,
kPermissionsCategories
};
NSMODULE_DEFN(nsPermissionsModule) = &kPermissionsModule;

View File

@ -36,11 +36,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsAutoConfig.h"
#include "nsReadConfig.h"
#include "nsIAppStartupNotifier.h"
#include "nsICategoryManager.h"
#if defined(MOZ_LDAP_XPCOM)
#include "nsLDAPSyncQuery.h"
#endif
@ -51,70 +50,40 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsReadConfig, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPSyncQuery)
#endif
// Registering nsReadConfig module as part of the app-startup category to get
// it instantiated.
static NS_METHOD
RegisterReadConfig(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager>
categoryManager(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = categoryManager->AddCategoryEntry("pref-config-startup",
"ReadConfig Module",
NS_READCONFIG_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
}
return rv;
}
static NS_METHOD
UnRegisterReadConfig(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager>
categoryManager(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = categoryManager->DeleteCategoryEntry(APPSTARTUP_CATEGORY,
"ReadConfig Module", PR_TRUE);
}
return rv;
}
// The list of components we register
static const nsModuleComponentInfo components[] =
{
{
NS_AUTOCONFIG_CLASSNAME,
NS_AUTOCONFIG_CID,
NS_AUTOCONFIG_CONTRACTID,
nsAutoConfigConstructor
},
{
NS_READCONFIG_CLASSNAME,
NS_READCONFIG_CID,
NS_READCONFIG_CONTRACTID,
nsReadConfigConstructor,
RegisterReadConfig,
UnRegisterReadConfig
},
NS_DEFINE_NAMED_CID(NS_AUTOCONFIG_CID);
NS_DEFINE_NAMED_CID(NS_READCONFIG_CID);
#if defined(MOZ_LDAP_XPCOM)
{
"LDAPSyncQuery module",
NS_LDAPSYNCQUERY_CID,
"@mozilla.org/ldapsyncquery;1",
nsLDAPSyncQueryConstructor
},
NS_DEFINE_NAMED_CID(NS_LDAPSYNCQUERY_CID);
#endif
static const mozilla::Module::CIDEntry kAutoConfigCIDs[] = {
{ &kNS_AUTOCONFIG_CID, false, NULL, nsAutoConfigConstructor },
{ &kNS_READCONFIG_CID, false, NULL, nsReadConfigConstructor },
#if defined(MOZ_LDAP_XPCOM)
{ &kNS_LDAPSYNCQUERY_CID, false, NULL, nsLDAPSyncQueryConstructor },
#endif
{ NULL }
};
NS_IMPL_NSGETMODULE(nsAutoConfigModule, components)
static const mozilla::Module::ContractIDEntry kAutoConfigContracts[] = {
{ NS_AUTOCONFIG_CONTRACTID, &kNS_AUTOCONFIG_CID },
{ NS_READCONFIG_CONTRACTID, &kNS_READCONFIG_CID },
#if defined(MOZ_LDAP_XPCOM)
{ "@mozilla.org/ldapsyncquery;1", &kNS_LDAPSYNCQUERY_CID },
#endif
{ NULL }
};
static const mozilla::Module::CategoryEntry kAutoConfigCategories[] = {
{ "pref-config-startup", "ReadConfig Module", NS_READCONFIG_CONTRACTID },
{ NULL }
};
static const mozilla::Module kAutoConfigModule = {
mozilla::Module::kVersion,
kAutoConfigCIDs,
kAutoConfigContracts,
kAutoConfigCategories
};
NSMODULE_DEFN(nsAutoConfigModule) = &kAutoConfigModule;

View File

@ -45,7 +45,6 @@
#include "nsIXPConnect.h"
#include "nsIJSRuntimeService.h"
#include "nsCOMPtr.h"
#include "nsIGenericFactory.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsString.h"

View File

@ -136,43 +136,5 @@ mozHunspellDirProvider::AppendingEnumerator::AppendingEnumerator
GetNext(nsnull);
}
NS_METHOD
mozHunspellDirProvider::Register(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catMan =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
if (!catMan)
return NS_ERROR_FAILURE;
rv = catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
"spellcheck-directory-provider",
kContractID, PR_TRUE, PR_TRUE, nsnull);
return rv;
}
NS_METHOD
mozHunspellDirProvider::Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char *aLoaderStr,
const nsModuleComponentInfo *aInfo)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catMan =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
if (!catMan)
return NS_ERROR_FAILURE;
rv = catMan->DeleteCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
"spellcheck-directory-provider",
PR_TRUE);
return rv;
}
char const *const
mozHunspellDirProvider::kContractID = "@mozilla.org/spellcheck/dir-provider;1";

View File

@ -37,7 +37,6 @@
#define mozHunspellDirProvider_h__
#include "nsIDirectoryService.h"
#include "nsIGenericFactory.h"
#include "nsISimpleEnumerator.h"
class mozHunspellDirProvider :
@ -48,15 +47,6 @@ public:
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
static NS_METHOD Register(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo);
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo);
static char const *const kContractID;
private:

View File

@ -35,7 +35,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#ifdef MOZ_MACBROWSER
#include "mozOSXSpell.h"
@ -60,12 +60,6 @@
0x9fe5d975, 0x9bd, 0x44aa, \
{ 0xa0, 0x1a, 0x66, 0x40, 0x2e, 0xa2, 0x86, 0x57} }
////////////////////////////////////////////////////////////////////////
// Define the constructor function for the objects
//
// NOTE: This creates an instance of objects by using the default constructor
//
#ifdef MOZ_MACBROWSER
NS_GENERIC_FACTORY_CONSTRUCTOR(mozOSXSpell)
#else
@ -83,7 +77,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(mozSpellI18NManager)
// CanEnableInlineSpellChecking caches the value so this will be faster (we
// have to run this code for every edit box we create, as well as for every
// right click in those edit boxes).
static NS_IMETHODIMP
static nsresult
mozInlineSpellCheckerConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
@ -112,63 +106,57 @@ mozInlineSpellCheckerConstructor(nsISupports *aOuter, REFNSIID aIID,
return rv;
}
////////////////////////////////////////////////////////////////////////
// Define a table of CIDs implemented by this module along with other
// information like the function to create an instance, contractid, and
// class name.
//
static const nsModuleComponentInfo components[] = {
#ifdef MOZ_MACBROWSER
{
"OSX Spell check service",
MOZ_OSXSPELL_CID,
MOZ_OSXSPELL_CONTRACTID,
mozOSXSpellConstructor
},
NS_DEFINE_NAMED_CID(MOZ_OSXSPELL_CID);
#else
{
"mozHunspell",
MOZ_HUNSPELL_CID,
MOZ_HUNSPELL_CONTRACTID,
mozHunspellConstructor
},
{
"mozHunspellDirProvider",
HUNSPELLDIRPROVIDER_CID,
mozHunspellDirProvider::kContractID,
mozHunspellDirProviderConstructor,
mozHunspellDirProvider::Register,
mozHunspellDirProvider::Unregister
},
NS_DEFINE_NAMED_CID(MOZ_HUNSPELL_CID);
NS_DEFINE_NAMED_CID(HUNSPELLDIRPROVIDER_CID);
#endif // MOZ_MACBROWSER
{
NULL,
NS_SPELLCHECKER_CID,
NS_SPELLCHECKER_CONTRACTID,
mozSpellCheckerConstructor
},
{
NULL,
MOZ_PERSONALDICTIONARY_CID,
MOZ_PERSONALDICTIONARY_CONTRACTID,
mozPersonalDictionaryConstructor
},
{
NULL,
MOZ_SPELLI18NMANAGER_CID,
MOZ_SPELLI18NMANAGER_CONTRACTID,
mozSpellI18NManagerConstructor
},
{
NULL,
MOZ_INLINESPELLCHECKER_CID,
MOZ_INLINESPELLCHECKER_CONTRACTID,
mozInlineSpellCheckerConstructor
}
NS_DEFINE_NAMED_CID(NS_SPELLCHECKER_CID);
NS_DEFINE_NAMED_CID(MOZ_PERSONALDICTIONARY_CID);
NS_DEFINE_NAMED_CID(MOZ_SPELLI18NMANAGER_CID);
NS_DEFINE_NAMED_CID(MOZ_INLINESPELLCHECKER_CID);
static const mozilla::Module::CIDEntry kSpellcheckCIDs[] = {
#ifdef MOZ_MACBROWSER
{ &kMOZ_OSXSPELL_CID, false, NULL, mozOSXSpellConstructor },
#else
{ &kMOZ_HUNSPELL_CID, false, NULL, mozHunspellConstructor },
{ &kHUNSPELLDIRPROVIDER_CID, false, NULL, mozHunspellDirProviderConstructor },
#endif // MOZ_MACBROWSER
{ &kNS_SPELLCHECKER_CID, false, NULL, mozSpellCheckerConstructor },
{ &kMOZ_PERSONALDICTIONARY_CID, false, NULL, mozPersonalDictionaryConstructor },
{ &kMOZ_SPELLI18NMANAGER_CID, false, NULL, mozSpellI18NManagerConstructor },
{ &kMOZ_INLINESPELLCHECKER_CID, false, NULL, mozInlineSpellCheckerConstructor },
{ NULL }
};
////////////////////////////////////////////////////////////////////////
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE(mozSpellCheckerModule, components)
static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = {
#ifdef MOZ_MACBROWSER
{ MOZ_OSXSPELL_CONTRACTID, &kMOZ_OSXSPELL_CID },
#else
{ MOZ_HUNSPELL_CONTRACTID, &kMOZ_HUNSPELL_CID },
{ mozHunspellDirProvider::kContractID, &kHUNSPELLDIRPROVIDER_CID },
#endif // MOZ_MACBROWSER
{ NS_SPELLCHECKER_CONTRACTID, &kNS_SPELLCHECKER_CID },
{ MOZ_PERSONALDICTIONARY_CONTRACTID, &kMOZ_PERSONALDICTIONARY_CID },
{ MOZ_SPELLI18NMANAGER_CONTRACTID, &kMOZ_SPELLI18NMANAGER_CID },
{ MOZ_INLINESPELLCHECKER_CONTRACTID, &kMOZ_INLINESPELLCHECKER_CID },
{ NULL }
};
static const mozilla::Module::CategoryEntry kSpellcheckCategories[] = {
#ifndef MOZ_MACBROWSER
{ XPCOM_DIRECTORY_PROVIDER_CATEGORY, "spellcheck-directory-provider", mozHunspellDirProvider::kContractID },
#endif
{ NULL }
};
const mozilla::Module kSpellcheckModule = {
mozilla::Module::kVersion,
kSpellcheckCIDs,
kSpellcheckContracts,
kSpellcheckCategories
};
NSMODULE_DEFN(mozSpellCheckerModule) = &kSpellcheckModule;

View File

@ -35,9 +35,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/ModuleUtils.h"
#include "nsICharsetAlias.h"
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nspr.h"
#include "nsString.h"
@ -46,11 +47,9 @@
#include "nsISupports.h"
#include "nsICategoryManager.h"
#include "nsIComponentManager.h"
#include "nsIFactory.h"
#include "nsIServiceManager.h"
#include "nsICharsetDetector.h"
#include "nsIStringCharsetDetector.h"
#include "nsIGenericFactory.h"
#include "nsUniversalDetector.h"
#include "nsUdetXPCOMWrapper.h"
@ -70,151 +69,73 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsZHPSMDetector)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsZHStringPSMDetector)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCJKPSMDetector)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCJKStringPSMDetector)
NS_DEFINE_NAMED_CID(NS_UNIVERSAL_DETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_UNIVERSAL_STRING_DETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_JA_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_JA_STRING_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_KO_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_KO_STRING_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_ZHTW_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_ZHTW_STRING_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_ZHCN_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_ZHCN_STRING_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_ZH_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_ZH_STRING_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_CJK_PSMDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_CJK_STRING_PSMDETECTOR_CID);
//----------------------------------------
static NS_METHOD
AddCategoryEntry(const char* category,
const char* key,
const char* value)
{
nsresult rv;
nsCOMPtr<nsICategoryManager>
categoryManager(do_GetService("@mozilla.org/categorymanager;1", &rv));
if (NS_FAILED(rv)) return rv;
return categoryManager->AddCategoryEntry(category, key, value,
PR_TRUE, PR_TRUE,
nsnull);
}
static NS_METHOD nsUniversalCharDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"universal_charset_detector",
info->mContractID);
}
static NS_METHOD
nsJAPSMDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"ja_parallel_state_machine",
info->mContractID);
}
static NS_METHOD
nsKOPSMDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"ko_parallel_state_machine",
info->mContractID);
}
static NS_METHOD
nsZHTWPSMDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"zhtw_parallel_state_machine",
info->mContractID);
}
static NS_METHOD
nsZHCNPSMDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"zhcn_parallel_state_machine",
info->mContractID);
}
static NS_METHOD
nsZHPSMDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"zh_parallel_state_machine",
info->mContractID);
}
static NS_METHOD
nsCJKPSMDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"cjk_parallel_state_machine",
info->mContractID);
}
// Component Table
static const nsModuleComponentInfo components[] =
{
{ "Universal Charset Detector", NS_UNIVERSAL_DETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "universal_charset_detector", nsUniversalXPCOMDetectorConstructor,
nsUniversalCharDetectorRegistrationProc, NULL},
{ "Universal String Charset Detector", NS_UNIVERSAL_STRING_DETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "universal_charset_detector", nsUniversalXPCOMStringDetectorConstructor,
NULL, NULL},
{ "PSM based Japanese Charset Detector", NS_JA_PSMDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "ja_parallel_state_machine", nsJAPSMDetectorConstructor,
nsJAPSMDetectorRegistrationProc, NULL},
{ "PSM based Japanese String Charset Detector", NS_JA_STRING_PSMDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "ja_parallel_state_machine", nsJAStringPSMDetectorConstructor,
NULL, NULL},
{ "PSM based Korean Charset Detector", NS_KO_PSMDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "ko_parallel_state_machine", nsKOPSMDetectorConstructor,
nsKOPSMDetectorRegistrationProc, NULL},
{ "PSM based Korean String Charset Detector", NS_KO_STRING_PSMDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "ko_parallel_state_machine", nsKOStringPSMDetectorConstructor,
NULL, NULL},
{ "PSM based Traditional Chinese Charset Detector", NS_ZHTW_PSMDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "zhtw_parallel_state_machine", nsZHTWPSMDetectorConstructor,
nsZHTWPSMDetectorRegistrationProc, NULL},
{ "PSM based Traditional Chinese String Charset Detector", NS_ZHTW_STRING_PSMDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "zhtw_parallel_state_machine", nsZHTWStringPSMDetectorConstructor,
NULL, NULL},
{ "PSM based Simplified Chinese Charset Detector", NS_ZHCN_PSMDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "zhcn_parallel_state_machine", nsZHCNPSMDetectorConstructor,
nsZHCNPSMDetectorRegistrationProc, NULL},
{ "PSM based Simplified Chinese String Charset Detector", NS_ZHCN_STRING_PSMDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "zhcn_parallel_state_machine", nsZHCNStringPSMDetectorConstructor,
NULL, NULL},
{ "PSM based Chinese Charset Detector", NS_ZH_PSMDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "zh_parallel_state_machine", nsZHPSMDetectorConstructor,
nsZHPSMDetectorRegistrationProc, NULL},
{ "PSM based Chinese String Charset Detector", NS_ZH_STRING_PSMDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "zh_parallel_state_machine", nsZHStringPSMDetectorConstructor,
NULL, NULL},
{ "PSM based CJK Charset Detector", NS_CJK_PSMDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine", nsCJKPSMDetectorConstructor,
nsCJKPSMDetectorRegistrationProc, NULL},
{ "PSM based CJK String Charset Detector", NS_CJK_STRING_PSMDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine", nsCJKStringPSMDetectorConstructor,
NULL, NULL},
static const mozilla::Module::CIDEntry kChardetCIDs[] = {
{ &kNS_UNIVERSAL_DETECTOR_CID, false, NULL, nsUniversalXPCOMDetectorConstructor },
{ &kNS_UNIVERSAL_STRING_DETECTOR_CID, false, NULL, nsUniversalXPCOMStringDetectorConstructor },
{ &kNS_JA_PSMDETECTOR_CID, false, NULL, nsJAPSMDetectorConstructor },
{ &kNS_JA_STRING_PSMDETECTOR_CID, false, NULL, nsJAStringPSMDetectorConstructor },
{ &kNS_KO_PSMDETECTOR_CID, false, NULL, nsKOPSMDetectorConstructor },
{ &kNS_KO_STRING_PSMDETECTOR_CID, false, NULL, nsKOStringPSMDetectorConstructor },
{ &kNS_ZHTW_PSMDETECTOR_CID, false, NULL, nsZHTWPSMDetectorConstructor },
{ &kNS_ZHTW_STRING_PSMDETECTOR_CID, false, NULL, nsZHTWStringPSMDetectorConstructor },
{ &kNS_ZHCN_PSMDETECTOR_CID, false, NULL, nsZHCNPSMDetectorConstructor },
{ &kNS_ZHCN_STRING_PSMDETECTOR_CID, false, NULL, nsZHCNStringPSMDetectorConstructor },
{ &kNS_ZH_PSMDETECTOR_CID, false, NULL, nsZHPSMDetectorConstructor },
{ &kNS_ZH_STRING_PSMDETECTOR_CID, false, NULL, nsZHStringPSMDetectorConstructor },
{ &kNS_CJK_PSMDETECTOR_CID, false, NULL, nsCJKPSMDetectorConstructor },
{ &kNS_CJK_STRING_PSMDETECTOR_CID, false, NULL, nsCJKStringPSMDetectorConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(nsUniversalCharDetModule, components)
static const mozilla::Module::ContractIDEntry kChardetContracts[] = {
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "universal_charset_detector", &kNS_UNIVERSAL_DETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "universal_charset_detector", &kNS_UNIVERSAL_STRING_DETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "ja_parallel_state_machine", &kNS_JA_PSMDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "ja_parallel_state_machine", &kNS_JA_STRING_PSMDETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "ko_parallel_state_machine", &kNS_KO_PSMDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "ko_parallel_state_machine", &kNS_KO_STRING_PSMDETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "zhtw_parallel_state_machine", &kNS_ZHTW_PSMDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "zhtw_parallel_state_machine", &kNS_ZHTW_STRING_PSMDETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "zhcn_parallel_state_machine", &kNS_ZHCN_PSMDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "zhcn_parallel_state_machine", &kNS_ZHCN_STRING_PSMDETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "zh_parallel_state_machine", &kNS_ZH_PSMDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "zh_parallel_state_machine", &kNS_ZH_STRING_PSMDETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine", &kNS_CJK_PSMDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine", &kNS_CJK_STRING_PSMDETECTOR_CID },
{ NULL }
};
static const mozilla::Module::CategoryEntry kChardetCategories[] = {
{ NS_CHARSET_DETECTOR_CATEGORY, "universal_charset_detector", NS_CHARSET_DETECTOR_CONTRACTID_BASE "universal_charset_detector" },
{ NS_CHARSET_DETECTOR_CATEGORY, "ja_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "ja_parallel_state_machine" },
{ NS_CHARSET_DETECTOR_CATEGORY, "ko_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "ko_parallel_state_machine" },
{ NS_CHARSET_DETECTOR_CATEGORY, "zhtw_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "zhtw_parallel_state_machine" },
{ NS_CHARSET_DETECTOR_CATEGORY, "zhcn_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "zhcn_parallel_state_machine" },
{ NS_CHARSET_DETECTOR_CATEGORY, "zh_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "zh_parallel_state_machine" },
{ NS_CHARSET_DETECTOR_CATEGORY, "cjk_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine" },
{ NULL }
};
static const mozilla::Module kChardetModule = {
mozilla::Module::kVersion,
kChardetCIDs,
kChardetContracts,
kChardetCategories
};
NSMODULE_DEFN(nsUniversalCharDetModule) = &kChardetModule;

View File

@ -171,6 +171,6 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsITheme, NS_ITHEME_IID)
// Creator function
extern NS_METHOD NS_NewNativeTheme(nsISupports *aOuter, REFNSIID aIID, void **aResult);
extern nsresult NS_NewNativeTheme(nsISupports *aOuter, REFNSIID aIID, void **aResult);
#endif

View File

@ -36,8 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "nsIModule.h"
#include "mozilla/ModuleUtils.h"
#include "nsCOMPtr.h"
#include "nsGfxCIID.h"
@ -56,7 +55,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesRenderingContext)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesRegion)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator)
static NS_IMETHODIMP nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
static nsresult
nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
@ -97,46 +97,54 @@ static NS_IMETHODIMP nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID
return rv;
}
static const nsModuleComponentInfo components[] =
{
{ "Thebes nsFontMetrics",
NS_FONT_METRICS_CID,
"@mozilla.org/gfx/fontmetrics;1",
nsThebesFontMetricsConstructor },
{ "Thebes Font Enumerator",
NS_FONT_ENUMERATOR_CID,
"@mozilla.org/gfx/fontenumerator;1",
nsThebesFontEnumeratorConstructor },
{ "Thebes Device Context",
NS_DEVICE_CONTEXT_CID,
"@mozilla.org/gfx/devicecontext;1",
nsThebesDeviceContextConstructor },
{ "Thebes Rendering Context",
NS_RENDERING_CONTEXT_CID,
"@mozilla.org/gfx/renderingcontext;1",
nsThebesRenderingContextConstructor },
{ "Thebes Region",
NS_REGION_CID,
"@mozilla.org/gfx/region/nsThebes;1",
nsThebesRegionConstructor },
{ "Scriptable Region",
NS_SCRIPTABLE_REGION_CID,
"@mozilla.org/gfx/region;1",
nsScriptableRegionConstructor },
NS_DEFINE_NAMED_CID(NS_FONT_METRICS_CID);
NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID);
NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_CID);
NS_DEFINE_NAMED_CID(NS_RENDERING_CONTEXT_CID);
NS_DEFINE_NAMED_CID(NS_REGION_CID);
NS_DEFINE_NAMED_CID(NS_SCRIPTABLE_REGION_CID);
static const mozilla::Module::CIDEntry kThebesCIDs[] = {
{ &kNS_FONT_METRICS_CID, false, NULL, nsThebesFontMetricsConstructor },
{ &kNS_FONT_ENUMERATOR_CID, false, NULL, nsThebesFontEnumeratorConstructor },
{ &kNS_DEVICE_CONTEXT_CID, false, NULL, nsThebesDeviceContextConstructor },
{ &kNS_RENDERING_CONTEXT_CID, false, NULL, nsThebesRenderingContextConstructor },
{ &kNS_REGION_CID, false, NULL, nsThebesRegionConstructor },
{ &kNS_SCRIPTABLE_REGION_CID, false, NULL, nsScriptableRegionConstructor },
{ NULL }
};
static const mozilla::Module::ContractIDEntry kThebesContracts[] = {
{ "@mozilla.org/gfx/fontmetrics;1", &kNS_FONT_METRICS_CID },
{ "@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID },
{ "@mozilla.org/gfx/devicecontext;1", &kNS_DEVICE_CONTEXT_CID },
{ "@mozilla.org/gfx/renderingcontext;1", &kNS_RENDERING_CONTEXT_CID },
{ "@mozilla.org/gfx/region/nsThebes;1", &kNS_REGION_CID },
{ "@mozilla.org/gfx/region;1", &kNS_SCRIPTABLE_REGION_CID },
{ NULL }
};
static nsresult
nsThebesGfxModuleCtor(nsIModule *self)
nsThebesGfxModuleCtor()
{
return gfxPlatform::Init();
}
static void
nsThebesGfxModuleDtor(nsIModule *self)
nsThebesGfxModuleDtor()
{
nsThebesDeviceContext::Shutdown();
gfxPlatform::Shutdown();
}
NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(nsGfxModule, components,
nsThebesGfxModuleCtor, nsThebesGfxModuleDtor)
static const mozilla::Module kThebesModule = {
mozilla::Module::kVersion,
kThebesCIDs,
kThebesContracts,
NULL,
NULL,
nsThebesGfxModuleCtor,
nsThebesGfxModuleDtor
};
NSMODULE_DEFN(nsGfxModule) = &kThebesModule;

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsCOMPtr.h"
#include "nsICategoryManager.h"
#include "nsIServiceManager.h"
@ -56,119 +56,124 @@
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSemanticUnitScanner)
static const nsModuleComponentInfo components[] =
{
// lwbrk
{ "Line Breaker", NS_LBRK_CID,
NS_LBRK_CONTRACTID, nsJISx4051LineBreakerConstructor},
{ "Word Breaker", NS_WBRK_CID,
NS_WBRK_CONTRACTID, nsSampleWordBreakerConstructor},
{ "Semantic Unit Scanner", NS_SEMANTICUNITSCANNER_CID,
NS_SEMANTICUNITSCANNER_CONTRACTID, nsSemanticUnitScannerConstructor},
// unicharutil
{ "Unichar Utility", NS_UNICHARUTIL_CID,
NS_UNICHARUTIL_CONTRACTID, nsCaseConversionImp2Constructor},
{ "Unichar Category Table", NS_UNICHARCATEGORY_CID,
NS_UNICHARCATEGORY_CONTRACTID, nsCategoryImpConstructor},
{ "Unicode To Entity Converter", NS_ENTITYCONVERTER_CID,
NS_ENTITYCONVERTER_CONTRACTID, nsEntityConverterConstructor },
{ "Unicode To Charset Converter", NS_SAVEASCHARSET_CID,
NS_SAVEASCHARSET_CONTRACTID, nsSaveAsCharsetConstructor},
{ "Japanese Hankaku To Zenkaku", NS_HANKAKUTOZENKAKU_CID,
NS_HANKAKUTOZENKAKU_CONTRACTID, CreateNewHankakuToZenkaku},
{ "Unicode Normlization", NS_UNICODE_NORMALIZER_CID,
NS_UNICODE_NORMALIZER_CONTRACTID, nsUnicodeNormalizerConstructor},
// strres
{ "String Bundle", NS_STRINGBUNDLESERVICE_CID, NS_STRINGBUNDLE_CONTRACTID,
nsStringBundleServiceConstructor},
{ "String Textfile Overrides", NS_STRINGBUNDLETEXTOVERRIDE_CID,
NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID,
nsStringBundleTextOverrideConstructor },
// locale
{ "nsLocaleService component",
NS_LOCALESERVICE_CID,
NS_LOCALESERVICE_CONTRACTID,
CreateLocaleService },
{ "Collation factory",
NS_COLLATIONFACTORY_CID,
NS_COLLATIONFACTORY_CONTRACTID,
nsCollationFactoryConstructor },
{ "Scriptable Date Format",
NS_SCRIPTABLEDATEFORMAT_CID,
NS_SCRIPTABLEDATEFORMAT_CONTRACTID,
NS_NewScriptableDateFormat },
{ "Language Atom Service",
NS_LANGUAGEATOMSERVICE_CID,
NS_LANGUAGEATOMSERVICE_CONTRACTID,
nsLanguageAtomServiceConstructor },
#ifdef XP_WIN
{ "Platform locale",
NS_WIN32LOCALE_CID,
NS_WIN32LOCALE_CONTRACTID,
nsIWin32LocaleImplConstructor },
{ "Collation",
NS_COLLATION_CID,
NS_COLLATION_CONTRACTID,
nsCollationWinConstructor },
{ "Date/Time formatter",
NS_DATETIMEFORMAT_CID,
NS_DATETIMEFORMAT_CONTRACTID,
nsDateTimeFormatWinConstructor },
NS_DEFINE_NAMED_CID(NS_LBRK_CID);
NS_DEFINE_NAMED_CID(NS_WBRK_CID);
NS_DEFINE_NAMED_CID(NS_SEMANTICUNITSCANNER_CID);
NS_DEFINE_NAMED_CID(NS_UNICHARUTIL_CID);
NS_DEFINE_NAMED_CID(NS_UNICHARCATEGORY_CID);
NS_DEFINE_NAMED_CID(NS_ENTITYCONVERTER_CID);
NS_DEFINE_NAMED_CID(NS_SAVEASCHARSET_CID);
NS_DEFINE_NAMED_CID(NS_HANKAKUTOZENKAKU_CID);
NS_DEFINE_NAMED_CID(NS_UNICODE_NORMALIZER_CID);
NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_STRINGBUNDLETEXTOVERRIDE_CID);
NS_DEFINE_NAMED_CID(NS_LOCALESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID);
NS_DEFINE_NAMED_CID(NS_SCRIPTABLEDATEFORMAT_CID);
NS_DEFINE_NAMED_CID(NS_LANGUAGEATOMSERVICE_CID);
#ifdef XP_WIN
NS_DEFINE_NAMED_CID(NS_WIN32LOCALE_CID);
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
#endif
#ifdef USE_UNIX_LOCALE
{ "Platform locale",
NS_POSIXLOCALE_CID,
NS_POSIXLOCALE_CONTRACTID,
nsPosixLocaleConstructor },
{ "Collation",
NS_COLLATION_CID,
NS_COLLATION_CONTRACTID,
nsCollationUnixConstructor },
{ "Date/Time formatter",
NS_DATETIMEFORMAT_CID,
NS_DATETIMEFORMAT_CONTRACTID,
nsDateTimeFormatUnixConstructor },
NS_DEFINE_NAMED_CID(NS_POSIXLOCALE_CID);
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
#endif
#ifdef USE_MAC_LOCALE
{ "Mac locale",
NS_MACLOCALE_CID,
NS_MACLOCALE_CONTRACTID,
nsMacLocaleConstructor },
{ "Collation",
NS_COLLATION_CID,
NS_COLLATION_CONTRACTID,
nsCollationMacUCConstructor },
{ "Date/Time formatter",
NS_DATETIMEFORMAT_CID,
NS_DATETIMEFORMAT_CONTRACTID,
nsDateTimeFormatMacConstructor },
NS_DEFINE_NAMED_CID(NS_MACLOCALE_CID);
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
#endif
#ifdef XP_OS2
NS_DEFINE_NAMED_CID(NS_OS2LOCALE_CID);
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
#endif
#ifdef XP_OS2
{ "OS/2 locale",
NS_OS2LOCALE_CID,
NS_OS2LOCALE_CONTRACTID,
nsOS2LocaleConstructor },
{ "Collation",
NS_COLLATION_CID,
NS_COLLATION_CONTRACTID,
nsCollationOS2Constructor },
{ "Date/Time formatter",
NS_DATETIMEFORMAT_CID,
NS_DATETIMEFORMAT_CONTRACTID,
nsDateTimeFormatOS2Constructor },
static const mozilla::Module::CIDEntry kIntlCIDs[] = {
{ &kNS_LBRK_CID, false, NULL, nsJISx4051LineBreakerConstructor },
{ &kNS_WBRK_CID, false, NULL, nsSampleWordBreakerConstructor },
{ &kNS_SEMANTICUNITSCANNER_CID, false, NULL, nsSemanticUnitScannerConstructor },
{ &kNS_UNICHARUTIL_CID, false, NULL, nsCaseConversionImp2Constructor },
{ &kNS_UNICHARCATEGORY_CID, false, NULL, nsCategoryImpConstructor },
{ &kNS_ENTITYCONVERTER_CID, false, NULL, nsEntityConverterConstructor },
{ &kNS_SAVEASCHARSET_CID, false, NULL, nsSaveAsCharsetConstructor },
{ &kNS_HANKAKUTOZENKAKU_CID, false, NULL, CreateNewHankakuToZenkaku },
{ &kNS_UNICODE_NORMALIZER_CID, false, NULL, nsUnicodeNormalizerConstructor },
{ &kNS_STRINGBUNDLESERVICE_CID, false, NULL, nsStringBundleServiceConstructor },
{ &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, NULL, nsStringBundleTextOverrideConstructor },
{ &kNS_LOCALESERVICE_CID, false, NULL, CreateLocaleService },
{ &kNS_COLLATIONFACTORY_CID, false, NULL, nsCollationFactoryConstructor },
{ &kNS_SCRIPTABLEDATEFORMAT_CID, false, NULL, NS_NewScriptableDateFormat },
{ &kNS_LANGUAGEATOMSERVICE_CID, false, NULL, nsLanguageAtomServiceConstructor },
#ifdef XP_WIN
{ &kNS_WIN32LOCALE_CID, false, NULL, nsIWin32LocaleImplConstructor },
{ &kNS_COLLATION_CID, false, NULL, nsCollationWinConstructor },
{ &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatWinConstructor },
#endif
#ifdef USE_UNIX_LOCALE
{ &kNS_POSIXLOCALE_CID, false, NULL, nsPosixLocaleConstructor },
{ &kNS_COLLATION_CID, false, NULL, nsCollationUnixConstructor },
{ &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatUnixConstructor },
#endif
#ifdef USE_MAC_LOCALE
{ &kNS_MACLOCALE_CID, false, NULL, nsMacLocaleConstructor },
{ &kNS_COLLATION_CID, false, NULL, nsCollationMacUCConstructor },
{ &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatMacConstructor },
#endif
#ifdef XP_OS2
{ &kNS_OS2LOCALE_CID, false, NULL, nsOS2LocaleConstructor },
{ &kNS_COLLATION_CID, false, NULL, nsCollationOS2Constructor },
{ &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatOS2Constructor },
#endif
{ NULL }
};
static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
{ NS_LBRK_CONTRACTID, &kNS_LBRK_CID },
{ NS_WBRK_CONTRACTID, &kNS_WBRK_CID },
{ NS_SEMANTICUNITSCANNER_CONTRACTID, &kNS_SEMANTICUNITSCANNER_CID },
{ NS_UNICHARUTIL_CONTRACTID, &kNS_UNICHARUTIL_CID },
{ NS_UNICHARCATEGORY_CONTRACTID, &kNS_UNICHARCATEGORY_CID },
{ NS_ENTITYCONVERTER_CONTRACTID, &kNS_ENTITYCONVERTER_CID },
{ NS_SAVEASCHARSET_CONTRACTID, &kNS_SAVEASCHARSET_CID },
{ NS_HANKAKUTOZENKAKU_CONTRACTID, &kNS_HANKAKUTOZENKAKU_CID },
{ NS_UNICODE_NORMALIZER_CONTRACTID, &kNS_UNICODE_NORMALIZER_CID },
{ NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID },
{ NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID, &kNS_STRINGBUNDLETEXTOVERRIDE_CID },
{ NS_LOCALESERVICE_CONTRACTID, &kNS_LOCALESERVICE_CID },
{ NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID },
{ NS_SCRIPTABLEDATEFORMAT_CONTRACTID, &kNS_SCRIPTABLEDATEFORMAT_CID },
{ NS_LANGUAGEATOMSERVICE_CONTRACTID, &kNS_LANGUAGEATOMSERVICE_CID },
#ifdef XP_WIN
{ NS_WIN32LOCALE_CONTRACTID, &kNS_WIN32LOCALE_CID },
{ NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
#endif
#ifdef USE_UNIX_LOCALE
{ NS_POSIXLOCALE_CONTRACTID, &kNS_POSIXLOCALE_CID },
{ NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
#endif
#ifdef USE_MAC_LOCALE
{ NS_MACLOCALE_CONTRACTID, &kNS_MACLOCALE_CID },
{ NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
#endif
#ifdef XP_OS2
{ NS_OS2LOCALE_CONTRACTID, &kNS_OS2LOCALE_CID },
{ NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
#endif
{ NULL }
};
NS_IMPL_NSGETMODULE(nsI18nModule, components)
static const mozilla::Module kIntlModule = {
mozilla::Module::kVersion,
kIntlCIDs,
kIntlContracts,
};
NSMODULE_DEFN(nsI18nModule) = &kIntlModule;

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -35,137 +35,74 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsCOMPtr.h"
#include "nsICategoryManager.h"
#include "nsIServiceManager.h"
#include "nsCharDetConstructors.h"
static NS_METHOD
AddCategoryEntry(const char* category,
const char* key,
const char* value)
{
nsresult rv;
nsCOMPtr<nsICategoryManager>
categoryManager(do_GetService("@mozilla.org/categorymanager;1", &rv));
if (NS_FAILED(rv)) return rv;
return categoryManager->AddCategoryEntry(category, key, value,
PR_TRUE, PR_TRUE,
nsnull);
}
static NS_METHOD
DeleteCategoryEntry(const char* category,
const char* key)
{
nsresult rv;
nsCOMPtr<nsICategoryManager>
categoryManager(do_GetService("@mozilla.org/categorymanager;1", &rv));
if (NS_FAILED(rv)) return rv;
return categoryManager->DeleteCategoryEntry(category, key, PR_TRUE);
}
static NS_METHOD
nsMetaCharsetObserverRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry("parser-service-category",
"Meta Charset Service",
NS_META_CHARSET_CONTRACTID);
}
static NS_METHOD
nsMetaCharsetObserverUnegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const nsModuleComponentInfo *info)
{
return DeleteCategoryEntry("parser-service-category",
"Meta Charset Service");
}
static NS_METHOD
nsDetectionAdaptorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY, "off", "off");
}
static NS_METHOD
nsRUProbDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"ruprob",
info->mContractID);
}
static NS_METHOD
nsUKProbDetectorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
return AddCategoryEntry(NS_CHARSET_DETECTOR_CATEGORY,
"ukprob",
info->mContractID);
}
static const nsModuleComponentInfo components[] =
{
{ "Meta Charset", NS_META_CHARSET_CID,
NS_META_CHARSET_CONTRACTID, nsMetaCharsetObserverConstructor,
nsMetaCharsetObserverRegistrationProc, nsMetaCharsetObserverUnegistrationProc,
NULL},
{ "Document Charset Info", NS_DOCUMENTCHARSETINFO_CID,
NS_DOCUMENTCHARSETINFO_CONTRACTID, nsDocumentCharsetInfoConstructor,
NULL, NULL},
{ "XML Encoding", NS_XML_ENCODING_CID,
NS_XML_ENCODING_CONTRACTID, nsXMLEncodingObserverConstructor,
NULL, NULL},
{ "Charset Detection Adaptor", NS_CHARSET_DETECTION_ADAPTOR_CID,
NS_CHARSET_DETECTION_ADAPTOR_CONTRACTID, nsDetectionAdaptorConstructor,
nsDetectionAdaptorRegistrationProc, NULL},
{ "Probability based Russian Charset Detector", NS_RU_PROBDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "ruprob", nsRUProbDetectorConstructor,
nsRUProbDetectorRegistrationProc, NULL},
{ "Probability based Ukrainian Charset Detector", NS_UK_PROBDETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "ukprob", nsUKProbDetectorConstructor,
nsUKProbDetectorRegistrationProc, NULL},
{ "Probability based Russian String Charset Detector", NS_RU_STRING_PROBDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "ruprob", nsRUStringProbDetectorConstructor,
NULL, NULL},
{ "Probability based Ukrainian String Charset Detector", NS_UK_STRING_PROBDETECTOR_CID,
NS_STRCDETECTOR_CONTRACTID_BASE "ukprob", nsUKStringProbDetectorConstructor,
NULL, NULL},
NS_DEFINE_NAMED_CID(NS_META_CHARSET_CID);
NS_DEFINE_NAMED_CID(NS_DOCUMENTCHARSETINFO_CID);
NS_DEFINE_NAMED_CID(NS_XML_ENCODING_CID);
NS_DEFINE_NAMED_CID(NS_CHARSET_DETECTION_ADAPTOR_CID);
NS_DEFINE_NAMED_CID(NS_RU_PROBDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_UK_PROBDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_RU_STRING_PROBDETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_UK_STRING_PROBDETECTOR_CID);
#ifdef INCLUDE_DBGDETECTOR
{ "Debugging Detector 1st block", NS_1STBLKDBG_DETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "1stblkdbg", ns1stBlkDbgDetectorConstructor,
NULL, NULL},
{ "Debugging Detector 2nd block", NS_2NDBLKDBG_DETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "2ndblkdbg", ns2ndBlkDbgDetectorConstructor,
NULL, NULL},
{ "Debugging Detector Last block", NS_LASTBLKDBG_DETECTOR_CID,
NS_CHARSET_DETECTOR_CONTRACTID_BASE "lastblkdbg", nsLastBlkDbgDetectorConstructor,
NULL, NULL},
NS_DEFINE_NAMED_CID(NS_1STBLKDBG_DETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_2NDBLKDBG_DETECTOR_CID);
NS_DEFINE_NAMED_CID(NS_LASTBLKDBG_DETECTOR_CID);
#endif /* INCLUDE_DBGDETECTOR */
static const mozilla::Module::CIDEntry kChardetCIDs[] = {
{ &kNS_META_CHARSET_CID, false, NULL, nsMetaCharsetObserverConstructor },
{ &kNS_DOCUMENTCHARSETINFO_CID, false, NULL, nsDocumentCharsetInfoConstructor },
{ &kNS_XML_ENCODING_CID, false, NULL, nsXMLEncodingObserverConstructor },
{ &kNS_CHARSET_DETECTION_ADAPTOR_CID, false, NULL, nsDetectionAdaptorConstructor },
{ &kNS_RU_PROBDETECTOR_CID, false, NULL, nsRUProbDetectorConstructor },
{ &kNS_UK_PROBDETECTOR_CID, false, NULL, nsUKProbDetectorConstructor },
{ &kNS_RU_STRING_PROBDETECTOR_CID, false, NULL, nsRUStringProbDetectorConstructor },
{ &kNS_UK_STRING_PROBDETECTOR_CID, false, NULL, nsUKStringProbDetectorConstructor },
#ifdef INCLUDE_DBGDETECTOR
{ &kNS_1STBLKDBG_DETECTOR_CID, false, NULL, ns1stBlkDbgDetectorConstructor },
{ &kNS_2NDBLKDBG_DETECTOR_CID, false, NULL, ns2ndBlkDbgDetectorConstructor },
{ &kNS_LASTBLKDBG_DETECTOR_CID, false, NULL, nsLastBlkDbgDetectorConstructor },
#endif /* INCLUDE_DBGDETECTOR */
{ NULL }
};
static const mozilla::Module::ContractIDEntry kChardetContracts[] = {
{ NS_META_CHARSET_CONTRACTID, &kNS_META_CHARSET_CID },
{ NS_DOCUMENTCHARSETINFO_CONTRACTID, &kNS_DOCUMENTCHARSETINFO_CID },
{ NS_XML_ENCODING_CONTRACTID, &kNS_XML_ENCODING_CID },
{ NS_CHARSET_DETECTION_ADAPTOR_CONTRACTID, &kNS_CHARSET_DETECTION_ADAPTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "ruprob", &kNS_RU_PROBDETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "ukprob", &kNS_UK_PROBDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "ruprob", &kNS_RU_STRING_PROBDETECTOR_CID },
{ NS_STRCDETECTOR_CONTRACTID_BASE "ukprob", &kNS_UK_STRING_PROBDETECTOR_CID },
#ifdef INCLUDE_DBGDETECTOR
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "1stblkdbg", &kNS_1STBLKDBG_DETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "2ndblkdbg", &kNS_2NDBLKDBG_DETECTOR_CID },
{ NS_CHARSET_DETECTOR_CONTRACTID_BASE "lastblkdbg", &kNS_LASTBLKDBG_DETECTOR_CID },
#endif /* INCLUDE_DBGDETECTOR */
{ NULL }
};
NS_IMPL_NSGETMODULE(nsChardetModule, components)
static const mozilla::Module::CategoryEntry kChardetCategories[] = {
{ "parser-service-category", "Meta Charset Service", NS_META_CHARSET_CONTRACTID },
{ NS_CHARSET_DETECTOR_CATEGORY, "off", "off" },
{ NS_CHARSET_DETECTOR_CATEGORY, "ruprob", NS_CHARSET_DETECTOR_CONTRACTID_BASE "ruprob" },
{ NS_CHARSET_DETECTOR_CATEGORY, "ukprob", NS_CHARSET_DETECTOR_CONTRACTID_BASE "ukprob" },
{ NULL }
};
static const mozilla::Module kChardetModule = {
mozilla::Module::kVersion,
kChardetCIDs,
kChardetContracts,
kChardetCategories
};
NSMODULE_DEFN(nsChardetModule) = &kChardetModule;

View File

@ -69,7 +69,7 @@ enum
#define NS_SCRIPTABLEDATEFORMAT_CONTRACTID "@mozilla.org/intl/scriptabledateformat;1"
extern NS_IMETHODIMP
extern nsresult
NS_NewScriptableDateFormat(nsISupports* aOuter, REFNSIID aIID, void** aResult);
%}

View File

@ -41,7 +41,7 @@
#include "nsCollationCID.h"
#include "nsDateTimeFormatCID.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsILocaleService.h"
#include "nsIScriptableDateFormat.h"
#include "nsIServiceManager.h"
@ -81,7 +81,7 @@
#endif
#define NSLOCALE_MAKE_CTOR(ctor_, iface_, func_) \
static NS_IMETHODIMP \
static nsresult \
ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
{ \
*aResult = nsnull; \

View File

@ -161,7 +161,7 @@ NS_IMETHODIMP nsScriptableDateFormat::FormatDateTime(
return rv;
}
NS_IMETHODIMP
nsresult
NS_NewScriptableDateFormat(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
if (aOuter)

View File

@ -54,12 +54,10 @@
#include "nsNetUtil.h"
#include "nsIURL.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsIMemory.h"
#include "nsIObserverService.h"
#include "pratom.h"
#include "prmem.h"
#include "nsIModule.h"
#include "nsCOMArray.h"
#include "nsAutoLock.h"
#include "nsTextFormatter.h"

View File

@ -51,111 +51,21 @@
#define NS_DATA_BUNDLE_CATEGORY "uconv-charset-data"
#define NS_TITLE_BUNDLE_CATEGORY "uconv-charset-titles"
struct nsConverterRegistryInfo {
PRBool isEncoder; // PR_TRUE = encoder, PR_FALSE = decoder
const char *charset;
nsCID cid;
};
#define NS_CONVERTER_REGISTRY_START \
static const nsConverterRegistryInfo gConverterRegistryInfo[] = {
static const mozilla::Module::CategoryEntry kUConvCategories[] = {
#define NS_CONVERTER_REGISTRY_END \
{ NULL } \
};
#define NS_IMPL_NSUCONVERTERREGSELF \
static NS_IMETHODIMP \
nsUConverterRegSelf(nsIComponentManager *aCompMgr, \
nsIFile *aPath, \
const char* registryLocation, \
const char* componentType, \
const nsModuleComponentInfo *info) \
{ \
nsresult rv; \
nsCOMPtr<nsICategoryManager> catman = \
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
if (NS_FAILED(rv)) return rv; \
\
nsXPIDLCString previous; \
PRUint32 i; \
for (i=0; i<sizeof(gConverterRegistryInfo)/sizeof(gConverterRegistryInfo[0]); i++) { \
const nsConverterRegistryInfo* entry = &gConverterRegistryInfo[i]; \
const char *category; \
const char *key; \
\
if (entry->isEncoder) { \
category = NS_UNICODEENCODER_NAME; \
} else { \
category = NS_UNICODEDECODER_NAME; \
} \
key = entry->charset; \
\
rv = catman->AddCategoryEntry(category, key, "", \
PR_TRUE, \
PR_TRUE, \
getter_Copies(previous)); \
} \
return rv; \
} \
static NS_IMETHODIMP \
nsUConverterUnregSelf(nsIComponentManager *aCompMgr, \
nsIFile *aPath, \
const char*, \
const nsModuleComponentInfo *info) \
{ \
nsresult rv; \
nsCOMPtr<nsICategoryManager> catman = \
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
if (NS_FAILED(rv)) return rv; \
\
nsXPIDLCString previous; \
PRUint32 i; \
for (i=0; i<sizeof(gConverterRegistryInfo)/sizeof(gConverterRegistryInfo[0]); i++) { \
const nsConverterRegistryInfo* entry = &gConverterRegistryInfo[i]; \
const char *category; \
const char *key; \
\
if (entry->isEncoder) { \
category = NS_UNICODEDECODER_NAME; \
} else { \
category = NS_UNICODEENCODER_NAME; \
} \
key = entry->charset; \
\
rv = catman->DeleteCategoryEntry(category, key, PR_TRUE); \
} \
return rv; \
}
#define NS_UCONV_REG_UNREG_DECODER(_Charset, _CID) \
{ \
PR_FALSE, \
_Charset, \
_CID, \
},
{ NS_UNICODEDECODER_NAME, _Charset, "" },
#define NS_UCONV_REG_UNREG_ENCODER(_Charset, _CID) \
{ \
PR_TRUE, \
_Charset, \
_CID, \
},
{ NS_UNICODEENCODER_NAME, _Charset, "" },
// this needs to be written out per some odd cpp behavior that
// I could not work around - the behavior is document in the cpp
// info page however, so I'm not the only one to hit this!
#define NS_UCONV_REG_UNREG(_Charset, _DecoderCID, _EncoderCID) \
{ \
PR_FALSE, \
_Charset, \
_DecoderCID, \
}, \
{ \
PR_TRUE, \
_Charset, \
_EncoderCID, \
},
NS_UCONV_REG_UNREG_DECODER(_Charset, *) \
NS_UCONV_REG_UNREG_ENCODER(_Charset, *)
#endif

View File

@ -45,7 +45,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp1252.ut"
};
NS_METHOD
nsresult
nsCP1252ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -53,7 +53,7 @@
* @created 20/Apr/1999
* @author Catalin Rotaru [CATA]
*/
NS_METHOD
nsresult
nsCP1252ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -55,6 +55,7 @@
#include "mozilla/Services.h"
#include "nsXPCOM.h"
#include "nsComponentManagerUtils.h"
#include "nsISupportsPrimitives.h"
// just for CONTRACTIDs
@ -84,30 +85,6 @@ nsCharsetConverterManager::~nsCharsetConverterManager()
NS_IF_RELEASE(mTitleBundle);
}
nsresult nsCharsetConverterManager::RegisterConverterManagerData()
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
RegisterConverterCategory(catman, NS_TITLE_BUNDLE_CATEGORY,
"chrome://global/locale/charsetTitles.properties");
RegisterConverterCategory(catman, NS_DATA_BUNDLE_CATEGORY,
"resource://gre-resources/charsetData.properties");
return NS_OK;
}
nsresult
nsCharsetConverterManager::RegisterConverterCategory(nsICategoryManager* catman,
const char* aCategory,
const char* aURL)
{
return catman->AddCategoryEntry(aCategory, aURL, "",
PR_TRUE, PR_TRUE, nsnull);
}
nsresult nsCharsetConverterManager::LoadExtensibleBundle(
const char* aCategory,
nsIStringBundle ** aResult)

View File

@ -69,10 +69,6 @@ private:
nsresult LoadExtensibleBundle(const char * aRegistryKey,
nsIStringBundle ** aResult);
static nsresult RegisterConverterCategory(nsICategoryManager*,
const char* aCategory,
const char* aURL);
nsresult GetBundleValue(nsIStringBundle * aBundle,
const char * aName,
const nsAFlatString& aProp, PRUnichar ** aResult);
@ -83,10 +79,6 @@ private:
nsresult GetList(const nsACString& aCategory,
const nsACString& aPrefix,
nsIUTF8StringEnumerator** aResult);
public:
static nsresult RegisterConverterManagerData();
};
#endif // nsCharsetConverterManager_h__

View File

@ -45,7 +45,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp1252.ut"
};
NS_METHOD
nsresult
nsISO88591ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -53,7 +53,7 @@
* @created 23/Nov/1998
* @author Catalin Rotaru [CATA]
*/
NS_METHOD
nsresult
nsISO88591ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -45,7 +45,7 @@ static const PRUint16 g_MacRomanMappingTable[] = {
#include "macroman.ut"
};
NS_METHOD
nsresult
nsMacRomanToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -56,7 +56,7 @@
* @created 05/Apr/1999
* @author Catalin Rotaru [CATA]
*/
NS_METHOD
nsresult
nsMacRomanToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -46,6 +46,7 @@
#include "nsScriptableUConv.h"
#include "nsIStringStream.h"
#include "nsCRT.h"
#include "nsComponentManagerUtils.h"
#include "nsIPlatformCharset.h"

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@ static const PRUint16 g_ufMappingTable[] = {
#include "cp1252.uf"
};
NS_METHOD
nsresult
nsUnicodeToCP1252Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -55,7 +55,7 @@
* @created 20/Apr/1999
* @author Catalin Rotaru [CATA]
*/
NS_METHOD
nsresult
nsUnicodeToCP1252Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -45,7 +45,7 @@ static const PRUint16 g_ufMappingTable[] = {
#include "8859-1.uf"
};
NS_METHOD
nsresult
nsUnicodeToISO88591Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -56,7 +56,7 @@
* @created 17/Feb/1999
* @author Catalin Rotaru [CATA]
*/
NS_METHOD
nsresult
nsUnicodeToISO88591Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -45,7 +45,7 @@ static const PRUint16 g_MacRomanMappingTable[] = {
#include "macroman.uf"
};
NS_METHOD
nsresult
nsUnicodeToMacRomanConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -53,7 +53,7 @@
* @created 05/Apr/1999
* @author Catalin Rotaru [CATA]
*/
NS_METHOD
nsresult
nsUnicodeToMacRomanConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -48,7 +48,7 @@ static const PRUint16 g_utMappingTable[] = {
//----------------------------------------------------------------------
// Class nsCP1125ToUnicode [implementation]
NS_METHOD
nsresult
nsCP1125ToUnicodeConstructor(nsISupports* aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -42,7 +42,7 @@
/**
* A character set converter from CP1125 to Unicode.
*/
NS_METHOD
nsresult
nsCP1125ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -48,7 +48,7 @@ static const PRUint16 g_utMappingTable[] = {
//----------------------------------------------------------------------
// Class nsCP1131ToUnicode [implementation]
NS_METHOD
nsresult
nsCP1131ToUnicodeConstructor(nsISupports* aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -42,7 +42,7 @@
/**
* A character set converter from CP1131 to Unicode.
*/
NS_METHOD
nsresult
nsCP1131ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -63,7 +63,7 @@ static const PRUint16 g_utMappingTable[] = {
//----------------------------------------------------------------------
// Class nsCP850ToUnicode [implementation]
NS_METHOD
nsresult
nsCP850ToUnicodeConstructor(nsISupports* aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -57,7 +57,7 @@
/**
* A character set converter from CP850 to Unicode.
*/
NS_METHOD
nsresult
nsCP850ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp852.ut"
};
NS_METHOD
nsresult
nsCP852ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -58,7 +58,7 @@
/**
* A character set converter from CP852 to Unicode.
*/
NS_METHOD
nsresult
nsCP852ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp855.ut"
};
NS_METHOD
nsresult
nsCP855ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -58,7 +58,7 @@
/**
* A character set converter from CP855 to Unicode.
*/
NS_METHOD
nsresult
nsCP855ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp857.ut"
};
NS_METHOD
nsresult
nsCP857ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -59,7 +59,7 @@
/**
* A character set converter from CP857 to Unicode.
*/
NS_METHOD
nsresult
nsCP857ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp862.ut"
};
NS_METHOD
nsresult
nsCP862ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -59,7 +59,7 @@
/**
* A character set converter from CP862 to Unicode.
*/
NS_METHOD
nsresult
nsCP862ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp864.ut"
};
NS_METHOD
nsresult
nsCP864ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -59,7 +59,7 @@
/**
* A character set converter from CP864 to Unicode.
*/
NS_METHOD
nsresult
nsCP864ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "864i.ut"
};
NS_METHOD
nsresult
nsCP864iToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -59,7 +59,7 @@
/**
* A character set converter from CP864i to Unicode.
*/
NS_METHOD
nsresult
nsCP864iToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -44,7 +44,7 @@ static const PRUint16 g_utMappingTable[] = {
#include "cp869.ut"
};
NS_METHOD
nsresult
nsCP869ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -42,7 +42,7 @@
/**
* A character set converter from CP869 to Unicode.
*/
NS_METHOD
nsresult
nsCP869ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -45,7 +45,7 @@ static const PRUint16 g_ufMappingTable[] = {
#include "cp1125.uf"
};
NS_METHOD
nsresult
nsUnicodeToCP1125Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -44,7 +44,7 @@
/**
* A character set converter from Unicode to CP1125.
*/
NS_METHOD
nsresult
nsUnicodeToCP1125Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -45,7 +45,7 @@ static const PRUint16 g_ufMappingTable[] = {
#include "cp1131.uf"
};
NS_METHOD
nsresult
nsUnicodeToCP1131Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -44,7 +44,7 @@
/**
* A character set converter from Unicode to CP1131.
*/
NS_METHOD
nsresult
nsUnicodeToCP1131Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_ufMappingTable[] = {
#include "cp850.uf"
};
NS_METHOD
nsresult
nsUnicodeToCP850Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -59,7 +59,7 @@
/**
* A character set converter from Unicode to CP850.
*/
NS_METHOD
nsresult
nsUnicodeToCP850Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_ufMappingTable[] = {
#include "cp852.uf"
};
NS_METHOD
nsresult
nsUnicodeToCP852Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -58,7 +58,7 @@
/**
* A character set converter from Unicode to CP852.
*/
NS_METHOD
nsresult
nsUnicodeToCP852Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

View File

@ -60,7 +60,7 @@ static const PRUint16 g_ufMappingTable[] = {
#include "cp855.uf"
};
NS_METHOD
nsresult
nsUnicodeToCP855Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{

View File

@ -59,7 +59,7 @@
/**
* A character set converter from Unicode to CP855.
*/
NS_METHOD
nsresult
nsUnicodeToCP855Constructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult);

Some files were not shown because too many files have changed in this diff Show More