1998-07-28 06:07:25 +04:00
|
|
|
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO: Implement Java callbacks
|
|
|
|
|
|
|
|
#include "xp_core.h"
|
|
|
|
#include "nsplugin.h"
|
|
|
|
#include "ns4xPlugin.h"
|
1998-08-01 09:46:47 +04:00
|
|
|
#include "ns4xPluginInstance.h"
|
1999-03-07 01:32:47 +03:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIAllocator.h"
|
1999-03-12 01:48:58 +03:00
|
|
|
#include "nsIPluginStreamListener.h"
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
NPNetscapeFuncs ns4xPlugin::CALLBACKS;
|
1998-08-01 09:46:47 +04:00
|
|
|
nsIPluginManager * ns4xPlugin::mPluginManager;
|
1999-03-12 01:48:58 +03:00
|
|
|
nsIAllocator * ns4xPlugin::mMalloc;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
ns4xPlugin::CheckClassInitialized(void)
|
|
|
|
{
|
|
|
|
static PRBool initialized = FALSE;
|
|
|
|
|
|
|
|
if (initialized)
|
|
|
|
return;
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
mPluginManager = nsnull;
|
|
|
|
mMalloc = nsnull;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
// XXX It'd be nice to make this const and initialize it
|
|
|
|
// statically...
|
|
|
|
CALLBACKS.size = sizeof(CALLBACKS);
|
|
|
|
CALLBACKS.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
|
|
|
|
|
|
|
|
CALLBACKS.geturl = NewNPN_GetURLProc(_geturl);
|
|
|
|
CALLBACKS.posturl = NewNPN_PostURLProc(_posturl);
|
1998-08-01 09:46:47 +04:00
|
|
|
CALLBACKS.requestread = NewNPN_RequestReadProc(_requestread);
|
|
|
|
CALLBACKS.newstream = NewNPN_NewStreamProc(_newstream);
|
|
|
|
CALLBACKS.write = NewNPN_WriteProc(_write);
|
|
|
|
CALLBACKS.destroystream = NewNPN_DestroyStreamProc(_destroystream);
|
|
|
|
CALLBACKS.status = NewNPN_StatusProc(_status);
|
|
|
|
CALLBACKS.uagent = NewNPN_UserAgentProc(_useragent);
|
|
|
|
CALLBACKS.memalloc = NewNPN_MemAllocProc(_memalloc);
|
|
|
|
CALLBACKS.memfree = NewNPN_MemFreeProc(_memfree);
|
|
|
|
CALLBACKS.memflush = NewNPN_MemFlushProc(_memflush);
|
|
|
|
CALLBACKS.reloadplugins = NewNPN_ReloadPluginsProc(_reloadplugins);
|
|
|
|
CALLBACKS.getJavaEnv = NewNPN_GetJavaEnvProc(_getJavaEnv);
|
1998-12-09 05:47:03 +03:00
|
|
|
CALLBACKS.getJavaPeer = NewNPN_GetJavaPeerProc(_getJavaPeer);
|
1998-07-28 06:07:25 +04:00
|
|
|
CALLBACKS.geturlnotify = NewNPN_GetURLNotifyProc(_geturlnotify);
|
|
|
|
CALLBACKS.posturlnotify = NewNPN_PostURLNotifyProc(_posturlnotify);
|
1998-08-01 09:46:47 +04:00
|
|
|
CALLBACKS.getvalue = NewNPN_GetValueProc(_getvalue);
|
|
|
|
CALLBACKS.setvalue = NewNPN_SetValueProc(_setvalue);
|
|
|
|
CALLBACKS.invalidaterect = NewNPN_InvalidateRectProc(_invalidaterect);
|
|
|
|
CALLBACKS.invalidateregion = NewNPN_InvalidateRegionProc(_invalidateregion);
|
|
|
|
CALLBACKS.forceredraw = NewNPN_ForceRedrawProc(_forceredraw);
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
initialized = TRUE;
|
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
1999-01-25 12:00:42 +03:00
|
|
|
// nsISupports stuff
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
NS_IMPL_ADDREF(ns4xPlugin);
|
|
|
|
NS_IMPL_RELEASE(ns4xPlugin);
|
|
|
|
|
|
|
|
//static NS_DEFINE_IID(kILiveConnectPluginIID, NS_ILIVECONNECTPLUGIN_IID);
|
|
|
|
static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
|
|
|
|
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
|
|
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|
|
|
static NS_DEFINE_IID(kIWindowlessPluginInstancePeerIID, NS_IWINDOWLESSPLUGININSTANCEPEER_IID);
|
1999-03-07 01:32:47 +03:00
|
|
|
static NS_DEFINE_IID(kPluginManagerCID, NS_PLUGINMANAGER_CID);
|
1999-01-25 12:00:42 +03:00
|
|
|
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
1999-03-07 01:32:47 +03:00
|
|
|
static NS_DEFINE_IID(kAllocatorCID, NS_ALLOCATOR_CID);
|
|
|
|
static NS_DEFINE_IID(kIAllocatorIID, NS_IALLOCATOR_IID);
|
1999-03-12 01:48:58 +03:00
|
|
|
static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
|
1999-01-25 12:00:42 +03:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-03-07 01:32:47 +03:00
|
|
|
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown, nsIServiceManager* serviceMgr)
|
1998-07-28 06:07:25 +04:00
|
|
|
{
|
|
|
|
NS_INIT_REFCNT();
|
1998-09-15 07:48:58 +04:00
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
|
1998-09-15 07:48:58 +04:00
|
|
|
fShutdownEntry = aShutdown;
|
1999-01-25 12:00:42 +03:00
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
// set up the connections to the plugin manager
|
1999-03-07 01:32:47 +03:00
|
|
|
if (nsnull == mPluginManager)
|
|
|
|
serviceMgr->GetService(kPluginManagerCID, kIPluginManagerIID, (nsISupports**)&mPluginManager);
|
1999-01-25 12:00:42 +03:00
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
if (nsnull == mMalloc)
|
1999-03-07 01:32:47 +03:00
|
|
|
serviceMgr->GetService(kAllocatorCID, kIAllocatorIID, (nsISupports**)&mMalloc);
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ns4xPlugin::~ns4xPlugin(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
ns4xPlugin::QueryInterface(const nsIID& iid, void** instance)
|
|
|
|
{
|
|
|
|
if (instance == NULL)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
if (iid.Equals(kIPluginIID))
|
|
|
|
{
|
|
|
|
*instance = (void *)(nsIPlugin *)this;
|
1998-07-28 06:07:25 +04:00
|
|
|
AddRef();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-28 02:14:15 +04:00
|
|
|
if (iid.Equals(kIFactoryIID))
|
|
|
|
{
|
|
|
|
*instance = (void *)(nsIFactory *)this;
|
|
|
|
AddRef();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
if (iid.Equals(kISupportsIID))
|
|
|
|
{
|
|
|
|
*instance = (void *)(nsISupports *)this;
|
1998-07-28 06:07:25 +04:00
|
|
|
AddRef();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Static factory method.
|
|
|
|
//
|
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
/*
|
|
|
|
CreatePlugin()
|
|
|
|
--------------
|
|
|
|
Handles the initialization of old, 4x style plugins. Creates the ns4xPlugin object.
|
|
|
|
One ns4xPlugin object exists per Plugin (not instance).
|
|
|
|
*/
|
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
nsresult
|
|
|
|
ns4xPlugin::CreatePlugin(PRLibrary *library,
|
1999-03-12 01:48:58 +03:00
|
|
|
nsIPlugin **result,
|
|
|
|
nsIServiceManager* serviceMgr)
|
1998-07-28 06:07:25 +04:00
|
|
|
{
|
|
|
|
CheckClassInitialized();
|
|
|
|
|
1998-12-09 05:47:03 +03:00
|
|
|
// XXX this only applies on Windows
|
1998-07-28 06:07:25 +04:00
|
|
|
NP_GETENTRYPOINTS pfnGetEntryPoints =
|
|
|
|
(NP_GETENTRYPOINTS)PR_FindSymbol(library, "NP_GetEntryPoints");
|
|
|
|
|
|
|
|
if (pfnGetEntryPoints == NULL)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NPPluginFuncs callbacks;
|
|
|
|
memset((void*) &callbacks, 0, sizeof(callbacks));
|
|
|
|
|
|
|
|
callbacks.size = sizeof(callbacks);
|
|
|
|
|
|
|
|
if (pfnGetEntryPoints(&callbacks) != NS_OK)
|
|
|
|
return NS_ERROR_FAILURE; // XXX
|
|
|
|
|
|
|
|
#ifdef XP_WIN // XXX This is really XP, but we need to figure out how to do HIBYTE()
|
|
|
|
if (HIBYTE(callbacks.version) < NP_VERSION_MAJOR)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
#endif
|
|
|
|
|
1998-09-15 07:48:58 +04:00
|
|
|
NP_PLUGINSHUTDOWN pfnShutdown =
|
|
|
|
(NP_PLUGINSHUTDOWN)PR_FindSymbol(library, "NP_Shutdown");
|
|
|
|
|
1998-12-09 05:47:03 +03:00
|
|
|
// create the new plugin handler
|
1999-03-07 01:32:47 +03:00
|
|
|
*result = new ns4xPlugin(&callbacks, pfnShutdown, serviceMgr);
|
1998-12-09 05:47:03 +03:00
|
|
|
|
|
|
|
NS_ADDREF(*result);
|
|
|
|
|
|
|
|
if (*result == NULL)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
// we must init here because the plugin may call NPN functions
|
|
|
|
// when we call into the NP_Initialize entry point - NPN functions
|
|
|
|
// require that mBrowserManager be set up
|
1999-01-25 12:00:42 +03:00
|
|
|
(*result)->Initialize();
|
1998-12-09 05:47:03 +03:00
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
// the NP_Initialize entry point was misnamed as NP_PluginInit,
|
|
|
|
// early in plugin project development. Its correct name is
|
|
|
|
// documented now, and new developers expect it to work. However,
|
|
|
|
// I don't want to break the plugins already in the field, so
|
|
|
|
// we'll accept either name
|
1998-12-09 05:47:03 +03:00
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
NP_PLUGININIT pfnInitialize =
|
|
|
|
(NP_PLUGININIT)PR_FindSymbol(library, "NP_Initialize");
|
|
|
|
|
|
|
|
if (!pfnInitialize) {
|
|
|
|
pfnInitialize =
|
|
|
|
(NP_PLUGININIT)PR_FindSymbol(library, "NP_PluginInit");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pfnInitialize == NULL)
|
|
|
|
return NS_ERROR_UNEXPECTED; // XXX Right error?
|
|
|
|
|
1998-12-09 05:47:03 +03:00
|
|
|
if (pfnInitialize(&(ns4xPlugin::CALLBACKS)) != NS_OK)
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
/*
|
|
|
|
CreateInstance()
|
|
|
|
----------------
|
|
|
|
Creates a ns4xPluginInstance object.
|
|
|
|
*/
|
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
nsresult ns4xPlugin :: CreateInstance(nsISupports *aOuter,
|
|
|
|
const nsIID &aIID,
|
|
|
|
void **aResult)
|
|
|
|
{
|
|
|
|
if (aResult == NULL) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aResult = NULL;
|
|
|
|
|
|
|
|
nsISupports *inst;
|
|
|
|
|
|
|
|
inst = nsnull;
|
1998-08-01 09:46:47 +04:00
|
|
|
inst = (nsISupports *)(nsIPluginInstance *)new ns4xPluginInstance(&fCallbacks);
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
if (inst == NULL) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult res = inst->QueryInterface(aIID, aResult);
|
|
|
|
|
|
|
|
if (res != NS_OK) {
|
|
|
|
// We didn't get the right interface, so clean up
|
|
|
|
delete inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult ns4xPlugin :: LockFactory(PRBool aLock)
|
|
|
|
{
|
|
|
|
// Not implemented in simplest case.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-03-14 23:26:29 +03:00
|
|
|
NS_METHOD ns4xPlugin :: CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID,
|
|
|
|
const char* aPluginMIMEType,
|
|
|
|
void **aResult)
|
|
|
|
{
|
|
|
|
return CreateInstance(aOuter, aIID, aResult);
|
|
|
|
}
|
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
nsresult
|
|
|
|
ns4xPlugin::Initialize(void)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
nsresult
|
|
|
|
ns4xPlugin::Shutdown(void)
|
|
|
|
{
|
1998-09-15 07:48:58 +04:00
|
|
|
if (nsnull != fShutdownEntry)
|
|
|
|
{
|
|
|
|
#ifdef NS_DEBUG
|
1999-01-25 12:00:42 +03:00
|
|
|
printf("shutting down plugin %08x\n", this);
|
1998-09-15 07:48:58 +04:00
|
|
|
#endif
|
|
|
|
fShutdownEntry();
|
|
|
|
fShutdownEntry = nsnull;
|
|
|
|
}
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
NS_IF_RELEASE(mPluginManager);
|
|
|
|
NS_IF_RELEASE(mMalloc);
|
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
ns4xPlugin::GetMIMEDescription(const char* *resultingDesc)
|
|
|
|
{
|
1999-01-25 12:00:42 +03:00
|
|
|
printf("plugin getmimedescription called\n");
|
1998-07-28 06:07:25 +04:00
|
|
|
*resultingDesc = "";
|
|
|
|
return NS_OK; // XXX make a callback, etc.
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
ns4xPlugin::GetValue(nsPluginVariable variable, void *value)
|
|
|
|
{
|
1998-09-15 07:48:58 +04:00
|
|
|
printf("plugin getvalue %d called\n", variable);
|
1998-07-28 06:07:25 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Static callbacks that get routed back through the new C++ API
|
|
|
|
//
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_geturl(NPP npp, const char* relativeURL, const char* target)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-09-18 14:48:12 +04:00
|
|
|
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
nsIPluginStreamListener* listener = nsnull;
|
|
|
|
if(target == nsnull)
|
|
|
|
inst->NewStream(&listener);
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
if(mPluginManager->GetURL(inst, relativeURL, target, listener) != NS_OK)
|
|
|
|
return NPERR_GENERIC_ERROR;
|
|
|
|
|
|
|
|
return NPERR_NO_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_geturlnotify(NPP npp, const char* relativeURL, const char* target,
|
|
|
|
void* notifyData)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-09-18 14:48:12 +04:00
|
|
|
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
nsIPluginStreamListener* listener = nsnull;
|
|
|
|
if(target == nsnull)
|
|
|
|
((ns4xPluginInstance*)inst)->NewNotifyStream(&listener, notifyData);
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
if(mPluginManager->GetURL(inst, relativeURL, target, listener) != NS_OK)
|
|
|
|
return NPERR_GENERIC_ERROR;
|
|
|
|
|
|
|
|
return NPERR_NO_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_posturlnotify(NPP npp, const char* relativeURL, const char *target,
|
|
|
|
uint32 len, const char *buf, NPBool file,
|
|
|
|
void* notifyData)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-09-18 14:48:12 +04:00
|
|
|
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
nsIPluginStreamListener* listener = nsnull;
|
|
|
|
if(target == nsnull)
|
|
|
|
((ns4xPluginInstance*)inst)->NewNotifyStream(&listener, notifyData);
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
if(mPluginManager->PostURL(inst, relativeURL, len, buf, file, target, listener) != NS_OK)
|
|
|
|
return NPERR_GENERIC_ERROR;
|
|
|
|
|
|
|
|
return NPERR_NO_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_posturl(NPP npp, const char* relativeURL, const char *target, uint32 len,
|
|
|
|
const char *buf, NPBool file)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-09-18 14:48:12 +04:00
|
|
|
NS_ASSERTION(mPluginManager != NULL, "null manager");
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1999-01-25 12:00:42 +03:00
|
|
|
nsIPluginStreamListener* listener = nsnull;
|
|
|
|
if(target == nsnull)
|
|
|
|
inst->NewStream(&listener);
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
if(mPluginManager->PostURL(inst, relativeURL, len, buf, file, target, listener) != NS_OK)
|
|
|
|
return NPERR_GENERIC_ERROR;
|
|
|
|
|
|
|
|
return NPERR_NO_ERROR;
|
1998-08-01 09:46:47 +04:00
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A little helper class used to wrap up plugin manager streams (that is,
|
|
|
|
* streams from the plugin to the browser).
|
|
|
|
*/
|
1998-08-01 09:46:47 +04:00
|
|
|
class ns4xStreamWrapper
|
|
|
|
{
|
1998-07-28 06:07:25 +04:00
|
|
|
protected:
|
1998-08-01 09:46:47 +04:00
|
|
|
nsIOutputStream *fStream;
|
|
|
|
NPStream fNPStream;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
public:
|
1998-08-01 09:46:47 +04:00
|
|
|
ns4xStreamWrapper(nsIOutputStream* stream);
|
1998-07-28 06:07:25 +04:00
|
|
|
~ns4xStreamWrapper();
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
void GetStream(nsIOutputStream* &result);
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
NPStream*
|
|
|
|
GetNPStream(void) {
|
|
|
|
return &fNPStream;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
ns4xStreamWrapper::ns4xStreamWrapper(nsIOutputStream* stream)
|
1998-07-28 06:07:25 +04:00
|
|
|
: fStream(stream)
|
|
|
|
{
|
1998-08-01 09:46:47 +04:00
|
|
|
NS_ASSERTION(stream != NULL, "bad stream");
|
|
|
|
|
1999-01-05 02:43:41 +03:00
|
|
|
fStream = stream;
|
|
|
|
NS_ADDREF(fStream);
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
memset(&fNPStream, 0, sizeof(fNPStream));
|
|
|
|
fNPStream.ndata = (void*) this;
|
|
|
|
}
|
|
|
|
|
|
|
|
ns4xStreamWrapper::~ns4xStreamWrapper(void)
|
|
|
|
{
|
1999-01-05 02:43:41 +03:00
|
|
|
fStream->Close();
|
1998-08-01 09:46:47 +04:00
|
|
|
NS_IF_RELEASE(fStream);
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
ns4xStreamWrapper::GetStream(nsIOutputStream* &result)
|
1998-07-28 06:07:25 +04:00
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
result = fStream;
|
1998-08-01 09:46:47 +04:00
|
|
|
NS_IF_ADDREF(fStream);
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_newstream(NPP npp, NPMIMEType type, const char* window, NPStream* *result)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
nsIOutputStream* stream;
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstancePeer *peer;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (NS_OK == inst->GetPeer(&peer))
|
1998-08-01 09:46:47 +04:00
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if (peer->NewStream((const char*) type, window, &stream) != NS_OK)
|
1998-08-05 08:21:36 +04:00
|
|
|
{
|
|
|
|
NS_RELEASE(peer);
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_GENERIC_ERROR;
|
1998-08-05 08:21:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ns4xStreamWrapper* wrapper = new ns4xStreamWrapper(stream);
|
|
|
|
|
|
|
|
if (wrapper == NULL)
|
|
|
|
{
|
|
|
|
NS_RELEASE(peer);
|
1998-08-01 09:46:47 +04:00
|
|
|
NS_RELEASE(stream);
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_OUT_OF_MEMORY_ERROR;
|
1998-08-05 08:21:36 +04:00
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
(*result) = wrapper->GetNPStream();
|
|
|
|
|
|
|
|
NS_RELEASE(peer);
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_NO_ERROR;
|
1998-08-05 08:21:36 +04:00
|
|
|
}
|
|
|
|
else
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_GENERIC_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int32 NP_EXPORT
|
|
|
|
ns4xPlugin::_write(NPP npp, NPStream *pstream, int32 len, void *buffer)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
// negative return indicates failure to the plugin
|
|
|
|
if(!npp)
|
|
|
|
return -1;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
ns4xStreamWrapper* wrapper = (ns4xStreamWrapper*) pstream->ndata;
|
|
|
|
NS_ASSERTION(wrapper != NULL, "null stream");
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
if (wrapper == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return -1;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
nsIOutputStream* stream;
|
|
|
|
wrapper->GetStream(stream);
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-12-16 08:40:20 +03:00
|
|
|
PRUint32 count = 0;
|
1999-03-06 01:53:56 +03:00
|
|
|
nsresult rv = stream->Write((char *)buffer, len, &count);
|
1998-08-01 09:46:47 +04:00
|
|
|
NS_RELEASE(stream);
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
if(rv != NS_OK)
|
|
|
|
return -1;
|
|
|
|
|
1998-12-16 08:40:20 +03:00
|
|
|
return (int32)count;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_destroystream(NPP npp, NPStream *pstream, NPError reason)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
|
|
|
nsISupports* stream = (nsISupports*) pstream->ndata;
|
|
|
|
nsIPluginStreamListener* listener;
|
|
|
|
|
|
|
|
// DestroyStream can kill two kinds of streams: NPP derived and
|
|
|
|
// NPN derived.
|
|
|
|
// check to see if they're trying to kill a NPP stream
|
|
|
|
if(stream->QueryInterface(kIPluginStreamListenerIID, (void**)&listener) == NS_OK)
|
|
|
|
{
|
|
|
|
// XXX we should try to kill this listener here somehow
|
|
|
|
NS_RELEASE(listener);
|
|
|
|
return NPERR_NO_ERROR;
|
|
|
|
}
|
|
|
|
|
1999-01-05 02:43:41 +03:00
|
|
|
ns4xStreamWrapper* wrapper = (ns4xStreamWrapper*) pstream->ndata;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
|
|
|
NS_ASSERTION(wrapper != NULL, "null wrapper");
|
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
if (wrapper == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_PARAM;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
// This will release the wrapped nsIOutputStream.
|
1998-07-28 06:07:25 +04:00
|
|
|
delete wrapper;
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_NO_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NP_EXPORT
|
|
|
|
ns4xPlugin::_status(NPP npp, const char *message)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1998-07-28 06:07:25 +04:00
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstancePeer *peer;
|
|
|
|
|
|
|
|
if (NS_OK == inst->GetPeer(&peer))
|
|
|
|
{
|
|
|
|
peer->ShowStatus(message);
|
|
|
|
NS_RELEASE(peer);
|
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NP_EXPORT
|
|
|
|
ns4xPlugin::_memfree (void *ptr)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(ptr)
|
|
|
|
mMalloc->Free(ptr);
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 NP_EXPORT
|
|
|
|
ns4xPlugin::_memflush(uint32 size)
|
|
|
|
{
|
1998-08-01 09:46:47 +04:00
|
|
|
mMalloc->HeapMinimize();
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
return 0;
|
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
void NP_EXPORT
|
|
|
|
ns4xPlugin::_reloadplugins(NPBool reloadPages)
|
|
|
|
{
|
1998-08-01 09:46:47 +04:00
|
|
|
mPluginManager->ReloadPlugins(reloadPages);
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NP_EXPORT
|
|
|
|
ns4xPlugin::_invalidaterect(NPP npp, NPRect *invalidRect)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1998-07-28 06:07:25 +04:00
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstancePeer *peer;
|
1998-08-01 09:46:47 +04:00
|
|
|
nsIWindowlessPluginInstancePeer *wpeer;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (NS_OK == inst->GetPeer(&peer))
|
1998-08-01 09:46:47 +04:00
|
|
|
{
|
1998-08-05 08:21:36 +04:00
|
|
|
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
|
|
|
{
|
|
|
|
// XXX nsRect & NPRect are structurally equivalent
|
|
|
|
wpeer->InvalidateRect((nsPluginRect *)invalidRect);
|
|
|
|
NS_RELEASE(wpeer);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_RELEASE(peer);
|
1998-08-01 09:46:47 +04:00
|
|
|
}
|
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
void NP_EXPORT
|
|
|
|
ns4xPlugin::_invalidateregion(NPP npp, NPRegion invalidRegion)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1998-07-28 06:07:25 +04:00
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstancePeer *peer;
|
1998-08-01 09:46:47 +04:00
|
|
|
nsIWindowlessPluginInstancePeer *wpeer;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (NS_OK == inst->GetPeer(&peer))
|
1998-08-01 09:46:47 +04:00
|
|
|
{
|
1998-08-05 08:21:36 +04:00
|
|
|
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
|
|
|
{
|
|
|
|
// XXX nsRegion & NPRegion are typedef'd to the same thing
|
|
|
|
wpeer->InvalidateRegion((nsPluginRegion)invalidRegion);
|
|
|
|
NS_RELEASE(wpeer);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_RELEASE(peer);
|
1998-08-01 09:46:47 +04:00
|
|
|
}
|
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
void NP_EXPORT
|
|
|
|
ns4xPlugin::_forceredraw(NPP npp)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1998-07-28 06:07:25 +04:00
|
|
|
return;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstancePeer *peer;
|
1998-08-01 09:46:47 +04:00
|
|
|
nsIWindowlessPluginInstancePeer *wpeer;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (NS_OK == inst->GetPeer(&peer))
|
1998-08-01 09:46:47 +04:00
|
|
|
{
|
1998-08-05 08:21:36 +04:00
|
|
|
if (NS_OK == peer->QueryInterface(kIWindowlessPluginInstancePeerIID, (void **)&wpeer))
|
|
|
|
{
|
|
|
|
wpeer->ForceRedraw();
|
|
|
|
NS_RELEASE(wpeer);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_RELEASE(peer);
|
1998-08-01 09:46:47 +04:00
|
|
|
}
|
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_getvalue(NPP npp, NPNVariable variable, void *result)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstance *inst = (nsIPluginInstance *) npp->ndata;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstancePeer *peer;
|
|
|
|
|
|
|
|
if (NS_OK == inst->GetPeer(&peer))
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// XXX Note that for backwards compatibility, the old NPNVariables
|
|
|
|
// map correctly to NPPluginManagerVariables.
|
|
|
|
rv = peer->GetValue((nsPluginInstancePeerVariable)variable, result);
|
|
|
|
NS_RELEASE(peer);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
else
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_GENERIC_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_setvalue(NPP npp, NPPVariable variable, void *result)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
if(!npp)
|
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
|
|
|
|
1998-09-15 07:48:58 +04:00
|
|
|
ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
NS_ASSERTION(inst != NULL, "null instance");
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1998-08-05 08:21:36 +04:00
|
|
|
if (inst == NULL)
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_INVALID_INSTANCE_ERROR;
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-09-15 07:48:58 +04:00
|
|
|
switch (variable)
|
|
|
|
{
|
|
|
|
case NPPVpluginWindowBool:
|
|
|
|
return inst->SetWindowless(*((NPBool *)result));
|
|
|
|
|
|
|
|
case NPPVpluginTransparentBool:
|
|
|
|
return inst->SetTransparent(*((NPBool *)result));
|
|
|
|
|
|
|
|
default:
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_NO_ERROR;
|
1998-09-15 07:48:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
1998-08-05 08:21:36 +04:00
|
|
|
nsIPluginInstancePeer *peer;
|
|
|
|
|
|
|
|
if (NS_OK == inst->GetPeer(&peer))
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// XXX Note that for backwards compatibility, the old NPPVariables
|
|
|
|
// map correctly to NPPluginVariables.
|
|
|
|
rv = peer->SetValue((nsPluginInstancePeerVariable)variable, result);
|
|
|
|
NS_RELEASE(peer);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
1998-09-15 07:48:58 +04:00
|
|
|
#endif
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
1999-03-12 01:48:58 +03:00
|
|
|
NPError NP_EXPORT
|
1998-07-28 06:07:25 +04:00
|
|
|
ns4xPlugin::_requestread(NPStream *pstream, NPByteRange *rangeList)
|
|
|
|
{
|
1999-03-12 01:48:58 +03:00
|
|
|
return NPERR_STREAM_NOT_SEEKABLE;
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// On 68K Mac (XXX still supported?), we need to make sure that the
|
|
|
|
// pointers are in D0 for the following functions that return pointers.
|
|
|
|
//
|
|
|
|
|
|
|
|
#if defined(XP_MAC) && !defined(powerc)
|
|
|
|
#pragma pointers_in_D0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
JRIEnv* NP_EXPORT
|
|
|
|
ns4xPlugin::_getJavaEnv(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char * NP_EXPORT
|
|
|
|
ns4xPlugin::_useragent(NPP npp)
|
|
|
|
{
|
1998-08-01 09:46:47 +04:00
|
|
|
NS_ASSERTION(mPluginManager != NULL, "null pluginmanager");
|
|
|
|
|
|
|
|
if (mPluginManager == NULL)
|
1998-07-28 06:07:25 +04:00
|
|
|
return NULL;
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
char *retstr;
|
|
|
|
|
|
|
|
mPluginManager->UserAgent((const char **)&retstr);
|
1998-07-28 06:07:25 +04:00
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
return retstr;
|
|
|
|
}
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
void * NP_EXPORT
|
|
|
|
ns4xPlugin::_memalloc (uint32 size)
|
|
|
|
{
|
1998-08-01 09:46:47 +04:00
|
|
|
return mMalloc->Alloc(size);
|
1998-07-28 06:07:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
java_lang_Class* NP_EXPORT
|
|
|
|
ns4xPlugin::_getJavaClass(void* handle)
|
|
|
|
{
|
|
|
|
// Is this just a generic call into the Java VM?
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jref NP_EXPORT
|
|
|
|
ns4xPlugin::_getJavaPeer(NPP npp)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-08-01 09:46:47 +04:00
|
|
|
|
1999-03-07 01:32:47 +03:00
|
|
|
// eof
|