Plugin DK, not part of the build, hopefully no duplicate files this time.
git-svn-id: svn://10.0.0.236/trunk@69270 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
55
mozilla/modules/plugin/tools/mpdk/basic/common/dbg.cpp
Normal file
55
mozilla/modules/plugin/tools/mpdk/basic/common/dbg.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* dbg.cpp
|
||||
*
|
||||
* This is a helper utility which allows diagnostic info in the output
|
||||
* window in debug project environment in more convenient way than
|
||||
* printf or OutputDebugString
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "xplat.h"
|
||||
|
||||
extern char szAppName[];
|
||||
|
||||
#ifdef _DEBUG
|
||||
void __cdecl dbgOut(LPSTR format, ...)
|
||||
{
|
||||
#ifdef XP_PC
|
||||
static char buf[1024];
|
||||
strcpy(buf, szAppName);
|
||||
strcat(buf, ": ");
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
wvsprintf(&buf[lstrlen(buf)], format, va);
|
||||
va_end(va);
|
||||
strcat(buf, "\n");
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
169
mozilla/modules/plugin/tools/mpdk/basic/common/instbase.cpp
Normal file
169
mozilla/modules/plugin/tools/mpdk/basic/common/instbase.cpp
Normal file
@@ -0,0 +1,169 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* instbase.cpp
|
||||
*
|
||||
* Implementation of the platform independent part of the plugin instance
|
||||
* Eventual implementation is expected to be derived from this class
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "xplat.h"
|
||||
#include "instbase.h"
|
||||
#include "listener.h"
|
||||
|
||||
#include "dbg.h"
|
||||
|
||||
extern PRUint32 gPluginObjectCount;
|
||||
|
||||
static NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID);
|
||||
|
||||
CPluginInstance::CPluginInstance() :
|
||||
fPeer(nsnull),
|
||||
fWindow(nsnull),
|
||||
fMode(nsPluginMode_Embedded)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
gPluginObjectCount++;
|
||||
dbgOut2("CPluginInstance::CPluginInstance(), gPluginObjectCount = %lu", gPluginObjectCount);
|
||||
}
|
||||
|
||||
CPluginInstance::~CPluginInstance()
|
||||
{
|
||||
gPluginObjectCount--;
|
||||
dbgOut2("CPluginInstance::~CPluginInstance(), gPluginObjectCount = %lu", gPluginObjectCount);
|
||||
}
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(CPluginInstance, kIPluginInstanceIID);
|
||||
NS_IMPL_ADDREF(CPluginInstance);
|
||||
NS_IMPL_RELEASE(CPluginInstance);
|
||||
|
||||
NS_METHOD CPluginInstance::Initialize(nsIPluginInstancePeer* peer)
|
||||
{
|
||||
dbgOut1("CPluginInstance::Initialize");
|
||||
|
||||
if(peer == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
fPeer = peer;
|
||||
peer->AddRef();
|
||||
|
||||
nsresult rv;
|
||||
rv = peer->GetMode(&fMode);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsIPluginTagInfo* taginfo;
|
||||
const char* const* names = nsnull;
|
||||
const char* const* values = nsnull;
|
||||
PRUint16 count = 0;
|
||||
|
||||
rv = peer->QueryInterface(NS_GET_IID(nsIPluginTagInfo), (void **)&taginfo);
|
||||
|
||||
if(!NS_FAILED(rv))
|
||||
{
|
||||
taginfo->GetAttributes(count, names, values);
|
||||
NS_IF_RELEASE(taginfo);
|
||||
}
|
||||
|
||||
PlatformNew();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::GetPeer(nsIPluginInstancePeer* *result)
|
||||
{
|
||||
dbgOut1("CPluginInstance::GetPeer");
|
||||
|
||||
fPeer->AddRef();
|
||||
*result = fPeer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::Start()
|
||||
{
|
||||
dbgOut1("CPluginInstance::Start");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::Stop()
|
||||
{
|
||||
dbgOut1("CPluginInstance::Stop");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::Destroy()
|
||||
{
|
||||
dbgOut1("CPluginInstance::Destroy");
|
||||
PlatformDestroy();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
{
|
||||
dbgOut1("CPluginInstance::SetWindow");
|
||||
nsresult rv;
|
||||
rv = PlatformSetWindow(window);
|
||||
fWindow = window;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::NewStream(nsIPluginStreamListener** result)
|
||||
{
|
||||
dbgOut1("CPluginInstance::NewStream");
|
||||
|
||||
if(result == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
CPluginStreamListener * listener = new CPluginStreamListener(this, "http://warp");
|
||||
|
||||
if(listener == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*result = listener;
|
||||
|
||||
NS_ADDREF(listener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::Print(nsPluginPrint* printInfo)
|
||||
{
|
||||
dbgOut1("CPluginInstance::Print");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* handled)
|
||||
{
|
||||
dbgOut1("CPluginInstance::HandleEvent");
|
||||
*handled = (PRBool)PlatformHandleEvent(event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginInstance::GetValue(nsPluginInstanceVariable variable, void *value)
|
||||
{
|
||||
dbgOut1("CPluginInstance::GetValue");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
117
mozilla/modules/plugin/tools/mpdk/basic/common/listener.cpp
Normal file
117
mozilla/modules/plugin/tools/mpdk/basic/common/listener.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* listener.cpp
|
||||
*
|
||||
* Implementation of the plugin stream listener class
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "xplat.h"
|
||||
#include "listener.h"
|
||||
#include "dbg.h"
|
||||
|
||||
extern PRUint32 gPluginObjectCount;
|
||||
|
||||
static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
|
||||
|
||||
CPluginStreamListener::CPluginStreamListener(CPluginInstance* inst, const char* msgName) :
|
||||
fMessageName(msgName)
|
||||
{
|
||||
gPluginObjectCount++;
|
||||
NS_INIT_REFCNT();
|
||||
dbgOut3("CPluginStreamListener::CPluginStreamListener, message '%s', gPluginObjectCount = %lu",
|
||||
fMessageName, gPluginObjectCount);
|
||||
}
|
||||
|
||||
CPluginStreamListener::~CPluginStreamListener()
|
||||
{
|
||||
gPluginObjectCount--;
|
||||
dbgOut2("CPluginStreamListener::~CPluginStreamListener, gPluginObjectCount = %lu", gPluginObjectCount);
|
||||
}
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(CPluginStreamListener, kIPluginStreamListenerIID)
|
||||
NS_IMPL_ADDREF(CPluginStreamListener)
|
||||
NS_IMPL_RELEASE(CPluginStreamListener)
|
||||
|
||||
NS_METHOD CPluginStreamListener::OnStartBinding(nsIPluginStreamInfo* streamInfo)
|
||||
{
|
||||
dbgOut1("CPluginStreamListener::OnStartBinding");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* streamInfo,
|
||||
nsIInputStream* inputStream,
|
||||
PRUint32 length)
|
||||
{
|
||||
dbgOut1("CPluginStreamListener::OnDataAvailable");
|
||||
|
||||
char* buffer = new char[length];
|
||||
|
||||
if(buffer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRUint32 amountRead = 0;
|
||||
|
||||
nsresult rv = inputStream->Read(buffer, length, &amountRead);
|
||||
|
||||
if(rv == NS_OK)
|
||||
{
|
||||
dbgOut2("\t\tReceived %lu bytes", length);
|
||||
}
|
||||
|
||||
delete buffer;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* streamInfo, const char* fileName)
|
||||
{
|
||||
dbgOut1("CPluginStreamListener::OnFileAvailable");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* streamInfo, nsresult status)
|
||||
{
|
||||
dbgOut1("CPluginStreamListener::OnStopBinding");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginStreamListener::OnNotify(const char* url, nsresult status)
|
||||
{
|
||||
dbgOut1("CPluginStreamListener::OnNotify");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPluginStreamListener::GetStreamType(nsPluginStreamType *result)
|
||||
{
|
||||
dbgOut1("CPluginStreamListener::GetStreamType");
|
||||
|
||||
*result = nsPluginStreamType_Normal;
|
||||
return NS_OK;
|
||||
}
|
||||
168
mozilla/modules/plugin/tools/mpdk/basic/common/npentry.cpp
Normal file
168
mozilla/modules/plugin/tools/mpdk/basic/common/npentry.cpp
Normal file
@@ -0,0 +1,168 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* npentry.cpp
|
||||
*
|
||||
* Netscape entry points for XPCom registration
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "xplat.h"
|
||||
#include "plugin.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "dbg.h"
|
||||
|
||||
char szAppName[] = "*** Basic60";
|
||||
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
static NS_DEFINE_CID(kPluginCID, NS_PLUGIN_CID);
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kBasicPluginCID, NS_BASICPLUGIN_CID);
|
||||
|
||||
extern PRUint32 gPluginObjectCount;
|
||||
extern PRBool gPluginLocked;
|
||||
|
||||
extern "C" NS_EXPORT
|
||||
nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aCID,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
dbgOut1("NSGetFactory");
|
||||
|
||||
if(aFactory == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = nsnull;
|
||||
|
||||
CPlugin* inst;
|
||||
|
||||
if (aCID.Equals(kBasicPluginCID))
|
||||
inst = new CPlugin();
|
||||
else if (aCID.Equals(kPluginCID))
|
||||
inst = new CPlugin();
|
||||
else
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
if(inst == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = inst->QueryInterface(kIFactoryIID, (void **)aFactory);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
delete inst;
|
||||
|
||||
return rv;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT
|
||||
PRBool NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
dbgOut1("NSCanUnload");
|
||||
|
||||
return (gPluginObjectCount == 1 && !gPluginLocked);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT
|
||||
nsresult NSRegisterSelf(nsISupports *serviceMgr, const char *path)
|
||||
{
|
||||
dbgOut1("NSRegisterSelf");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
char buf[255];
|
||||
|
||||
nsCString progID(NS_INLINE_PLUGIN_PROGID_PREFIX);
|
||||
|
||||
// We will use the service manager to obtain the component
|
||||
// manager, which will enable us to register a component
|
||||
// with a ProgID (text string) instead of just the CID.
|
||||
nsIServiceManager *sm;
|
||||
|
||||
// We can get the IID of an interface with the static GetIID() method as well
|
||||
rv = serviceMgr->QueryInterface(NS_GET_IID(nsIServiceManager), (void **)&sm);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsIComponentManager *cm;
|
||||
|
||||
rv = sm->GetService(kComponentManagerCID, NS_GET_IID(nsIComponentManager), (nsISupports **)&cm);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
{
|
||||
NS_RELEASE(sm);
|
||||
return rv;
|
||||
}
|
||||
|
||||
progID += PLUGIN_MIME_TYPE;
|
||||
progID.ToCString(buf, 255);
|
||||
|
||||
rv = cm->RegisterComponent(kBasicPluginCID, PLUGIN_NAME, buf, path, PR_TRUE, PR_TRUE);
|
||||
|
||||
sm->ReleaseService(kComponentManagerCID, cm);
|
||||
|
||||
NS_RELEASE(sm);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT
|
||||
nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
dbgOut1("NSUnregisterSelf");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsIServiceManager *sm;
|
||||
|
||||
rv = serviceMgr->QueryInterface(NS_GET_IID(nsIServiceManager), (void **)&sm);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsIComponentManager *cm;
|
||||
|
||||
rv = sm->GetService(kComponentManagerCID, NS_GET_IID(nsIComponentManager), (nsISupports **)&cm);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
{
|
||||
NS_RELEASE(sm);
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = cm->UnregisterComponent(kBasicPluginCID, path);
|
||||
|
||||
sm->ReleaseService(kComponentManagerCID, cm);
|
||||
|
||||
NS_RELEASE(sm);
|
||||
|
||||
return rv;
|
||||
}
|
||||
174
mozilla/modules/plugin/tools/mpdk/basic/common/plugin.cpp
Normal file
174
mozilla/modules/plugin/tools/mpdk/basic/common/plugin.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* plugin.cpp
|
||||
*
|
||||
* Implementation of the plugin class
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "xplat.h"
|
||||
#include "plugin.h"
|
||||
#include "instbase.h"
|
||||
|
||||
#include "dbg.h"
|
||||
|
||||
PRUint32 gPluginObjectCount = 0;
|
||||
PRBool gPluginLocked = PR_FALSE;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
|
||||
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
||||
static NS_DEFINE_IID(kIServiceManagerIID, NS_ISERVICEMANAGER_IID);
|
||||
|
||||
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
|
||||
|
||||
CPlugin::CPlugin() :
|
||||
mPluginManager(NULL),
|
||||
mServiceManager(NULL)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
if(nsComponentManager::CreateInstance(kCPluginManagerCID, NULL, kIPluginManagerIID, (void**)&mPluginManager) != NS_OK)
|
||||
return;
|
||||
|
||||
gPluginObjectCount++;
|
||||
dbgOut2("CPlugin::CPlugin(), gPluginObjectCount = %lu", gPluginObjectCount);
|
||||
}
|
||||
|
||||
CPlugin::~CPlugin()
|
||||
{
|
||||
if(mPluginManager)
|
||||
mPluginManager->Release();
|
||||
|
||||
if(mServiceManager)
|
||||
mServiceManager->Release();
|
||||
|
||||
gPluginObjectCount--;
|
||||
|
||||
dbgOut2("CPlugin::~CPlugin(), gPluginObjectCount = %lu", gPluginObjectCount);
|
||||
}
|
||||
|
||||
NS_METHOD CPlugin::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
dbgOut1("CPlugin::QueryInterface");
|
||||
|
||||
if (NULL == aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupports*,this);
|
||||
else if (aIID.Equals(kIFactoryIID))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupports*,NS_STATIC_CAST(nsIFactory*,this));
|
||||
else if (aIID.Equals(kIPluginIID))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupports*,NS_STATIC_CAST(nsIPlugin*,this));
|
||||
else
|
||||
{
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*,*aInstancePtr));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(CPlugin);
|
||||
NS_IMPL_RELEASE(CPlugin);
|
||||
|
||||
NS_METHOD CPlugin::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
dbgOut1("CPlugin::CreateInstance");
|
||||
|
||||
CPluginInstance * inst = Platform_CreatePluginInstance(aOuter, aIID, nsnull);
|
||||
|
||||
if (inst == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
inst->AddRef();
|
||||
*aResult = (void *)inst;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPlugin::CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType, void **aResult)
|
||||
{
|
||||
dbgOut1("CreatePluginInstance");
|
||||
|
||||
CPluginInstance * inst = Platform_CreatePluginInstance(aOuter, aIID, aPluginMIMEType);
|
||||
|
||||
if (inst == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
inst->AddRef();
|
||||
*aResult = (void *)inst;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPlugin::LockFactory(PRBool aLock)
|
||||
{
|
||||
dbgOut1("CPlugin::LockFactory");
|
||||
|
||||
gPluginLocked = aLock;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPlugin::Initialize()
|
||||
{
|
||||
dbgOut1("CPlugin::Initialize");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPlugin::Shutdown(void)
|
||||
{
|
||||
dbgOut1("CPlugin::Shutdown");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPlugin::GetMIMEDescription(const char **result)
|
||||
{
|
||||
dbgOut1("CPlugin::GetMIMEDescription");
|
||||
|
||||
*result = PLUGIN_MIMEDESCRIPTION;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD CPlugin::GetValue(nsPluginVariable variable, void *value)
|
||||
{
|
||||
dbgOut1("");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (variable == nsPluginVariable_NameString)
|
||||
*((char **)value) = PLUGIN_NAME;
|
||||
else if (variable == nsPluginVariable_DescriptionString)
|
||||
*((char **)value) = PLUGIN_DESCRIPTION;
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
30
mozilla/modules/plugin/tools/mpdk/basic/include/basiccid.h
Normal file
30
mozilla/modules/plugin/tools/mpdk/basic/include/basiccid.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BASICCID_H__
|
||||
#define __BASICCID_H__
|
||||
|
||||
// {D8A32288-207E-11d4-9CC2-0060B0FBD8AC}
|
||||
#define NS_BASICPLUGIN_CID { 0xd8a32288, 0x207e, 0x11d4, { 0x9c, 0xc2, 0x0, 0x60, 0xb0, 0xfb, 0xd8, 0xac } }
|
||||
|
||||
#endif
|
||||
51
mozilla/modules/plugin/tools/mpdk/basic/include/dbg.h
Normal file
51
mozilla/modules/plugin/tools/mpdk/basic/include/dbg.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DBG_H_
|
||||
#define __DBG_H_
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
void __cdecl dbgOut(LPSTR format, ...);
|
||||
#define dbgOut1(x) dbgOut(x)
|
||||
#define dbgOut2(x,y) dbgOut(x, y)
|
||||
#define dbgOut3(x,y,z) dbgOut(x, y, z)
|
||||
#define dbgOut4(x,y,z,t) dbgOut(x, y, z, t)
|
||||
#define dbgOut5(x,y,z,t,u) dbgOut(x, y, z, t, u)
|
||||
#define dbgOut6(x,y,z,t,u,v) dbgOut(x, y, z, t, u, v)
|
||||
#define dbgOut7(x,y,z,t,u,v, a) dbgOut(x, y, z, t, u, v, a)
|
||||
#define dbgOut8(x,y,z,t,u,v, a, b) dbgOut(x, y, z, t, u, v, a, b)
|
||||
|
||||
#else
|
||||
|
||||
#define dbgOut1(x) ((void)0)
|
||||
#define dbgOut2(x,y) ((void)0)
|
||||
#define dbgOut3(x,y,z) ((void)0)
|
||||
#define dbgOut4(x,y,z,t) ((void)0)
|
||||
#define dbgOut5(x,y,z,t,u) ((void)0)
|
||||
#define dbgOut6(x,y,z,t,u,v) ((void)0)
|
||||
#define dbgOut7(x,y,z,t,u,v,a) ((void)0)
|
||||
#define dbgOut8(x,y,z,t,u,v,a,b) ((void)0)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
94
mozilla/modules/plugin/tools/mpdk/basic/include/instbase.h
Normal file
94
mozilla/modules/plugin/tools/mpdk/basic/include/instbase.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __INSTANCEBASE_H__
|
||||
#define __INSTANCEBASE_H__
|
||||
|
||||
#include "nsplugin.h"
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* CPluginInstance class is the class for all our plugins our plugin
|
||||
* instances. This is abstract class, platform specific method are
|
||||
* to be implemented in derived class for a specific platform.
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
class CPluginInstance : public nsIPluginInstance
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// (Corresponds to NPP_HandleEvent.)
|
||||
// Note that for Unix and Mac the nsPluginEvent structure is different
|
||||
// from the old NPEvent structure -- it's no longer the native event
|
||||
// record, but is instead a struct. This was done for future extensibility,
|
||||
// and so that the Mac could receive the window argument too. For Windows
|
||||
// and OS2, it's always been a struct, so there's no change for them.
|
||||
NS_IMETHOD HandleEvent(nsPluginEvent* event, PRBool* handled);
|
||||
|
||||
NS_IMETHOD Initialize(nsIPluginInstancePeer* peer);
|
||||
NS_IMETHOD GetPeer(nsIPluginInstancePeer* *result);
|
||||
|
||||
// This method is called when the plugin instance is to be started.
|
||||
// This happens in two circumstances: (1) after the plugin instance
|
||||
// is first initialized, and (2) after a plugin instance is returned to
|
||||
// (e.g. by going back in the window history) after previously being stopped
|
||||
// by the Stop method.
|
||||
NS_IMETHOD Start();
|
||||
|
||||
// This method is called when the plugin instance is to be stopped (e.g. by
|
||||
// displaying another plugin manager window, causing the page containing
|
||||
// the plugin to become removed from the display).
|
||||
NS_IMETHOD Stop();
|
||||
|
||||
// This is called once, before the plugin instance peer is to be
|
||||
// destroyed. This method is used to destroy the plugin instance.
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
// (Corresponds to NPP_SetWindow.)
|
||||
NS_IMETHOD SetWindow(nsPluginWindow* window);
|
||||
|
||||
NS_IMETHOD NewStream(nsIPluginStreamListener** result);
|
||||
NS_IMETHOD Print(nsPluginPrint* platformPrint);
|
||||
NS_IMETHOD GetValue(nsPluginInstanceVariable variable, void *value);
|
||||
|
||||
CPluginInstance();
|
||||
virtual ~CPluginInstance();
|
||||
|
||||
// Platrorm specific methods, which need to be implemented in the derived class
|
||||
virtual nsresult PlatformNew() = 0;
|
||||
virtual nsresult PlatformDestroy() = 0;
|
||||
virtual nsresult PlatformSetWindow(nsPluginWindow* window) = 0;
|
||||
virtual PRInt16 PlatformHandleEvent(nsPluginEvent* event) = 0;
|
||||
|
||||
protected:
|
||||
nsIPluginInstancePeer* fPeer;
|
||||
nsPluginWindow* fWindow;
|
||||
nsPluginMode fMode;
|
||||
};
|
||||
|
||||
CPluginInstance * Platform_CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType);
|
||||
|
||||
#endif
|
||||
58
mozilla/modules/plugin/tools/mpdk/basic/include/listener.h
Normal file
58
mozilla/modules/plugin/tools/mpdk/basic/include/listener.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LISTENER_H__
|
||||
#define _LISTENER_H__
|
||||
|
||||
#include "plugin.h"
|
||||
#include "instbase.h"
|
||||
|
||||
class CPluginStreamListener : public nsIPluginStreamListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//This method is called at the beginning of a URL load
|
||||
NS_IMETHOD OnStartBinding(nsIPluginStreamInfo* streamInfo);
|
||||
|
||||
//This method is called when data is available in the input stream.
|
||||
NS_IMETHOD OnDataAvailable(nsIPluginStreamInfo* streamInfo, nsIInputStream* inputStream, PRUint32 length);
|
||||
|
||||
NS_IMETHOD OnFileAvailable(nsIPluginStreamInfo* streamInfo, const char* fileName);
|
||||
|
||||
//This method is called when a URL has finished loading.
|
||||
NS_IMETHOD OnStopBinding(nsIPluginStreamInfo* streamInfo, nsresult status);
|
||||
|
||||
NS_IMETHOD OnNotify(const char* url, nsresult status);
|
||||
|
||||
NS_IMETHOD GetStreamType(nsPluginStreamType *result);
|
||||
|
||||
CPluginStreamListener(CPluginInstance* inst, const char* url);
|
||||
virtual ~CPluginStreamListener();
|
||||
|
||||
protected:
|
||||
const char* fMessageName;
|
||||
};
|
||||
|
||||
#endif // _LISTENER_H__
|
||||
79
mozilla/modules/plugin/tools/mpdk/basic/include/plugin.h
Normal file
79
mozilla/modules/plugin/tools/mpdk/basic/include/plugin.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PLUGIN_HPP__
|
||||
#define __PLUGIN_HPP__
|
||||
|
||||
#include "nsplugin.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "basiccid.h"
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* CPlugin class is the class for all our plugins. We crteate all
|
||||
* our plugin instances using one instance of this class.
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
class CPlugin : public nsIPlugin
|
||||
{
|
||||
protected:
|
||||
nsIPluginManager* mPluginManager;
|
||||
nsIServiceManager* mServiceManager;
|
||||
|
||||
public:
|
||||
NS_IMETHOD CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType, void **aResult);
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
// This call initializes the plugin and will be called before any new
|
||||
// instances are created. It is passed browserInterfaces on which QueryInterface
|
||||
// may be used to obtain an nsIPluginManager, and other interfaces.
|
||||
NS_IMETHOD Initialize(void);
|
||||
|
||||
// (Corresponds to NPP_Shutdown.)
|
||||
// Called when the browser is done with the plugin factory, or when
|
||||
// the plugin is disabled by the user.
|
||||
NS_IMETHOD Shutdown(void);
|
||||
|
||||
// (Corresponds to NPP_GetMIMEDescription.)
|
||||
NS_IMETHOD GetMIMEDescription(const char* *result);
|
||||
|
||||
// (Corresponds to NPP_GetValue.)
|
||||
NS_IMETHOD GetValue(nsPluginVariable variable, void *value);
|
||||
|
||||
CPlugin();
|
||||
virtual ~CPlugin(void);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsIPluginManager* GetPluginManager(void) { return mPluginManager; }
|
||||
};
|
||||
|
||||
#define PLUGIN_NAME "Basic Plugin"
|
||||
#define PLUGIN_DESCRIPTION "Basic Plugin Example"
|
||||
#define PLUGIN_MIMEDESCRIPTION "application/basicplugin-test:bpl:Basic Plugin";
|
||||
#define PLUGIN_MIME_TYPE "application/basicplugin-test"
|
||||
|
||||
#endif // __PLUGIN_HPP__
|
||||
38
mozilla/modules/plugin/tools/mpdk/basic/include/xplat.h
Normal file
38
mozilla/modules/plugin/tools/mpdk/basic/include/xplat.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* This shoud contain platform specific system include files
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#ifndef __XP_H__
|
||||
#define __XP_H__
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#endif // __XP_H__
|
||||
159
mozilla/modules/plugin/tools/mpdk/basic/windows/basic.dsp
Normal file
159
mozilla/modules/plugin/tools/mpdk/basic/windows/basic.dsp
Normal file
@@ -0,0 +1,159 @@
|
||||
# Microsoft Developer Studio Project File - Name="basic" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=basic - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "basic.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "basic.mak" CFG="basic - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "basic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "basic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "basic - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "basic___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "basic___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\include" /I "..\..\mozilla\include" /I "..\..\mozilla\release\include" /D "XP_PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 ..\..\mozilla\release\lib\xpcom.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "basic - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "basic___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "basic___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\..\mozilla\include" /I "..\..\mozilla\debug\include" /D "DEBUG" /D "XP_PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\mozilla\debug\lib\xpcom.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "basic - Win32 Release"
|
||||
# Name "basic - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\common\dbg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\common\instbase.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\instwin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\common\listener.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\common\npentry.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\common\plugin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\winentry.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\basiccid.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\dbg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\instbase.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\instwin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\listener.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\plugin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xplat.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
29
mozilla/modules/plugin/tools/mpdk/basic/windows/basic.dsw
Normal file
29
mozilla/modules/plugin/tools/mpdk/basic/windows/basic.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "basic"=.\basic.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
220
mozilla/modules/plugin/tools/mpdk/basic/windows/instwin.cpp
Normal file
220
mozilla/modules/plugin/tools/mpdk/basic/windows/instwin.cpp
Normal file
@@ -0,0 +1,220 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* instwin.cpp
|
||||
*
|
||||
* Implementation of the plugin instance class for Windows
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "instwin.h"
|
||||
#include "dbg.h"
|
||||
|
||||
CPluginInstance * Platform_CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType)
|
||||
{
|
||||
CPluginInstanceWin *inst = new CPluginInstanceWin();
|
||||
return (CPluginInstance *)inst;
|
||||
}
|
||||
|
||||
/*------------------------------------
|
||||
* CPluginInstanceWin implementation
|
||||
*-----------------------------------*/
|
||||
|
||||
CPluginInstanceWin::CPluginInstanceWin() : CPluginInstance()
|
||||
{
|
||||
dbgOut1("CPluginInstanceWin::CPluginInstanceWin");
|
||||
platform = nsnull;
|
||||
}
|
||||
|
||||
CPluginInstanceWin::~CPluginInstanceWin()
|
||||
{
|
||||
dbgOut1("CPluginInstanceWin::~CPluginInstanceWin");
|
||||
}
|
||||
|
||||
nsresult CPluginInstanceWin::PlatformNew()
|
||||
{
|
||||
dbgOut1("CPluginInstanceWin::PlatformNew");
|
||||
|
||||
platform = new CPlatformWin();
|
||||
|
||||
if(platform == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CPluginInstanceWin::PlatformDestroy()
|
||||
{
|
||||
dbgOut1("CPluginInstanceWin::PlatformDestroy");
|
||||
|
||||
if(platform != nsnull)
|
||||
{
|
||||
delete platform;
|
||||
platform = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CPluginInstanceWin::PlatformSetWindow(nsPluginWindow* window)
|
||||
{
|
||||
dbgOut1("CPluginInstanceWin::PlatformSetWindow");
|
||||
|
||||
if(fWindow == nsnull) // we do not have a window yet
|
||||
{
|
||||
// platform should not be initialized if(fWindow == nsnull) but...
|
||||
if(platform->m_bInitialized)
|
||||
platform->shut();
|
||||
|
||||
if(window == nsnull) // not very meaningful if(fWindow == nsnull)
|
||||
return NS_OK;
|
||||
|
||||
if(window->window != nsnull) // spurious entry
|
||||
return platform->init(window);
|
||||
else // First time in
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
else // (fWindow != nsnull), we already have a window
|
||||
|
||||
{
|
||||
if((window == nsnull) || (window->window == nsnull)) // window went away
|
||||
{
|
||||
if(platform->m_bInitialized)
|
||||
platform->shut();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if(!platform->m_bInitialized) // First time in
|
||||
return platform->init(window);
|
||||
else
|
||||
{ // Netscape window has been resized or changed
|
||||
if(platform->m_hWnd != (HWND)window->window) // changed
|
||||
{
|
||||
platform->shut();
|
||||
return platform->init(window);
|
||||
}
|
||||
else // resized?
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt16 CPluginInstanceWin::PlatformHandleEvent(nsPluginEvent* event)
|
||||
{
|
||||
dbgOut1("CPluginInstanceWin::PlatformHandleEvent");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*------------------------------------
|
||||
* CPlatformWin implementation
|
||||
*-----------------------------------*/
|
||||
|
||||
static LRESULT CALLBACK PluginWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
CPlatformWin::CPlatformWin() :
|
||||
m_bInitialized(PR_FALSE),
|
||||
m_hWnd(nsnull),
|
||||
m_OldWindowProc(nsnull)
|
||||
{
|
||||
dbgOut1("CPlatformWin::CPlatformWin");
|
||||
}
|
||||
|
||||
CPlatformWin::~CPlatformWin()
|
||||
{
|
||||
dbgOut1("CPlatformWin::~CPlatformWin");
|
||||
}
|
||||
|
||||
nsresult CPlatformWin::init(nsPluginWindow * window)
|
||||
{
|
||||
dbgOut1("CPlatformWin::init");
|
||||
|
||||
m_hWnd = (HWND)window->window;
|
||||
|
||||
if(!IsWindow(m_hWnd))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
m_OldWindowProc = SubclassWindow(m_hWnd, (WNDPROC)PluginWindowProc);
|
||||
m_bInitialized = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void CPlatformWin::shut()
|
||||
{
|
||||
dbgOut1("CPlatformWin::shut");
|
||||
|
||||
if(m_hWnd != nsnull)
|
||||
{
|
||||
SubclassWindow(m_hWnd, m_OldWindowProc);
|
||||
m_OldWindowProc = nsnull;
|
||||
m_hWnd = nsnull;
|
||||
}
|
||||
m_bInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
/*------------------------------------
|
||||
* Window message handlers
|
||||
*-----------------------------------*/
|
||||
|
||||
static void onPaint(HWND hWnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC = BeginPaint(hWnd, &ps);
|
||||
HBRUSH hBrush = CreateSolidBrush(RGB(0,255,0));
|
||||
HBRUSH hBrushOld = SelectBrush(hDC, hBrush);
|
||||
RECT rc;
|
||||
GetClientRect(hWnd, &rc);
|
||||
FillRect(hDC, &rc, hBrush);
|
||||
SelectBrush(hDC, hBrushOld);
|
||||
DeleteBrush(hBrush);
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
||||
static void onDestroyWindow(HWND hWnd)
|
||||
{
|
||||
dbgOut1("onDestroyWindow");
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK PluginWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
HANDLE_WM_PAINT(hWnd, wParam, lParam, onPaint);
|
||||
return 0L;
|
||||
case WM_DESTROY:
|
||||
HANDLE_WM_DESTROY(hWnd, wParam, lParam, onDestroyWindow);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
57
mozilla/modules/plugin/tools/mpdk/basic/windows/instwin.h
Normal file
57
mozilla/modules/plugin/tools/mpdk/basic/windows/instwin.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __INSTWIN_H__
|
||||
#define __INSTWIN_H__
|
||||
|
||||
#include "instbase.h"
|
||||
|
||||
class CPlatformWin
|
||||
{
|
||||
public:
|
||||
nsresult init(nsPluginWindow * window);
|
||||
void shut();
|
||||
|
||||
CPlatformWin();
|
||||
~CPlatformWin();
|
||||
|
||||
HWND m_hWnd;
|
||||
WNDPROC m_OldWindowProc;
|
||||
PRBool m_bInitialized;
|
||||
};
|
||||
|
||||
class CPluginInstanceWin : public CPluginInstance
|
||||
{
|
||||
nsresult PlatformNew();
|
||||
nsresult PlatformDestroy();
|
||||
nsresult PlatformSetWindow(nsPluginWindow* window);
|
||||
PRInt16 PlatformHandleEvent(nsPluginEvent* event);
|
||||
|
||||
public:
|
||||
CPluginInstanceWin();
|
||||
~CPluginInstanceWin();
|
||||
|
||||
CPlatformWin * platform;
|
||||
};
|
||||
|
||||
#endif //__INSTWIN_H__
|
||||
@@ -0,0 +1,9 @@
|
||||
<HTML><BODY>
|
||||
|
||||
|
||||
<object type="application/basicplugin-test">alternative text </object>
|
||||
|
||||
|
||||
</BODY></HTML>
|
||||
|
||||
<BR>
|
||||
70
mozilla/modules/plugin/tools/mpdk/basic/windows/winentry.cpp
Normal file
70
mozilla/modules/plugin/tools/mpdk/basic/windows/winentry.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mainly for debug purposes and in case we need a handle
|
||||
* to application Windows instance
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* winentry.cpp
|
||||
*
|
||||
* Windows entry point. Mainly for debug purposes.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "dbg.h"
|
||||
|
||||
HINSTANCE hInst = NULL;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
char szReason[80];
|
||||
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
strcpy(szReason, "DLL_PROCESS_ATTACH");
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
strcpy(szReason, "DLL_THREAD_ATTACH");
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
strcpy(szReason, "DLL_PROCESS_DETACH");
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
strcpy(szReason, "DLL_THREAD_DETACH");
|
||||
break;
|
||||
}
|
||||
|
||||
dbgOut2("DllMain -- %s", szReason);
|
||||
#endif
|
||||
|
||||
hInst = hDLL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
Reference in New Issue
Block a user