Check in for Ron Guilmette. r=shaver, sr=waterson. For intl r=nhotta. Changes for NS_IMPL_NSGETMODULE. bug #46775.

This commit is contained in:
kandrot%netscape.com 2001-05-05 05:33:37 +00:00
Родитель a4379ace52
Коммит d5bd552195
150 изменённых файлов: 240 добавлений и 2026 удалений

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

@ -56,5 +56,5 @@ static nsModuleComponentInfo components[] =
},
};
NS_IMPL_NSGETMODULE("nsAccessibilityModule", components);
NS_IMPL_NSGETMODULE(nsAccessibilityModule, components);

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

@ -64,6 +64,6 @@ static nsModuleComponentInfo components[] =
};
NS_IMPL_NSGETMODULE("nsSecurityManagerModule", components);
NS_IMPL_NSGETMODULE(nsSecurityManagerModule, components);

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

@ -51,5 +51,5 @@ static nsModuleComponentInfo components[] =
},
};
NS_IMPL_NSGETMODULE("nsChromeModule", components);
NS_IMPL_NSGETMODULE(nsChromeModule, components);

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

@ -51,7 +51,7 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsMorkModule", components);
NS_IMPL_NSGETMODULE(nsMorkModule, components);

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

@ -87,7 +87,7 @@ static nsModuleComponentInfo components[] =
// implement the NSGetModule() exported function
//
NS_IMPL_NSGETMODULE("nsLDAPProtocolModule", components);
NS_IMPL_NSGETMODULE(nsLDAPProtocolModule, components);
#ifdef PR_LOGGING
PRLogModuleInfo *gLDAPLogModule = 0;

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

@ -50,5 +50,5 @@ static nsModuleComponentInfo gDocShellModuleInfo[] = {
// "docshell provider" to illustrate that this thing really *should*
// be dispensing docshells rather than webshells.
NS_IMPL_NSGETMODULE("docshell provider", gDocShellModuleInfo)
NS_IMPL_NSGETMODULE(docshell_provider, gDocShellModuleInfo)

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

@ -38,6 +38,7 @@
#include "nsJSEnvironment.h"
#include "nsIScriptGlobalObject.h"
#include "nsIGenericFactory.h"
#include "nsDOMCID.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIDOMNativeObjectRegistry.h"
@ -700,109 +701,20 @@ nsDOMScriptObjectFactory::NewScriptPkcs11(nsIScriptContext *aContext,
//////////////////////////////////////////////////////////////////////
static NS_DEFINE_CID(kCDOMScriptObjectFactory, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
static NS_DEFINE_CID(kCDOMNativeObjectRegistry, NS_DOM_NATIVE_OBJECT_REGISTRY_CID);
static NS_DEFINE_CID(kCScriptNameSetRegistry, NS_SCRIPT_NAMESET_REGISTRY_CID);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMScriptObjectFactory);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMNativeObjectRegistry);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptNameSetRegistry);
class nsDOMFactory : public nsIFactory
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
nsDOMFactory(const nsCID &aClass);
protected:
virtual ~nsDOMFactory();
private:
nsCID mClassID;
static nsModuleComponentInfo components[] = {
{ "Script Object Factory", NS_DOM_SCRIPT_OBJECT_FACTORY_CID, nsnull,
nsDOMScriptObjectFactoryConstructor },
{ "Native Object Registry", NS_DOM_NATIVE_OBJECT_REGISTRY_CID, nsnull,
nsDOMNativeObjectRegistryConstructor },
{ "Script Name Set Registry", NS_SCRIPT_NAMESET_REGISTRY_CID, nsnull,
nsScriptNameSetRegistryConstructor }
};
nsDOMFactory::nsDOMFactory(const nsCID &aClass)
{
NS_INIT_ISUPPORTS();
mClassID = aClass;
}
nsDOMFactory::~nsDOMFactory()
{
}
NS_IMPL_ISUPPORTS(nsDOMFactory, NS_GET_IID(nsIFactory))
nsresult nsDOMFactory::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
nsISupports *inst = nsnull;
if (mClassID.Equals(kCDOMScriptObjectFactory)) {
inst = (nsISupports *)new nsDOMScriptObjectFactory();
}
else if (mClassID.Equals(kCDOMNativeObjectRegistry)) {
inst = (nsISupports *)new nsDOMNativeObjectRegistry();
}
else if (mClassID.Equals(kCScriptNameSetRegistry)) {
inst = (nsISupports *)new nsScriptNameSetRegistry();
}
if (inst == NULL) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(inst); // Stabilize
nsresult res = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst); // Destabilize and avoid leaks. Avoid calling delete <interface pointer>
return res;
}
nsresult nsDOMFactory::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
// return the proper factory to the caller
#if defined(XP_MAC) && defined(MAC_STATIC)
extern "C" NS_DOM nsresult
NSGetFactory_DOM_DLL(nsISupports* servMgr,
const nsCID &aClass,
const char *aClassName,
const char *aContractID,
nsIFactory **aFactory)
#else
extern "C" NS_DOM nsresult
NSGetFactory(nsISupports* servMgr,
const nsCID &aClass,
const char *aClassName,
const char *aContractID,
nsIFactory **aFactory)
#endif
{
if (nsnull == aFactory) {
return NS_ERROR_NULL_POINTER;
}
*aFactory = new nsDOMFactory(aClass);
if (nsnull == aFactory) {
return NS_ERROR_OUT_OF_MEMORY;
}
return (*aFactory)->QueryInterface(NS_GET_IID(nsIFactory), (void**)aFactory);
}
NS_IMPL_NSGETMODULE(DOM_components, components);
void XXXDomNeverCalled();
void XXXDomNeverCalled()

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

@ -517,6 +517,6 @@ static nsModuleComponentInfo gJSModuleInfo[] = {
nsJSProtocolHandler::Create }
};
NS_IMPL_NSGETMODULE("javascript: protocol", gJSModuleInfo)
NS_IMPL_NSGETMODULE(javascript__protocol, gJSModuleInfo)
////////////////////////////////////////////////////////////////////////////////

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

@ -101,4 +101,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsEditorModule", components)
NS_IMPL_NSGETMODULE(nsEditorModule, components)

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

@ -55,4 +55,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsEditorModule", components)
NS_IMPL_NSGETMODULE(nsEditorModule, components)

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

@ -101,4 +101,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsEditorModule", components)
NS_IMPL_NSGETMODULE(nsEditorModule, components)

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

@ -55,4 +55,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsEditorModule", components)
NS_IMPL_NSGETMODULE(nsEditorModule, components)

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

@ -54,4 +54,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsTextServicesModule", components)
NS_IMPL_NSGETMODULE(nsTextServicesModule, components)

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

@ -46,4 +46,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsTransactionManagerModule", components)
NS_IMPL_NSGETMODULE(nsTransactionManagerModule, components)

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

@ -54,4 +54,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsTextServicesModule", components)
NS_IMPL_NSGETMODULE(nsTextServicesModule, components)

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

@ -49,7 +49,7 @@ static nsModuleComponentInfo components[] =
// NSGetModule implementation.
NS_IMPL_NSGETMODULE("Browser Embedding Module", components)
NS_IMPL_NSGETMODULE(Browser_Embedding_Module, components)

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

@ -42,4 +42,4 @@ static nsModuleComponentInfo gComponents[] = {
{ NS_APPSTARTUPNOTIFIER_CLASSNAME, NS_APPSTARTUPNOTIFIER_CID, NS_APPSTARTUPNOTIFIER_CONTRACTID, nsAppStartupNotifierConstructor }
};
NS_IMPL_NSGETMODULE("embedcomponents", gComponents)
NS_IMPL_NSGETMODULE(embedcomponents, gComponents)

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

@ -87,7 +87,7 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE_WITH_DTOR("nsAccessProxy", components, AccessProxyModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsAccessProxy, components, AccessProxyModuleDtor)

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

@ -81,4 +81,4 @@ static nsModuleComponentInfo components[] = {
},
};
NS_IMPL_NSGETMODULE("nsCookieModule", components)
NS_IMPL_NSGETMODULE(nsCookieModule, components)

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

@ -31,4 +31,4 @@ static nsModuleComponentInfo gResComponents[] = {
}
};
NS_IMPL_NSGETMODULE("datetime", gResComponents)
NS_IMPL_NSGETMODULE(datetime, gResComponents)

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

@ -31,4 +31,4 @@ static nsModuleComponentInfo gResComponents[] = {
}
};
NS_IMPL_NSGETMODULE("finger", gResComponents)
NS_IMPL_NSGETMODULE(finger, gResComponents)

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

@ -53,4 +53,4 @@ static nsModuleComponentInfo components[] =
};
NS_IMPL_NSGETMODULE("nsInspectorModule", components)
NS_IMPL_NSGETMODULE(nsInspectorModule, components)

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

@ -1403,4 +1403,4 @@ static nsModuleComponentInfo components[] = {
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsPICSModule", components)
NS_IMPL_NSGETMODULE(nsPICSModule, components)

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

@ -1,178 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Hubbie Shaw
* Doug Turner <dougt@netscape.com>
*/
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsPSMUICallbacks.h"
#include "nsPSMComponent.h"
#include "nsISecureBrowserUI.h"
#include "nsSecureBrowserUIImpl.h"
#include "nsSSLSocketProvider.h"
#include "nsTLSSocketProvider.h"
#include "nsSDR.h"
#include "nsFSDR.h"
#include "nsCrypto.h"
#include "nsKeygenHandler.h"
//For the NS_CRYPTO_CONTRACTID define
#include "nsDOMCID.h"
#include "nsCURILoader.h"
#include "nsISupportsUtils.h"
// Define SDR object constructor
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSecretDecoderRing, init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFSecretDecoderRing, init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCrypto, init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPkcs11, init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(CertContentListener, init);
static nsModuleComponentInfo components[] =
{
{
PSM_COMPONENT_CLASSNAME,
NS_PSMCOMPONENT_CID,
PSM_COMPONENT_CONTRACTID,
nsPSMComponent::CreatePSMComponent
},
{
"PSM Content Handler - application/x-x509-ca-cert",
NS_PSMCOMPONENT_CID,
NS_CONTENT_HANDLER_CONTRACTID_PREFIX"application/x-x509-ca-cert",
nsPSMComponent::CreatePSMComponent
},
{
"PSM Content Handler - application/x-x509-server-cert",
NS_PSMCOMPONENT_CID,
NS_CONTENT_HANDLER_CONTRACTID_PREFIX"application/x-x509-server-cert",
nsPSMComponent::CreatePSMComponent
},
{
"PSM Content Handler - application/x-x509-user-cert",
NS_PSMCOMPONENT_CID,
NS_CONTENT_HANDLER_CONTRACTID_PREFIX"application/x-x509-user-cert",
nsPSMComponent::CreatePSMComponent
},
{
"PSM Content Handler - application/x-x509-email-cert",
NS_PSMCOMPONENT_CID,
NS_CONTENT_HANDLER_CONTRACTID_PREFIX"application/x-x509-email-cert",
nsPSMComponent::CreatePSMComponent
},
{
PSM_UI_HANDLER_CLASSNAME,
NS_PSMUIHANDLER_CID,
PSM_UI_HANDLER_CONTRACTID,
nsPSMUIHandlerImpl::CreatePSMUIHandler
},
{
NS_SECURE_BROWSER_UI_CLASSNAME,
NS_SECURE_BROWSER_UI_CID,
NS_SECURE_BROWSER_UI_CONTRACTID,
nsSecureBrowserUIImpl::Create
},
{
NS_ISSLSOCKETPROVIDER_CLASSNAME,
NS_SSLSOCKETPROVIDER_CID,
NS_ISSLSOCKETPROVIDER_CONTRACTID,
nsSSLSocketProvider::Create
},
{
NS_ISSLFHSOCKETPROVIDER_CLASSNAME,
NS_SSLSOCKETPROVIDER_CID,
NS_ISSLFHSOCKETPROVIDER_CONTRACTID,
nsSSLSocketProvider::Create
},
{
NS_TLSSOCKETPROVIDER_CLASSNAME,
NS_TLSSOCKETPROVIDER_CID,
NS_TLSSOCKETPROVIDER_CONTRACTID,
nsTLSSocketProvider::Create
},
{
NS_SDR_CLASSNAME,
NS_SDR_CID,
NS_SDR_CONTRACTID,
nsSecretDecoderRingConstructor
},
{
NS_FSDR_CLASSNAME,
NS_FSDR_CID,
NS_FSDR_CONTRACTID,
nsFSecretDecoderRingConstructor
},
{
NS_CRYPTO_CLASSNAME,
NS_CRYPTO_CID,
NS_CRYPTO_CONTRACTID,
nsCryptoConstructor
},
{
NS_PKCS11_CLASSNAME,
NS_PKCS11_CID,
NS_PKCS11_CONTRACTID,
nsPkcs11Constructor
},
{
"Generic Certificate Content Handler",
NS_CERTCONTENTLISTEN_CID,
NS_CERTCONTENTLISTEN_CONTRACTID,
CertContentListenerConstructor
},
{
"Form Processor",
NS_FORMPROCESSOR_CID,
NS_FORMPROCESSOR_CONTRACTID,
nsKeygenFormProcessor::Create
},
{
"Entropy Collector",
NS_PSMCOMPONENT_CID,
NS_ENTROPYCOLLECTOR_CONTRACTID,
nsPSMComponent::CreatePSMComponent
}
};
NS_IMPL_NSGETMODULE("PSMComponent", components);

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

@ -195,4 +195,4 @@ static nsModuleComponentInfo components[] = {
nsSyncLoaderConstructor }
};
NS_IMPL_NSGETMODULE("TransformiixModule", components)
NS_IMPL_NSGETMODULE(TransformiixModule, components)

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

@ -33,4 +33,4 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsVixenModule", components)
NS_IMPL_NSGETMODULE(nsVixenModule, components)

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

@ -42,5 +42,5 @@ static nsModuleComponentInfo components[] = {
"@mozilla.org/walleteditor/walleteditor-world;1", WalletEditorImplConstructor },
};
NS_IMPL_NSGETMODULE("nsWalletViewerModule", components)
NS_IMPL_NSGETMODULE(nsWalletViewerModule, components)

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

@ -42,4 +42,4 @@ static nsModuleComponentInfo components[] = {
NS_SINGLESIGNONPROMPT_CONTRACTID, nsSingleSignOnPromptConstructor }
};
NS_IMPL_NSGETMODULE("nsWalletModule", components)
NS_IMPL_NSGETMODULE(nsWalletModule, components)

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

@ -231,4 +231,4 @@ static nsModuleComponentInfo components[] = {
#endif
};
NS_IMPL_NSGETMODULE("nsXMLExtrasModule", components)
NS_IMPL_NSGETMODULE(nsXMLExtrasModule, components)

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

@ -173,4 +173,4 @@ static nsModuleComponentInfo components[] =
nsScreenManagerBeOSConstructor }
};
NS_IMPL_NSGETMODULE("nsGfxBeOSModule", components)
NS_IMPL_NSGETMODULE(nsGfxBeOSModule, components)

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

@ -186,5 +186,5 @@ nsGfxGTKModuleDtor(nsIModule *self)
nsRenderingContextGTK::Shutdown();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsGfxGTKModule", components, nsGfxGTKModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsGfxGTKModule, components, nsGfxGTKModuleDtor)

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

@ -186,5 +186,5 @@ nsGfxOS2ModuleDtor(nsIModule *self)
// nsRenderingContextOS2::Shutdown();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsGfxOS2Module", components, nsGfxOS2ModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsGfxOS2Module, components, nsGfxOS2ModuleDtor)

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

@ -161,5 +161,5 @@ static nsModuleComponentInfo components[] =
nsScreenManagerPhConstructor }
};
NS_IMPL_NSGETMODULE("nsGfxPhModule", components)
NS_IMPL_NSGETMODULE(nsGfxPhModule, components)

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

@ -38,5 +38,5 @@ static nsModuleComponentInfo components[] =
nsDeviceContextPSConstructor }
};
NS_IMPL_NSGETMODULE("nsGfxPSModule", components)
NS_IMPL_NSGETMODULE(nsGfxPSModule, components)

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

@ -175,5 +175,5 @@ static nsModuleComponentInfo components[] =
nsScreenManagerXlibConstructor }
};
NS_IMPL_NSGETMODULE("nsGfxXlibModule", components)
NS_IMPL_NSGETMODULE(nsGfxXlibModule, components)

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

@ -42,4 +42,4 @@ static nsModuleComponentInfo components[] =
nsDeviceContextXPConstructor }
};
NS_IMPL_NSGETMODULE("nsGfxXPModule", components)
NS_IMPL_NSGETMODULE(nsGfxXPModule, components)

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

@ -38,5 +38,5 @@ static nsModuleComponentInfo components[] =
gfxImageFrameConstructor, },
};
NS_IMPL_NSGETMODULE("nsGfx2Module", components)
NS_IMPL_NSGETMODULE(nsGfx2Module, components)

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

@ -30,6 +30,9 @@
#include "nsIStringCharsetDetector.h"
#include "nsICharsetDetectionAdaptor.h"
#define g_InstanceCount nsCharDetModule_g_InstanceCount
#define g_LockCount nsCharDetModule_g_LockCount
extern "C" PRInt32 g_InstanceCount;
extern "C" PRInt32 g_LockCount;

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

@ -469,5 +469,5 @@ static nsModuleComponentInfo components[] =
#endif /* INCLUDE_DBGDETECTOR */
};
NS_IMPL_NSGETMODULE("nsCharDetModule", components)
NS_IMPL_NSGETMODULE(nsCharDetModule, components)

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

@ -69,4 +69,4 @@ static nsModuleComponentInfo components[] =
NS_I18NCOMPATIBILITY_CONTRACTID, nsI18nCompatibilityConstructor}
};
NS_IMPL_NSGETMODULE("I18nCompatibility", components)
NS_IMPL_NSGETMODULE(I18nCompatibility, components)

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

@ -25,6 +25,9 @@
#include "prtypes.h"
#define g_InstanceCount lwbrk_g_InstanceCount
#define g_LockCount lwbrk_g_LockCount
extern "C" PRInt32 g_InstanceCount;
extern "C" PRInt32 g_LockCount;

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

@ -37,4 +37,4 @@ static nsModuleComponentInfo components[] = {
NS_LWBRK_CONTRACTID, nsLWBreakerFImpConstructor}
};
NS_IMPL_NSGETMODULE("nsLWBrkModule", components);
NS_IMPL_NSGETMODULE(nsLWBrkModule, components);

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

@ -1092,5 +1092,5 @@ static nsModuleComponentInfo components[] =
{ "Accept Language", NS_ACCEPTLANG_CID, NS_ACCEPTLANG_CONTRACTID, nsAcceptLangConstructor}
};
NS_IMPL_NSGETMODULE("nsStringBundleModule", components)
NS_IMPL_NSGETMODULE(nsStringBundleModule, components)

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

@ -28,4 +28,5 @@
extern "C" PRInt32 g_InstanceCount;
extern "C" PRInt32 g_LockCount;
#define g_AsciiMapping ucvcn_g_AsciiMapping
#endif /* nsUCvCnDll_h___ */

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

@ -161,4 +161,4 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvCnModule", components);
NS_IMPL_NSGETMODULE(nsUCvCnModule, components);

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

@ -194,5 +194,5 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvIBMModule", components);
NS_IMPL_NSGETMODULE(nsUCvIBMModule, components);

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

@ -152,5 +152,5 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvJAModule", components);
NS_IMPL_NSGETMODULE(nsUCvJAModule, components);

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

@ -31,6 +31,7 @@ extern "C" PRInt32 g_LockCount;
extern "C" PRUint16 g_utKSC5601Mapping[];
extern "C" PRUint16 g_ufKSC5601Mapping[];
#define g_AsciiMapping ucvko_g_AsciiMapping
extern "C" PRUint16 g_AsciiMapping[];
extern "C" PRUint16 g_HangulNullMapping[];

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

@ -117,5 +117,5 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvKoModule", components);
NS_IMPL_NSGETMODULE(nsUCvKoModule, components);

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

@ -25,6 +25,9 @@
#include "prtypes.h"
#define g_InstanceCount ucvlatin_g_InstanceCount
#define g_LockCount ucvlatin_g_LockCount
extern PRInt32 g_InstanceCount;
extern PRInt32 g_LockCount;

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

@ -1103,5 +1103,5 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvLatinModule", components);
NS_IMPL_NSGETMODULE(nsUCvLatinModule, components);

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

@ -204,5 +204,5 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvMathModule", components);
NS_IMPL_NSGETMODULE(nsUCvMathModule, components);

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

@ -119,5 +119,5 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvTWModule", components);
NS_IMPL_NSGETMODULE(nsUCvTWModule, components);

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

@ -198,4 +198,4 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsUCvTW2Module", components);
NS_IMPL_NSGETMODULE(nsUCvTW2Module, components);

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

@ -25,6 +25,9 @@
#include "prtypes.h"
#define g_InstanceCount nsUcharUtilModule_g_InstanceCount
#define g_LockCount nsUcharUtilModule_g_LockCount
extern "C" PRInt32 g_InstanceCount;
extern "C" PRInt32 g_LockCount;

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

@ -101,5 +101,5 @@ static nsModuleComponentInfo components[] =
#endif // IBMBIDI
};
NS_IMPL_NSGETMODULE("UcharUtil", components)
NS_IMPL_NSGETMODULE(UcharUtil, components)

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

@ -1324,4 +1324,4 @@ static nsModuleComponentInfo components[] = {
#endif
};
NS_IMPL_NSGETMODULE("JS component loader", components);
NS_IMPL_NSGETMODULE(JS_component_loader, components);

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

@ -332,5 +332,5 @@ static nsModuleComponentInfo components[] = {
nsXPCSample_HookerUpperConstructor }
};
NS_IMPL_NSGETMODULE("xpconnect samples", components)
NS_IMPL_NSGETMODULE(xpconnect_samples, components)

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

@ -65,4 +65,4 @@ xpcModuleDtor(nsIModule* self)
nsJSRuntimeServiceImpl::FreeSingleton();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("xpconnect", components, xpcModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(xpconnect, components, xpcModuleDtor)

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

@ -68,5 +68,5 @@ static nsModuleComponentInfo components[] = {
{nsnull, NS_XPCTESTDOMSTRING_CID, "@mozilla.org/js/xpc/test/DOMString;1", xpctest::ConstructXPCTestDOMString }
};
NS_IMPL_NSGETMODULE("xpconnect test", components)
NS_IMPL_NSGETMODULE(xpconnect_test, components)

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

@ -57,4 +57,4 @@ static nsModuleComponentInfo components[] = {
{nsnull, PROFILER_CID, XPCTOOLS_PROFILER_CONTRACTID, nsXPCToolsProfilerConstructor}
};
NS_IMPL_NSGETMODULE("xpctools", components)
NS_IMPL_NSGETMODULE(xpctools, components)

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

@ -61,4 +61,4 @@ static nsModuleComponentInfo components[] =
nsAbSyncDriverConstructor }
};
NS_IMPL_NSGETMODULE("nsAbSyncModule", components)
NS_IMPL_NSGETMODULE(nsAbSyncModule, components)

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

@ -154,4 +154,4 @@ static nsModuleComponentInfo components[] =
nsAddbookProtocolHandler::Create }
};
NS_IMPL_NSGETMODULE("nsAbModule", components)
NS_IMPL_NSGETMODULE(nsAbModule, components)

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

@ -294,5 +294,5 @@ static nsModuleComponentInfo gComponents[] = {
};
NS_IMPL_NSGETMODULE("nsMsgBaseModule", gComponents)
NS_IMPL_NSGETMODULE(nsMsgBaseModule, gComponents)

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

@ -184,4 +184,4 @@ static nsModuleComponentInfo components[] =
};
NS_IMPL_NSGETMODULE("nsMsgComposeModule", components)
NS_IMPL_NSGETMODULE(nsMsgComposeModule, components)

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

@ -79,4 +79,4 @@ static nsModuleComponentInfo gComponents[] = {
NS_IMAPPROTOCOLINFO_CONTRACTID, nsImapServiceConstructor }
};
NS_IMPL_NSGETMODULE("IMAP factory", gComponents);
NS_IMPL_NSGETMODULE(IMAP_factory, gComponents);

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

@ -79,5 +79,5 @@ eudoraModuleDtor(nsIModule* self)
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsEudoraImportModule", components, eudoraModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsEudoraImportModule, components, eudoraModuleDtor)

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

@ -82,7 +82,7 @@ oeModuleDtor(nsIModule* self)
nsOEStringBundle::Cleanup();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsOEImport", components, oeModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsOEImport, components, oeModuleDtor)

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

@ -83,5 +83,5 @@ outlookModuleDtor(nsIModule* self)
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsOutlookImport", components, outlookModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsOutlookImport, components, outlookModuleDtor)

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

@ -53,6 +53,6 @@ importModuleDtor(nsIModule* self)
nsImportStringBundle::Cleanup();
}
NS_IMPL_NSGETMODULE_WITH_DTOR( "nsImportServiceModule", components, importModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR( nsImportServiceModule, components, importModuleDtor)

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

@ -79,6 +79,6 @@ textModuleDtor(nsIModule* self)
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsTextImportModule", components, textModuleDtor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsTextImportModule, components, textModuleDtor)

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

@ -136,5 +136,5 @@ static nsModuleComponentInfo gComponents[] = {
NS_MSG_POPSTRINGSERVICE_CONTRACTID, nsLocalStringServiceConstructor },
};
NS_IMPL_NSGETMODULE("local mail services", gComponents);
NS_IMPL_NSGETMODULE(local_mail_services, gComponents);

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

@ -76,4 +76,4 @@ static nsModuleComponentInfo gComponents[] = {
nsnull, nsMimeHeadersConstructor }
};
NS_IMPL_NSGETMODULE("mime services", gComponents)
NS_IMPL_NSGETMODULE(mime_services, gComponents)

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

@ -51,5 +51,5 @@ static nsModuleComponentInfo components[] =
// Implement the NSGetModule() exported function for your module
// and the entire implementation of the module object.
//
NS_IMPL_NSGETMODULE("nsVCardModule", components)
NS_IMPL_NSGETMODULE(nsVCardModule, components)

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

@ -62,4 +62,4 @@ static nsModuleComponentInfo components[] =
nsMimeXULEmitterConstructor }
};
NS_IMPL_NSGETMODULE("nsMimeEmitterModule", components)
NS_IMPL_NSGETMODULE(nsMimeEmitterModule, components)

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

@ -125,6 +125,6 @@ static nsModuleComponentInfo components[] =
nsNewsDownloadDialogArgsConstructor }
};
NS_IMPL_NSGETMODULE("nsMsgNewsModule", components)
NS_IMPL_NSGETMODULE(nsMsgNewsModule, components)

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

@ -36,5 +36,5 @@ static nsModuleComponentInfo components[] =
GIFDecoder::Create }
};
NS_IMPL_NSGETMODULE("nsGIFModule", components)
NS_IMPL_NSGETMODULE(nsGIFModule, components)

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

@ -1,40 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
#include "nsJPGDecoder.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
static NS_DEFINE_CID(kJPGDecoderCID, NS_JPGDECODER_CID);
static nsModuleComponentInfo components[] =
{
{ "JPEG Decoder",
NS_JPGDECODER_CID,
"@mozilla.org/image/decoder;1?type=image/jpeg",
JPGDecoder::Create }
};
NS_IMPL_NSGETMODULE("nsJPGModule", components)

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

@ -1,44 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Tim Rowley, tor@cs.brown.edu, original author
*/
#include "nsMNGDecoder.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
static NS_DEFINE_CID(kMNGDecoderCID, NS_MNGDECODER_CID);
static nsModuleComponentInfo components[] =
{
{ "MNG Decoder",
NS_MNGDECODER_CID,
"@mozilla.org/image/decoder;1?type=video/x-mng",
MNGDecoder::Create },
{ "JNG Decoder",
NS_MNGDECODER_CID,
"@mozilla.org/image/decoder;1?type=image/x-jng",
MNGDecoder::Create }
};
NS_IMPL_NSGETMODULE("nsMNGModule", components)

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

@ -1,40 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsPNGDecoder.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
static NS_DEFINE_CID(kPNGDecoderCID, NS_PNGDECODER_CID);
static nsModuleComponentInfo components[] =
{
{ "PNG Decoder",
NS_PNGDECODER_CID,
"@mozilla.org/image/decoder;1?type=image/png",
PNGDecoder::Create }
};
NS_IMPL_NSGETMODULE("nsPNGModule", components)

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

@ -55,7 +55,7 @@ static nsModuleComponentInfo components[] =
}
};
NS_IMPL_NSGETMODULE("nsJarModule", components);
NS_IMPL_NSGETMODULE(nsJarModule, components);

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

@ -33,6 +33,6 @@ static nsModuleComponentInfo components[] =
},
};
NS_IMPL_NSGETMODULE("nsJarProtocolModule", components);
NS_IMPL_NSGETMODULE(nsJarProtocolModule, components);

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

@ -37,5 +37,5 @@ static nsModuleComponentInfo components[] =
nsGIFDecoder2Constructor, },
};
NS_IMPL_NSGETMODULE("nsGIFModule2", components)
NS_IMPL_NSGETMODULE(nsGIFModule2, components)

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

@ -38,5 +38,5 @@ static nsModuleComponentInfo components[] =
nsJPEGDecoderConstructor, },
};
NS_IMPL_NSGETMODULE("nsJPEGDecoderModule", components)
NS_IMPL_NSGETMODULE(nsJPEGDecoderModule, components)

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

@ -42,5 +42,5 @@ static nsModuleComponentInfo components[] =
nsPNGDecoderConstructor, },
};
NS_IMPL_NSGETMODULE("nsPNGDecoderModule", components)
NS_IMPL_NSGETMODULE(nsPNGDecoderModule, components)

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

@ -38,5 +38,5 @@ static nsModuleComponentInfo components[] =
nsPPMDecoderConstructor, },
};
NS_IMPL_NSGETMODULE("nsPPMDecoderModule", components)
NS_IMPL_NSGETMODULE(nsPPMDecoderModule, components)

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

@ -68,4 +68,4 @@ ImageModuleDestructor(nsIModule *self)
imgCache::Shutdown();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsImageLib2Module", components, ImageModuleDestructor)
NS_IMPL_NSGETMODULE_WITH_DTOR(nsImageLib2Module, components, ImageModuleDestructor)

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

@ -37,7 +37,7 @@ static nsModuleComponentInfo components[] =
},
};
NS_IMPL_NSGETMODULE("nsCJVMManagerModule", components);
NS_IMPL_NSGETMODULE(nsCJVMManagerModule, components);
#else

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

@ -47,7 +47,7 @@ static nsModuleComponentInfo components[] =
},
};
NS_IMPL_NSGETMODULE("OJITestLoader", components);
NS_IMPL_NSGETMODULE(OJITestLoader, components);
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr,
const char *path)

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

@ -76,5 +76,5 @@ nsPluginModuleDtor(nsIModule *self)
ns4xPlugin::ReleaseStatics();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsClassicPluginModule", gComponentInfo,
NS_IMPL_NSGETMODULE_WITH_DTOR(nsClassicPluginModule, gComponentInfo,
nsPluginModuleDtor);

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

@ -51,5 +51,5 @@ nsPluginModuleDtor(nsIModule *self)
ns4xPlugin::ReleaseStatics();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsPluginModule", gComponentInfo,
NS_IMPL_NSGETMODULE_WITH_DTOR(nsPluginModule, gComponentInfo,
nsPluginModuleDtor);

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

@ -1,80 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
#include "nsIGenericFactory.h"
#include "nsIClassicPluginFactory.h"
#include "ns4xPlugin.h"
class nsClassicPluginFactory : public nsIClassicPluginFactory {
public:
NS_DECL_ISUPPORTS
nsClassicPluginFactory();
static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
NS_IMETHOD CreatePlugin(nsIServiceManager* aServiceMgr, const char* aFileName,
PRLibrary* aLibrary, nsIPlugin** aResult);
};
NS_IMPL_ISUPPORTS1(nsClassicPluginFactory, nsIClassicPluginFactory)
nsClassicPluginFactory::nsClassicPluginFactory()
{
NS_INIT_ISUPPORTS();
}
nsresult nsClassicPluginFactory::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aOuter == nsnull, "no aggregation");
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
nsCOMPtr<nsIClassicPluginFactory> factory = new nsClassicPluginFactory;
if (! factory)
return NS_ERROR_OUT_OF_MEMORY;
return factory->QueryInterface(aIID, aResult);
}
NS_METHOD nsClassicPluginFactory::CreatePlugin(nsIServiceManager* aServiceMgr, const char* aFileName,
PRLibrary* aLibrary, nsIPlugin** aResult)
{
return ns4xPlugin::CreatePlugin(aServiceMgr, aFileName, aLibrary, aResult);
}
static nsModuleComponentInfo gComponentInfo[] = {
{ "Classic Plugin Factory",
NS_CLASSIC_PLUGIN_FACTORY_CID,
NS_CLASSIC_PLUGIN_FACTORY_CONTRACTID,
nsClassicPluginFactory::Create },
};
PR_STATIC_CALLBACK(void)
nsPluginModuleDtor(nsIModule *self)
{
ns4xPlugin::ReleaseStatics();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsClassicPluginModule", gComponentInfo,
nsPluginModuleDtor);

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

@ -1,55 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
#include "nsIGenericFactory.h"
#include "nsIPluginManager.h"
#include "nsPluginsCID.h"
#include "nsPluginHostImpl.h"
#include "nsPluginDocLoaderFactory.h"
#include "ns4xPlugin.h"
static nsModuleComponentInfo gComponentInfo[] = {
{ "Plugin Host",
NS_PLUGIN_HOST_CID,
"@mozilla.org/plugin/host;1",
nsPluginHostImpl::Create },
{ "Plugin Manager",
NS_PLUGINMANAGER_CID,
"@mozilla.org/plugin/manager;1",
nsPluginHostImpl::Create },
{ "Plugin Doc Loader Factory",
NS_PLUGINDOCLOADERFACTORY_CID,
"@mozilla.org/plugin/doc-loader/factory;1",
nsPluginDocLoaderFactory::Create },
};
PR_STATIC_CALLBACK(void)
nsPluginModuleDtor(nsIModule *self)
{
ns4xPlugin::ReleaseStatics();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsPluginModule", gComponentInfo,
nsPluginModuleDtor);

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

@ -371,7 +371,7 @@ static nsModuleComponentInfo gComponentInfo[] = {
SimplePluginInstance::UnregisterSelf },
};
NS_IMPL_NSGETMODULE("SimplePlugin", gComponentInfo);
NS_IMPL_NSGETMODULE(SimplePlugin, gComponentInfo);

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

@ -253,7 +253,7 @@ static nsModuleComponentInfo gComponentInfo[] = {
EventsPluginInstance::UnregisterSelf },
};
NS_IMPL_NSGETMODULE("EventsPlugin", gComponentInfo);
NS_IMPL_NSGETMODULE(EventsPlugin, gComponentInfo);
////////////////////////////////////////////////////////////////////////////////

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

@ -371,7 +371,7 @@ static nsModuleComponentInfo gComponentInfo[] = {
SimplePluginInstance::UnregisterSelf },
};
NS_IMPL_NSGETMODULE("SimplePlugin", gComponentInfo);
NS_IMPL_NSGETMODULE(SimplePlugin, gComponentInfo);

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

@ -1,851 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was developed by ActiveState.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Neil Hodgson <nhodgson@bigpond.net.au>
* Mark Hammond <MarkH@ActiveState.com>
*/
// npevents.cxx
// Demonstration plugin for Mozilla that handles events, focus and keystrokes.
// See README.txt for more details.
#include "nsplugin.h"
#include "nsIServiceManager.h"
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIGenericFactory.h"
#include "nsString.h"
#include "nsIAllocator.h"
#include "nsIEventsPluginInstance.h"
#include <stdio.h>
#include <string.h>
#if defined (XP_WIN)
#include <windows.h>
#elif defined (XP_UNIX)
#include <gdk/gdkprivate.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gtkmozbox.h>
#endif
#define EVENTSPLUGIN_DEBUG
/**
* {CB2EF72A-856A-4818-8E72-3439395E335F}
*/
#define NS_EVENTSAMPLEPLUGIN_CID { 0xcb2ef72a, 0x856a, 0x4818, { 0x8e, 0x72, 0x34, 0x39, 0x39, 0x5e, 0x33, 0x5f } }
#if defined(XP_UNIX)
typedef struct _PlatformInstance {
GtkWidget *moz_box;
Display * display;
uint32 x, y;
uint32 width, height;
}
PlatformInstance;
typedef GtkWidget* WinID;
#endif // XP_UNIX
#if defined(XP_WIN)
typedef struct _PlatformInstance
{
WNDPROC fOldChildWindowProc; // The original WNDPROC of the edit control.
WNDPROC fParentWindowProc; // The Mozilla WNDPROC for main (parent) window.
} PlatformInstance;
// Unique string for associating a pointer with our WNDPROC
static const char* gInstanceLookupString = "instance->pdata";
typedef HWND WinID;
#endif // XP_WIN
static NS_DEFINE_CID(kPluginManagerCID, NS_PLUGINMANAGER_CID);
static NS_DEFINE_CID(kEventsPluginCID, NS_EVENTSAMPLEPLUGIN_CID);
const char *kPluginName = "Events Sample Plug-in";
const char *kPluginDescription = "Sample plugin that demonstrates events, focus and keystrokes.";
#define PLUGIN_MIME_TYPE "application/x-events-sample-plugin"
static const char* kMimeTypes[] = {
PLUGIN_MIME_TYPE
};
static const char* kMimeDescriptions[] = {
"Event Sample Plug-in"
};
static const char* kFileExtensions[] = {
"smpev"
};
static const PRInt32 kNumMimeTypes = sizeof(kMimeTypes) / sizeof(*kMimeTypes);
////////////////////////////////////////////////////////////////////////////////
// EventsPluginInstance represents an instance of the EventsPlugin class.
class EventsPluginInstance :
public nsIPluginInstance,
public nsIEventsSampleInstance {
public:
////////////////////////////////////////////////////////////////////////////
// for implementing a generic module
static NS_METHOD
Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
static NS_METHOD
RegisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const char* aComponentType,
const nsModuleComponentInfo *info);
static NS_METHOD
UnregisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const nsModuleComponentInfo *info);
NS_DECL_ISUPPORTS
NS_DECL_NSIEVENTSSAMPLEINSTANCE
////////////////////////////////////////////////////////////////////////////
// from nsIEventHandler:
NS_IMETHOD HandleEvent(nsPluginEvent* event, PRBool* handled);
////////////////////////////////////////////////////////////////////////////
// from nsIPluginInstance:
NS_IMETHOD Initialize(nsIPluginInstancePeer *peer);
// Required backpointer to the peer.
NS_IMETHOD GetPeer(nsIPluginInstancePeer **result);
NS_IMETHOD Start(void);
NS_IMETHOD Stop(void);
NS_IMETHOD Destroy(void);
NS_IMETHOD SetWindow(nsPluginWindow* window);
NS_IMETHOD NewStream(nsIPluginStreamListener** listener);
NS_IMETHOD Print(nsPluginPrint* platformPrint);
NS_IMETHOD GetValue(nsPluginInstanceVariable variable, void *value);
////////////////////////////////////////////////////////////////////////////
// EventsPluginInstance specific methods:
EventsPluginInstance();
virtual ~EventsPluginInstance();
void PlatformNew(void);
nsresult PlatformDestroy(void);
void PlatformResetWindow();
PRInt16 PlatformHandleEvent(nsPluginEvent* event);
void PlatformResizeWindow(nsPluginWindow* window);
nsresult PlatformCreateWindow(nsPluginWindow* window);
void SetMode(nsPluginMode mode) { fMode = mode; }
protected:
////////////////////////////////////////////////////////////////////////////
// Implementation methods
nsresult DoSetWindow(nsPluginWindow* window);
// Data
nsCOMPtr<nsIPluginInstancePeer> fPeer;
nsPluginWindow *fWindow; // no nsCOMPtr as not an interface!
nsPluginMode fMode;
PlatformInstance fPlatform;
WinID wMain; // The window created by Mozilla for us.
WinID wChild; // The window we create as a child of the nsWindow.
////////////////////////////////////////////////////////////////////////////
// Platform specific helpers
#ifdef XP_WIN
static LRESULT CALLBACK WndProcChild(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
#endif
};
////////////////////////////////////////////////////////////////////////////////
// EventsPluginStream represents the stream used by EvMozs
// to receive data from the browser.
class EventsPluginStreamListener : public nsIPluginStreamListener {
public:
NS_DECL_ISUPPORTS
////////////////////////////////////////////////////////////////////////////
// from nsIPluginStreamListener:
// Notify the observer that the URL has started to load. This method is
// called only once, at the beginning of a URL load.
NS_IMETHOD OnStartBinding(nsIPluginStreamInfo* pluginInfo);
// Notify the client that data is available in the input stream. This method is
// called whenver data is written into the input stream by the networking library.
NS_IMETHOD OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
nsIInputStream* input,
PRUint32 length);
NS_IMETHOD OnFileAvailable(nsIPluginStreamInfo* pluginInfo, const char* fileName);
// Notify the observer that the URL has finished loading. This method is
// called once when the networking library has finished processing the
// URL transaction initiatied via the nsINetService::Open(...) call.
NS_IMETHOD OnStopBinding(nsIPluginStreamInfo* pluginInfo, nsresult status);
NS_IMETHOD OnNotify(const char* url, nsresult status);
NS_IMETHOD GetStreamType(nsPluginStreamType *result);
////////////////////////////////////////////////////////////////////////////
// EventsPluginStreamListener specific methods:
EventsPluginStreamListener(EventsPluginInstance *inst_, const char* url);
virtual ~EventsPluginStreamListener(void);
protected:
const char* fMessageName;
EventsPluginInstance *inst;
};
// The module loader information.
static nsModuleComponentInfo gComponentInfo[] = {
{ "Events Sample Plugin",
NS_EVENTSAMPLEPLUGIN_CID,
NS_INLINE_PLUGIN_CONTRACTID_PREFIX PLUGIN_MIME_TYPE,
EventsPluginInstance::Create,
EventsPluginInstance::RegisterSelf,
EventsPluginInstance::UnregisterSelf },
};
NS_IMPL_NSGETMODULE("EventsPlugin", gComponentInfo);
////////////////////////////////////////////////////////////////////////////////
// EventsPluginInstance static Methods
////////////////////////////////////////////////////////////////////////////////
NS_METHOD
EventsPluginInstance::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aOuter == nsnull, "no aggregation");
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
EventsPluginInstance* plugin = new EventsPluginInstance();
if (! plugin)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv;
NS_ADDREF(plugin);
rv = plugin->QueryInterface(aIID, aResult);
NS_RELEASE(plugin);
return rv;
}
NS_METHOD
EventsPluginInstance::RegisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const char* aComponentType,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsIPluginManager* pm;
rv = nsServiceManager::GetService(kPluginManagerCID, NS_GET_IID(nsIPluginManager),
NS_REINTERPRET_CAST(nsISupports**, &pm));
if (NS_SUCCEEDED(rv)) {
rv = pm->RegisterPlugin(kEventsPluginCID,
kPluginName,
kPluginDescription,
kMimeTypes,
kMimeDescriptions,
kFileExtensions,
kNumMimeTypes);
NS_RELEASE(pm);
}
return rv;
}
NS_METHOD
EventsPluginInstance::UnregisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsIPluginManager* pm;
rv = nsServiceManager::GetService(kPluginManagerCID, NS_GET_IID(nsIPluginManager),
NS_REINTERPRET_CAST(nsISupports**, &pm));
if (NS_SUCCEEDED(rv)) {
rv = pm->UnregisterPlugin(kEventsPluginCID);
NS_RELEASE(pm);
}
return rv;
}
////////////////////////////////////////////////////////////////////////////////
// EventsPluginInstance Methods
////////////////////////////////////////////////////////////////////////////////
// These macros produce simple version of QueryInterface and AddRef.
// See the nsISupports.h header file for details.
NS_IMPL_ISUPPORTS2(EventsPluginInstance, nsIPluginInstance, nsIEventsSampleInstance)
EventsPluginInstance::EventsPluginInstance() :
fPeer(NULL), fWindow(NULL), fMode(nsPluginMode_Embedded)
{
NS_INIT_REFCNT();
wChild = 0;
}
EventsPluginInstance::~EventsPluginInstance(void) {
}
NS_METHOD EventsPluginInstance::Initialize(nsIPluginInstancePeer *peer) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::Initialize\n");
#endif
NS_ASSERTION(peer != NULL, "null peer");
fPeer = peer;
nsCOMPtr<nsIPluginTagInfo> taginfo;
const char* const* names = nsnull;
const char* const* values = nsnull;
PRUint16 count = 0;
nsresult result;
peer->AddRef();
result = peer->GetMode(&fMode);
if (NS_FAILED(result)) return result;
taginfo = do_QueryInterface(peer, &result);
if (!NS_FAILED(result)) {
taginfo->GetAttributes(count, names, values);
}
PlatformNew(); /* Call Platform-specific initializations */
return NS_OK;
}
NS_METHOD EventsPluginInstance::GetPeer(nsIPluginInstancePeer* *result) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::GetPeer\n");
#endif
*result = fPeer;
NS_IF_ADDREF(*result);
return NS_OK;
}
NS_METHOD EventsPluginInstance::Start(void) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::Start\n");
#endif
return NS_OK;
}
NS_METHOD EventsPluginInstance::Stop(void) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::Stop\n");
#endif
return NS_OK;
}
NS_METHOD EventsPluginInstance::Destroy(void) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::Destroy\n");
#endif
PlatformDestroy(); // Perform platform specific cleanup
return NS_OK;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++
* NPP_SetWindow:
* Sets the window in which a plug-in draws, and returns an error value.
*
* NPP_SetWindow informs the plug-in instance specified by instance of the
* the window denoted by window in which the instance draws. This nsPluginWindow
* pointer is valid for the life of the instance, or until NPP_SetWindow is called
* again with a different value. Subsequent calls to NPP_SetWindow for a given
* instance typically indicate that the window has been resized. If either window
* or window->window are NULL, the plug-in must not perform any additional
* graphics operations on the window and should free any resources associated
* with the window.
+++++++++++++++++++++++++++++++++++++++++++++++++*/
NS_METHOD EventsPluginInstance::SetWindow(nsPluginWindow* window) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::SetWindow\n");
#endif
nsresult result;
result = DoSetWindow(window);
fWindow = window;
return result;
}
nsresult EventsPluginInstance::DoSetWindow(nsPluginWindow* window) {
/*
* PLUGIN DEVELOPERS:
* Before setting window to point to the
* new window, you may wish to compare the new window
* info to the previous window (if any) to note window
* size changes, etc.
*/
nsresult result = NS_OK;
if ( fWindow != NULL ) {
// If we already have a window, clean it up
// before working with the new window
if ( window && window->window && wMain == (WinID)window->window ) {
/* The new window is the same as the old one. Exit now. */
PlatformResizeWindow(window);
return NS_OK;
}
// Otherwise, just reset the window ready for the new one.
PlatformResetWindow();
}
else if ( (window == NULL) || ( window->window == NULL ) ) {
/* We can just get out of here if there is no current
* window and there is no new window to use. */
return NS_OK;
}
if (window && window->window) {
// Remember our main parent window.
wMain = (WinID)window->window;
// And create the child window.
result = PlatformCreateWindow(window);
}
return result;
}
NS_METHOD EventsPluginInstance::NewStream(nsIPluginStreamListener** listener) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::NewStream\n");
#endif
if (listener != NULL) {
EventsPluginStreamListener* sl =
new EventsPluginStreamListener(this, "http://www.mozilla.org");
if (!sl)
return NS_ERROR_UNEXPECTED;
sl->AddRef();
*listener = sl;
}
return NS_OK;
}
NS_METHOD EventsPluginInstance::Print(nsPluginPrint* printInfo) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::Print\n");
#endif
if (printInfo == NULL)
return NS_ERROR_FAILURE;
if (printInfo->mode == nsPluginMode_Full) {
/*
* PLUGIN DEVELOPERS:
* If your plugin would like to take over
* printing completely when it is in full-screen mode,
* set printInfo->pluginPrinted to TRUE and print your
* plugin as you see fit. If your plugin wants Netscape
* to handle printing in this case, set
* printInfo->pluginPrinted to FALSE (the default) and
* do nothing. If you do want to handle printing
* yourself, printOne is true if the print button
* (as opposed to the print menu) was clicked.
* On the Macintosh, platformPrint is a THPrint; on
* Windows, platformPrint is a structure
* (defined in npapi.h) containing the printer name, port,
* etc.
*/
/* Do the default*/
printInfo->print.fullPrint.pluginPrinted = PR_FALSE;
} else { /* If not fullscreen, we must be embedded */
/*
* PLUGIN DEVELOPERS:
* If your plugin is embedded, or is full-screen
* but you returned false in pluginPrinted above, NPP_Print
* will be called with mode == nsPluginMode_Embedded. The nsPluginWindow
* in the printInfo gives the location and dimensions of
* the embedded plugin on the printed page. On the
* Macintosh, platformPrint is the printer port; on
* Windows, platformPrint is the handle to the printing
* device context.
*/
}
return NS_OK;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++
* NPP_HandleEvent:
* Mac-only, but stub must be present for Windows
* Delivers a platform-specific event to the instance.
*
* On the Macintosh, event is a pointer to a standard Macintosh EventRecord.
* All standard event types are passed to the instance as appropriate. In general,
* return TRUE if you handle the event and FALSE if you ignore the event.
+++++++++++++++++++++++++++++++++++++++++++++++++*/
NS_METHOD EventsPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* handled) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::HandleEvent\n");
#endif
*handled = (PRBool)PlatformHandleEvent(event);
return NS_OK;
}
NS_METHOD EventsPluginInstance::GetValue(nsPluginInstanceVariable /*variable*/, void * /*value*/) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::GetValue\n");
#endif
return NS_ERROR_FAILURE;
}
////////////////////////////////////////////////////////////////////////////////
// EventsPluginStreamListener Methods
////////////////////////////////////////////////////////////////////////////////
EventsPluginStreamListener::EventsPluginStreamListener(EventsPluginInstance* inst_,
const char* msgName)
: fMessageName(msgName), inst(inst_) {
NS_INIT_REFCNT();
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginStreamListener: EventsPluginStreamListener for %s\n", fMessageName);
#endif
}
EventsPluginStreamListener::~EventsPluginStreamListener(void) {
}
// This macro produces a simple version of QueryInterface, AddRef and Release.
// See the nsISupports.h header file for details.
NS_IMPL_ISUPPORTS1(EventsPluginStreamListener, nsIPluginStreamListener);
NS_METHOD EventsPluginStreamListener::OnStartBinding(nsIPluginStreamInfo * /*pluginInfo*/) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginStreamListener::OnStartBinding\n");
printf("EventsPluginStreamListener: Opening plugin stream for %s\n", fMessageName);
#endif
return NS_OK;
}
NS_METHOD EventsPluginStreamListener::OnDataAvailable(
nsIPluginStreamInfo * /*pluginInfo*/,
nsIInputStream* input,
PRUint32 length) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginStreamListener::OnDataAvailable\n");
#endif
char* buffer = new char[length];
if (buffer) {
PRUint32 amountRead = 0;
nsresult rslt = input->Read(buffer, length, &amountRead);
if (rslt == NS_OK) {
char msg[256];
sprintf(msg, "### Received %d bytes for %s\n", length, fMessageName);
}
delete buffer;
}
return NS_OK;
}
NS_METHOD EventsPluginStreamListener::OnFileAvailable(
nsIPluginStreamInfo * /*pluginInfo*/,
const char* fileName) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginStreamListener::OnFileAvailable\n");
#endif
char msg[256];
sprintf(msg, "### File available for %s: %s\n", fMessageName, fileName);
return NS_OK;
}
NS_METHOD EventsPluginStreamListener::OnStopBinding(
nsIPluginStreamInfo * /*pluginInfo*/,
nsresult /*status*/) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginStreamListener::OnStopBinding\n");
#endif
char msg[256];
sprintf(msg, "### Closing plugin stream for %s\n", fMessageName);
return NS_OK;
}
NS_METHOD EventsPluginStreamListener::OnNotify(const char * /*url*/, nsresult /*status*/) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginStreamListener::OnNotify\n");
#endif
return NS_OK;
}
NS_METHOD EventsPluginStreamListener::GetStreamType(nsPluginStreamType *result) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginStreamListener::GetStreamType\n");
#endif
*result = nsPluginStreamType_Normal;
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// Platform-Specific Implemenations
// UNIX Implementations
#ifdef XP_UNIX
void EventsPluginInstance::PlatformNew(void) {
fPlatform.moz_box = 0;
}
nsresult EventsPluginInstance::PlatformDestroy(void) {
// the mozbox will be destroyed by the native destruction of the
// widget's parent.
return NS_OK;
}
void EventsPluginInstance::PlatformResetWindow() {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::PlatformResetWindow\n");
#endif
fPlatform.moz_box = 0;
}
nsresult EventsPluginInstance::PlatformCreateWindow(nsPluginWindow* window) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::PlatformCreateWindow %lx\n", (long)window);
#endif
Window x_window = (Window)window->window;
GdkWindow *gdk_window = (GdkWindow *)gdk_xid_table_lookup(x_window);
if (!gdk_window) {
fprintf(stderr, "NO WINDOW!!!\n");
return NS_ERROR_FAILURE;
}
fPlatform.moz_box = gtk_mozbox_new(gdk_window);
wChild = gtk_entry_new();
gtk_container_add(GTK_CONTAINER(fPlatform.moz_box), wChild);
gtk_widget_show_all(fPlatform.moz_box);
return NS_OK;
}
void EventsPluginInstance::PlatformResizeWindow(nsPluginWindow* window) {
NS_PRECONDITION(wChild, "Have no wChild!");
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::PlatformResizeWindow to size (%d,%d)\n", window->width, window->height);
#endif
// Mozilla has already sized the mozbox - we just need to handle the child.
gtk_widget_set_usize(wChild, window->width, window->height);
}
int16 EventsPluginInstance::PlatformHandleEvent(nsPluginEvent * /*event*/) {
/* UNIX Plugins do not use HandleEvent */
return 0;
}
/* attribute string text; */
NS_IMETHODIMP EventsPluginInstance::GetVal(char * *aText) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::GetVal\n");
#endif
char *text = gtk_entry_get_text(GTK_ENTRY(wChild));
*aText = reinterpret_cast<char*>(nsAllocator::Clone(text, strlen(text) + 1));
return (*aText) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP EventsPluginInstance::SetVal(const char * aText) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::SetVal\n");
#endif
gtk_entry_set_text(GTK_ENTRY(wChild), aText);
return NS_OK;
}
#endif /* XP_UNIX */
// Windows Implementations
#if defined(XP_WIN)
void EventsPluginInstance::PlatformNew(void) {
// Nothing to do!
}
nsresult EventsPluginInstance::PlatformDestroy(void) {
wChild = 0;
return NS_OK;
}
nsresult EventsPluginInstance::PlatformCreateWindow(nsPluginWindow* window) {
// Remember parent wndproc.
fPlatform.fParentWindowProc = (WNDPROC)::GetWindowLong(wMain, GWL_WNDPROC);
NS_ABORT_IF_FALSE(fPlatform.fParentWindowProc!=NULL, "Couldn't get the parent WNDPROC");
// Create the child window that fills our nsWindow
RECT rc;
::GetWindowRect(wMain, &rc);
wChild = ::CreateWindow("Edit", // class - standard Windows edit control.
"", // title
WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL, // style
0, 0, rc.right-rc.left, rc.bottom-rc.top,
wMain, // parent
(HMENU)1111, // window ID
0, // instance
NULL); //creation data.
NS_ABORT_IF_FALSE(wChild != NULL, "Failed to create the child window!");
if (!wChild)
return NS_ERROR_FAILURE;
// Stash away our "this" pointer so our WNDPROC can talk to us.
::SetProp(wChild, gInstanceLookupString, (HANDLE)this);
fPlatform.fOldChildWindowProc =
(WNDPROC)::SetWindowLong( wChild,
GWL_WNDPROC,
(LONG)EventsPluginInstance::WndProcChild);
return NS_OK;
}
int16 EventsPluginInstance::PlatformHandleEvent(nsPluginEvent * /*event*/) {
return NS_OK;
}
void EventsPluginInstance::PlatformResetWindow() {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::PlatformResetWindow\n");
#endif
fPlatform.fParentWindowProc = NULL;
::SetWindowLong(wChild, GWL_WNDPROC, (LONG)fPlatform.fOldChildWindowProc);
fPlatform.fOldChildWindowProc = NULL;
wChild = NULL;
wMain = NULL;
}
void EventsPluginInstance::PlatformResizeWindow(nsPluginWindow* window) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::PlatformResizeWindow with new size (%d,%d)\n", window->width, window->height);
#endif
RECT rc;
NS_PRECONDITION(wMain != nsnull, "Must have a valid wMain to resize");
::GetClientRect(wMain, &rc);
::SetWindowPos(wChild, 0, rc.left, rc.top,
rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
}
/* attribute string text; */
NS_IMETHODIMP EventsPluginInstance::GetVal(char * *aText) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::GetVal\n");
#endif
static char *empty = "";
char *value = empty;
char buffer[256];
if (wChild) {
GetWindowText(wChild, buffer, sizeof(buffer)/sizeof(buffer[0]));
value = buffer;
}
*aText = reinterpret_cast<char*>(nsAllocator::Clone(value, strlen(value) + 1));
return (*aText) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP EventsPluginInstance::SetVal(const char * aText) {
#ifdef EVENTSPLUGIN_DEBUG
printf("EventsPluginInstance::SetVal\n");
#endif
NS_ABORT_IF_FALSE(wChild != 0, "Don't have a window!");
SetWindowText(wChild, aText);
return NS_OK;
}
// This is the WndProc for our child window (the edit control)
LRESULT CALLBACK EventsPluginInstance::WndProcChild(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
EventsPluginInstance* inst = (EventsPluginInstance*) GetProp(hWnd, gInstanceLookupString);
NS_ABORT_IF_FALSE(inst, "Could not get the inst from the Window!!");
switch (Msg) {
// NOTE: We DONT pass on DBLCLK messages, as both Scintilla and
// Mozilla have their own special logic, and they step on each other.
// (causing our child to see a double-click as a triple-click)
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_SYSKEYUP:
case WM_CHAR:
case WM_SYSCHAR:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MOUSEMOVE:
// pretend the message happened in our parent.
return ::CallWindowProc(inst->fPlatform.fParentWindowProc, (HWND)inst->wMain, Msg, wParam, lParam);
default:
// let our child's default handle it.
return ::CallWindowProc(inst->fPlatform.fOldChildWindowProc, hWnd, Msg, wParam, lParam);
}
/* not reached */
NS_ABORT_IF_FALSE(0, "not reached!");
}
#endif /* XP_WIN */

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

@ -880,5 +880,5 @@ static nsModuleComponentInfo gNetModuleInfo[] = {
};
NS_IMPL_NSGETMODULE_WITH_DTOR("necko core and primary protocols", gNetModuleInfo,
NS_IMPL_NSGETMODULE_WITH_DTOR(necko_core_and_primary_protocols, gNetModuleInfo,
nsNeckoShutdown)

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

@ -70,4 +70,4 @@ static nsModuleComponentInfo gNetModuleInfo[] = {
}
};
NS_IMPL_NSGETMODULE("necko secondary protocols", gNetModuleInfo)
NS_IMPL_NSGETMODULE(necko_secondary_protocols, gNetModuleInfo)

49
netwerk/cache/build/nsNetDataCacheModule.cpp поставляемый
Просмотреть файл

@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
*/
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nscore.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIGenericFactory.h"
#include "nsINetDataCache.h"
#include "nsINetDataCacheManager.h"
#include "nsMemCacheCID.h"
#include "nsMemCache.h"
#include "nsNetDiskCache.h"
#include "nsNetDiskCacheCID.h"
#include "nsCacheManager.h"
// Factory method to create a new nsMemCache instance. Used
// by nsNetDataCacheModule
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMemCache, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetDiskCache, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCacheManager, Init)
static nsModuleComponentInfo components[] = {
{ "Memory Cache", NS_MEM_CACHE_FACTORY_CID, NS_NETWORK_MEMORY_CACHE_CONTRACTID, nsMemCacheConstructor },
{ "File Cache", NS_NETDISKCACHE_CID, NS_NETWORK_FILE_CACHE_CONTRACTID, nsNetDiskCacheConstructor },
{ "Cache Manager",NS_CACHE_MANAGER_CID, NS_NETWORK_CACHE_MANAGER_CONTRACTID,nsCacheManagerConstructor }
};
NS_IMPL_NSGETMODULE("Network Data Cache", components)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше