Accepting michaelp's API changes for GetValue/SetValue.

This commit is contained in:
warren%netscape.com 1998-09-15 03:45:38 +00:00
Родитель ffa719807f
Коммит 5619102737
19 изменённых файлов: 294 добавлений и 288 удалений

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

@ -213,12 +213,9 @@ public:
NS_IMETHOD NS_IMETHOD
ShowStatus(const char* message); ShowStatus(const char* message);
// XXX - Where did this go?
NS_IMETHOD NS_IMETHOD
Version(int* plugin_major, int* plugin_minor, SetWindowSize(PRUint32 width, PRUint32 height);
int* netscape_major, int* netscape_minor);
nsIPluginInstance* GetInstance(void) { return mInstance; } nsIPluginInstance* GetInstance(void) { return mInstance; }
NPP GetNPPInstance(void) { return npp; } NPP GetNPPInstance(void) { return npp; }
@ -1273,22 +1270,6 @@ CPluginInstancePeer::GetAttribute(const char* name, const char* *result)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
//+++++++++++++++++++++++++++++++++++++++++++++++++
// Version:
//
// XXX - Where did this go in the new API?
//
//+++++++++++++++++++++++++++++++++++++++++++++++++
NS_METHOD
CPluginInstancePeer::Version(int* plugin_major, int* plugin_minor,
int* netscape_major, int* netscape_minor)
{
NPN_Version(plugin_major, plugin_minor, netscape_major, netscape_minor);
return NS_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++
// NewStream: // NewStream:
//+++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++
@ -1329,6 +1310,16 @@ CPluginInstancePeer::ShowStatus(const char* message)
return NS_OK; return NS_OK;
} }
NS_METHOD
CPluginInstancePeer::SetWindowSize(PRUint32 width, PRUint32 height)
{
NPError err;
NPSize size;
size.width = width;
size.height = height;
err = NPN_SetValue(npp, NPPVpluginWindowSize, &size);
return fromNPError[err];
}
//+++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++
// nsISupports functions // nsISupports functions

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

@ -106,19 +106,6 @@ public:
*/ */
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginVariable variable, void *value) = 0; GetValue(nsPluginVariable variable, void *value) = 0;
/**
* Sets the value of a variable associated with the plugin.
*
* (Corresponds to NPP_SetValue.)
*
* @param variable - the plugin variable to get
* @param value - the address of the value to store
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetValue(nsPluginVariable variable, void *value) = 0;
}; };
#define NS_IPLUGIN_IID \ #define NS_IPLUGIN_IID \

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

@ -167,6 +167,16 @@ public:
URLNotify(const char* url, const char* target, URLNotify(const char* url, const char* target,
nsPluginReason reason, void* notifyData) = 0; nsPluginReason reason, void* notifyData) = 0;
/**
* Returns the value of a variable associated with the plugin instance.
*
* @param variable - the plugin instance variable to get
* @param value - the address of where to store the resulting value
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
GetValue(nsPluginInstanceVariable variable, void *value) = 0;
}; };
#define NS_IPLUGININSTANCE_IID \ #define NS_IPLUGININSTANCE_IID \

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

@ -66,18 +66,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginInstancePeerVariable variable, void *value) = 0; GetValue(nsPluginInstancePeerVariable variable, void *value) = 0;
/**
* Sets the value of a variable associated with the plugin manager.
*
* (Corresponds to NPN_SetValue.)
*
* @param variable - the plugin manager variable to get
* @param value - the address of the value to store
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetValue(nsPluginInstancePeerVariable variable, void *value) = 0;
/** /**
* Returns the MIME type of the plugin instance. * Returns the MIME type of the plugin instance.
* *
@ -129,6 +117,16 @@ public:
NS_IMETHOD NS_IMETHOD
ShowStatus(const char* message) = 0; ShowStatus(const char* message) = 0;
/**
* Set the desired size of the window in which the plugin instance lives.
*
* @param width - new window width
* @param height - new window height
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetWindowSize(PRUint32 width, PRUint32 height) = 0;
}; };
#define NS_IPLUGININSTANCEPEER_IID \ #define NS_IPLUGININSTANCEPEER_IID \

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

@ -58,18 +58,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginManagerVariable variable, void *value) = 0; GetValue(nsPluginManagerVariable variable, void *value) = 0;
/**
* Sets the value of a variable associated with the plugin manager.
*
* (Corresponds to NPN_SetValue.)
*
* @param variable - the plugin manager variable to get
* @param value - the address of the value to store
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetValue(nsPluginManagerVariable variable, void *value) = 0;
/** /**
* Causes the plugins directory to be searched again for new plugin * Causes the plugins directory to be searched again for new plugin
* libraries. * libraries.

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

@ -168,23 +168,24 @@ struct nsPluginPrintCallbackStruct {
// List of variables which should be implmented by the plugin // List of variables which should be implmented by the plugin
enum nsPluginVariable { enum nsPluginVariable {
nsPluginVariable_NameString = 1, nsPluginVariable_NameString = 1,
nsPluginVariable_DescriptionString = 2 nsPluginVariable_DescriptionString = 2
}; };
// List of variables which are implemented by the browser
enum nsPluginManagerVariable { enum nsPluginManagerVariable {
nsPluginManagerVariable_XDisplay = 1, nsPluginManagerVariable_XDisplay = 1,
nsPluginManagerVariable_XtAppContext = 2, nsPluginManagerVariable_XtAppContext = 2
nsPluginManagerVariable_NetscapeWindow = 3
}; };
enum nsPluginInstancePeerVariable { enum nsPluginInstancePeerVariable {
nsPluginInstancePeerVariable_WindowBool = 3, nsPluginInstancePeerVariable_NetscapeWindow = 3
nsPluginInstancePeerVariable_TransparentBool = 4, // nsPluginInstancePeerVariable_JavaClass = 5,
nsPluginInstancePeerVariable_JavaClass = 5, // nsPluginInstancePeerVariable_TimerInterval = 7
nsPluginInstancePeerVariable_WindowSize = 6, };
nsPluginInstancePeerVariable_TimerInterval = 7
enum nsPluginInstanceVariable {
nsPluginInstanceVariable_WindowlessBool = 3,
nsPluginInstanceVariable_TransparentBool = 4
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

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

@ -106,19 +106,6 @@ public:
*/ */
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginVariable variable, void *value) = 0; GetValue(nsPluginVariable variable, void *value) = 0;
/**
* Sets the value of a variable associated with the plugin.
*
* (Corresponds to NPP_SetValue.)
*
* @param variable - the plugin variable to get
* @param value - the address of the value to store
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetValue(nsPluginVariable variable, void *value) = 0;
}; };
#define NS_IPLUGIN_IID \ #define NS_IPLUGIN_IID \

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

@ -167,6 +167,16 @@ public:
URLNotify(const char* url, const char* target, URLNotify(const char* url, const char* target,
nsPluginReason reason, void* notifyData) = 0; nsPluginReason reason, void* notifyData) = 0;
/**
* Returns the value of a variable associated with the plugin instance.
*
* @param variable - the plugin instance variable to get
* @param value - the address of where to store the resulting value
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
GetValue(nsPluginInstanceVariable variable, void *value) = 0;
}; };
#define NS_IPLUGININSTANCE_IID \ #define NS_IPLUGININSTANCE_IID \

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

@ -66,18 +66,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginInstancePeerVariable variable, void *value) = 0; GetValue(nsPluginInstancePeerVariable variable, void *value) = 0;
/**
* Sets the value of a variable associated with the plugin manager.
*
* (Corresponds to NPN_SetValue.)
*
* @param variable - the plugin manager variable to get
* @param value - the address of the value to store
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetValue(nsPluginInstancePeerVariable variable, void *value) = 0;
/** /**
* Returns the MIME type of the plugin instance. * Returns the MIME type of the plugin instance.
* *
@ -129,6 +117,16 @@ public:
NS_IMETHOD NS_IMETHOD
ShowStatus(const char* message) = 0; ShowStatus(const char* message) = 0;
/**
* Set the desired size of the window in which the plugin instance lives.
*
* @param width - new window width
* @param height - new window height
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetWindowSize(PRUint32 width, PRUint32 height) = 0;
}; };
#define NS_IPLUGININSTANCEPEER_IID \ #define NS_IPLUGININSTANCEPEER_IID \

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

@ -58,18 +58,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginManagerVariable variable, void *value) = 0; GetValue(nsPluginManagerVariable variable, void *value) = 0;
/**
* Sets the value of a variable associated with the plugin manager.
*
* (Corresponds to NPN_SetValue.)
*
* @param variable - the plugin manager variable to get
* @param value - the address of the value to store
* @result - NS_OK if this operation was successful
*/
NS_IMETHOD
SetValue(nsPluginManagerVariable variable, void *value) = 0;
/** /**
* Causes the plugins directory to be searched again for new plugin * Causes the plugins directory to be searched again for new plugin
* libraries. * libraries.

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

@ -168,23 +168,24 @@ struct nsPluginPrintCallbackStruct {
// List of variables which should be implmented by the plugin // List of variables which should be implmented by the plugin
enum nsPluginVariable { enum nsPluginVariable {
nsPluginVariable_NameString = 1, nsPluginVariable_NameString = 1,
nsPluginVariable_DescriptionString = 2 nsPluginVariable_DescriptionString = 2
}; };
// List of variables which are implemented by the browser
enum nsPluginManagerVariable { enum nsPluginManagerVariable {
nsPluginManagerVariable_XDisplay = 1, nsPluginManagerVariable_XDisplay = 1,
nsPluginManagerVariable_XtAppContext = 2, nsPluginManagerVariable_XtAppContext = 2
nsPluginManagerVariable_NetscapeWindow = 3
}; };
enum nsPluginInstancePeerVariable { enum nsPluginInstancePeerVariable {
nsPluginInstancePeerVariable_WindowBool = 3, nsPluginInstancePeerVariable_NetscapeWindow = 3
nsPluginInstancePeerVariable_TransparentBool = 4, // nsPluginInstancePeerVariable_JavaClass = 5,
nsPluginInstancePeerVariable_JavaClass = 5, // nsPluginInstancePeerVariable_TimerInterval = 7
nsPluginInstancePeerVariable_WindowSize = 6, };
nsPluginInstancePeerVariable_TimerInterval = 7
enum nsPluginInstanceVariable {
nsPluginInstanceVariable_WindowlessBool = 3,
nsPluginInstanceVariable_TransparentBool = 4
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

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

@ -213,12 +213,9 @@ public:
NS_IMETHOD NS_IMETHOD
ShowStatus(const char* message); ShowStatus(const char* message);
// XXX - Where did this go?
NS_IMETHOD NS_IMETHOD
Version(int* plugin_major, int* plugin_minor, SetWindowSize(PRUint32 width, PRUint32 height);
int* netscape_major, int* netscape_minor);
nsIPluginInstance* GetInstance(void) { return mInstance; } nsIPluginInstance* GetInstance(void) { return mInstance; }
NPP GetNPPInstance(void) { return npp; } NPP GetNPPInstance(void) { return npp; }
@ -1273,22 +1270,6 @@ CPluginInstancePeer::GetAttribute(const char* name, const char* *result)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
//+++++++++++++++++++++++++++++++++++++++++++++++++
// Version:
//
// XXX - Where did this go in the new API?
//
//+++++++++++++++++++++++++++++++++++++++++++++++++
NS_METHOD
CPluginInstancePeer::Version(int* plugin_major, int* plugin_minor,
int* netscape_major, int* netscape_minor)
{
NPN_Version(plugin_major, plugin_minor, netscape_major, netscape_minor);
return NS_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++
// NewStream: // NewStream:
//+++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++
@ -1329,6 +1310,16 @@ CPluginInstancePeer::ShowStatus(const char* message)
return NS_OK; return NS_OK;
} }
NS_METHOD
CPluginInstancePeer::SetWindowSize(PRUint32 width, PRUint32 height)
{
NPError err;
NPSize size;
size.width = width;
size.height = height;
err = NPN_SetValue(npp, NPPVpluginWindowSize, &size);
return fromNPError[err];
}
//+++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++
// nsISupports functions // nsISupports functions

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

@ -31,7 +31,7 @@ OBJS = .\$(OBJDIR)\npsimple.obj \
JDIRS = . JDIRS = .
JRI_GEN = \ xJRI_GEN = \
Simple \ Simple \
java.lang.Object \ java.lang.Object \
netscape.plugin.Plugin \ netscape.plugin.Plugin \
@ -76,7 +76,7 @@ GARBAGE = $(GARBAGE) _gen
#//------------------------------------------------------------------------ #//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak> include <$(DEPTH)/config/rules.mak>
LINCS=$(LINCS) -I$(PUBLIC)\plugin -I$(PUBLIC)\xpcom -I$(PUBLIC)\java -I$(PUBLIC)\plugimpl -I$(PUBLIC)\raptor LINCS=$(LINCS) -I$(PUBLIC)\plugin -I$(PUBLIC)\xpcom -I$(PUBLIC)\java -I$(PUBLIC)\plugimpl -I$(PUBLIC)\raptor -I_jri
install:: $(DLL) install:: $(DLL)
$(MAKE_INSTALL) $(XPDIST)\classes11\Simple.class $(DEPTH)\cmd\winfe\mkfiles32\x86dbg\plugins\simple $(MAKE_INSTALL) $(XPDIST)\classes11\Simple.class $(DEPTH)\cmd\winfe\mkfiles32\x86dbg\plugins\simple

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

@ -163,10 +163,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginVariable variable, void *value); GetValue(nsPluginVariable variable, void *value);
// (Corresponds to NPP_SetValue.)
NS_IMETHOD
SetValue(nsPluginVariable variable, void *value);
// The old NPP_New call has been factored into two plugin instance methods: // The old NPP_New call has been factored into two plugin instance methods:
// //
// CreateInstance -- called once, after the plugin instance is created. This // CreateInstance -- called once, after the plugin instance is created. This
@ -266,6 +262,9 @@ public:
URLNotify(const char* url, const char* target, URLNotify(const char* url, const char* target,
nsPluginReason reason, void* notifyData); nsPluginReason reason, void* notifyData);
NS_IMETHOD
GetValue(nsPluginInstanceVariable variable, void *value);
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// SimplePluginInstance specific methods: // SimplePluginInstance specific methods:
@ -504,12 +503,6 @@ SimplePlugin::GetValue(nsPluginVariable variable, void *value)
return err; return err;
} }
NS_METHOD
SimplePlugin::SetValue(nsPluginVariable variable, void *value)
{
return NS_OK;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++ /*+++++++++++++++++++++++++++++++++++++++++++++++++
* GetJavaClass: * GetJavaClass:
* *
@ -788,6 +781,12 @@ SimplePluginInstance::URLNotify(const char* url, const char* target,
return NS_OK; return NS_OK;
} }
NS_METHOD
SimplePluginInstance::GetValue(nsPluginInstanceVariable variable, void *value)
{
return NS_OK;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// SimplePluginStream Methods // SimplePluginStream Methods
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

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

@ -1602,6 +1602,67 @@ npn_getvalue(NPP npp, NPNVariable variable, void *r_value)
return(ret); return(ret);
} }
NPError
npn_SetWindowless(np_instance* instance, PRBool windowed)
{
/*
* XXX On the Mac, a window has already been allocated by the time NPP_New
* has been called - which is fine, since we'll still use the window.
* Unfortunately, we can't use the window's presence to determine whether
* it's too late to set the windowed property.
*/
#ifndef XP_MAC
/*
* If the window has already been allocated, it's too late
* to tell us.
*/
if (!instance->app->wdata->window)
instance->windowed = windowed;
else
return NPERR_INVALID_PARAM;
#else
instance->windowed = windowed;
#endif
return NPERR_NO_ERROR;
}
NPError
npn_SetTransparent(np_instance* instance, PRBool transparent)
{
instance->transparent = transparent;
#ifdef LAYERS
if (instance->layer &&
(instance->transparent != !(CL_GetLayerFlags(instance->layer) & CL_OPAQUE)))
{
XP_Rect bbox;
/* Get the bbox and convert it into its own coordinate space */
CL_GetLayerBbox(instance->layer, &bbox);
CL_ChangeLayerFlag(instance->layer, CL_OPAQUE, (PRBool)!instance->transparent);
CL_ChangeLayerFlag(instance->layer,
CL_PREFER_DRAW_OFFSCREEN,
(PRBool)instance->transparent);
/* Force drawing of the entire transparent plug-in. */
CL_UpdateLayerRect(CL_GetLayerCompositor(instance->layer),
instance->layer, &bbox, PR_FALSE);
}
#endif /* LAYERS */
return NPERR_NO_ERROR;
}
NPError
npn_SetWindowSize(np_instance* instance, NPSize* pnpsz)
{
np_data * ndata = (np_data *)instance->app->np_data;
LO_EmbedStruct * pes = ndata->lo_struct;
LO_SetEmbedSize(instance->cx, pes, pnpsz->width, pnpsz->height);
LO_RelayoutFromElement(instance->cx, (LO_Element *)pes);
return NPERR_NO_ERROR;
}
NPError NP_EXPORT NPError NP_EXPORT
npn_setvalue(NPP npp, NPPVariable variable, void *r_value) npn_setvalue(NPP npp, NPPVariable variable, void *r_value)
{ {
@ -1616,65 +1677,24 @@ npn_setvalue(NPP npp, NPPVariable variable, void *r_value)
return NPERR_INVALID_INSTANCE_ERROR; return NPERR_INVALID_INSTANCE_ERROR;
switch(variable) { switch(variable) {
case NPPVpluginWindowBool: case NPPVpluginWindowBool:
/* ret = npn_SetWindowless(instance, (PRBool)(0 != r_value));
* XXX On the Mac, a window has already been allocated by the time NPP_New break;
* has been called - which is fine, since we'll still use the window.
* Unfortunately, we can't use the window's presence to determine whether
* it's too late to set the windowed property.
*/
#ifndef XP_MAC
/*
* If the window has already been allocated, it's too late
* to tell us.
*/
if (!instance->app->wdata->window)
instance->windowed = (0 != r_value);
else
ret = NPERR_INVALID_PARAM;
#else
instance->windowed = (0 != r_value);
#endif
break;
case NPPVpluginTransparentBool:
instance->transparent = (0 != r_value);
#ifdef LAYERS
if (instance->layer &&
(instance->transparent != !(CL_GetLayerFlags(instance->layer) & CL_OPAQUE)))
{
XP_Rect bbox;
/* Get the bbox and convert it into its own coordinate space */
CL_GetLayerBbox(instance->layer, &bbox);
CL_ChangeLayerFlag(instance->layer, CL_OPAQUE, (PRBool)!instance->transparent);
CL_ChangeLayerFlag(instance->layer,
CL_PREFER_DRAW_OFFSCREEN,
(PRBool)instance->transparent);
/* Force drawing of the entire transparent plug-in. */ case NPPVpluginTransparentBool:
CL_UpdateLayerRect(CL_GetLayerCompositor(instance->layer), ret = npn_SetTransparent(instance, (PRBool)(0 != r_value));
instance->layer, &bbox, PR_FALSE); break;
}
#endif /* LAYERS */
break;
case NPPVpluginTimerInterval: case NPPVpluginTimerInterval:
np_SetTimerInterval(npp, *(uint32*)r_value); np_SetTimerInterval(npp, *(uint32*)r_value);
break; break;
case NPPVpluginWindowSize: case NPPVpluginWindowSize:
{ ret = npn_SetWindowSize(instance, (NPSize *)r_value);
NPSize * pnpsz = (NPSize *)r_value; break;
np_data * ndata = (np_data *)instance->app->np_data;
LO_EmbedStruct * pes = ndata->lo_struct;
LO_SetEmbedSize(instance->cx, pes, pnpsz->width, pnpsz->height); default:
LO_RelayoutFromElement(instance->cx, (LO_Element *)pes); break;
break;
}
default:
break;
} }
return(ret); return(ret);
@ -2807,6 +2827,18 @@ np_newinstance(np_handle *handle, MWContext *cx, NPEmbeddedApp *app,
npp->pdata = peerInst; npp->pdata = peerInst;
ndata->sdata = (NPSavedData*)pluginInst; ndata->sdata = (NPSavedData*)pluginInst;
err = NPERR_NO_ERROR; err = NPERR_NO_ERROR;
// This used to be done by the NPN_SetValue call. The user was required
// to call them during NPP_New:
extern nsresult fromNPError[];
void* value;
// It's an abomination that we don't pass the address of value here:
err3 = pluginInst->GetValue(nsPluginInstanceVariable_WindowlessBool, value);
if (err3 == NS_OK)
(void)npn_SetWindowless(instance, (PRBool)value);
err3 = pluginInst->GetValue(nsPluginInstanceVariable_TransparentBool, value);
if (err3 == NS_OK)
(void)npn_SetTransparent(instance, (PRBool)value);
} }
else { else {
// this will release the plugin instance. // this will release the plugin instance.

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

@ -272,6 +272,8 @@ npn_getJavaPeer(NPP npp);
#pragma pointers_in_A0 #pragma pointers_in_A0
#endif #endif
extern NPError
npn_SetWindowSize(np_instance* instance, NPSize* pnpsz);
/* End of function prototypes */ /* End of function prototypes */
@ -291,9 +293,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginManagerVariable variable, void *value); GetValue(nsPluginManagerVariable variable, void *value);
NS_IMETHOD
SetValue(nsPluginManagerVariable variable, void *value);
// (Corresponds to NPN_ReloadPlugins.) // (Corresponds to NPN_ReloadPlugins.)
NS_IMETHOD NS_IMETHOD
ReloadPlugins(PRBool reloadPages); ReloadPlugins(PRBool reloadPages);
@ -446,9 +445,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginInstancePeerVariable variable, void *value); GetValue(nsPluginInstancePeerVariable variable, void *value);
NS_IMETHOD
SetValue(nsPluginInstancePeerVariable variable, void *value);
// (Corresponds to NPP_New's MIMEType argument.) // (Corresponds to NPP_New's MIMEType argument.)
NS_IMETHOD NS_IMETHOD
GetMIMEType(nsMIMEType *result); GetMIMEType(nsMIMEType *result);
@ -465,6 +461,9 @@ public:
NS_IMETHOD NS_IMETHOD
ShowStatus(const char* message); ShowStatus(const char* message);
NS_IMETHOD
SetWindowSize(PRUint32 width, PRUint32 height);
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// from nsIJRILiveConnectPluginInstancePeer: // from nsIJRILiveConnectPluginInstancePeer:

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

@ -150,12 +150,14 @@ nsPluginManager::GetValue(nsPluginManagerVariable variable, void *value)
return fromNPError[err]; return fromNPError[err];
} }
#if 0
NS_METHOD NS_METHOD
nsPluginManager::SetValue(nsPluginManagerVariable variable, void *value) nsPluginManager::SetValue(nsPluginManagerVariable variable, void *value)
{ {
NPError err = npn_setvalue(NULL, (NPPVariable)variable, value); NPError err = npn_setvalue(NULL, (NPPVariable)variable, value);
return fromNPError[err]; return fromNPError[err];
} }
#endif
NS_METHOD NS_METHOD
nsPluginManager::ReloadPlugins(PRBool reloadPages) nsPluginManager::ReloadPlugins(PRBool reloadPages)
@ -493,43 +495,49 @@ DestroyGetURLEvent(PLEvent* event)
} }
NS_METHOD NS_METHOD
nsPluginManager::GetURL(nsISupports* peer, const char* url, const char* target, nsPluginManager::GetURL(nsISupports* pinst, const char* url, const char* target,
void* notifyData, const char* altHost, void* notifyData, const char* altHost,
const char* referrer, PRBool forceJSEnabled) const char* referrer, PRBool forceJSEnabled)
{ {
NPError rslt = NPERR_INVALID_PARAM; NPError rslt = NPERR_INVALID_PARAM;
nsPluginInstancePeer* instPeer = NULL; nsIPluginInstance* inst = NULL;
if (peer->QueryInterface(kPluginInstancePeerCID, (void**)&instPeer) == NS_OK) { if (pinst->QueryInterface(kIPluginInstanceIID, (void**)&inst) == NS_OK) {
if (PR_CurrentThread() == mozilla_thread) { // Warning: Casting to our implementation type of plugin instance peer here:
NPP npp = instPeer->GetNPP(); nsPluginInstancePeer* peer;
rslt = np_geturlinternal(npp, nsresult err = inst->GetPeer((nsIPluginInstancePeer**)&peer);
url, if (err == NS_OK) {
target, if (PR_CurrentThread() == mozilla_thread) {
altHost, NPP npp = peer->GetNPP();
referrer, rslt = np_geturlinternal(npp,
forceJSEnabled, url,
notifyData != NULL, target,
notifyData); altHost,
} referrer,
else { forceJSEnabled,
GetURLEvent* e = PR_NEW(GetURLEvent); notifyData != NULL,
if (e == NULL) { notifyData);
rslt = NPERR_OUT_OF_MEMORY_ERROR;
} }
else { else {
PL_InitEvent(&e->event, NULL, HandleGetURLEvent, DestroyGetURLEvent); GetURLEvent* e = PR_NEW(GetURLEvent);
e->peer = instPeer; if (e == NULL) {
e->url = url; rslt = NPERR_OUT_OF_MEMORY_ERROR;
e->target = target; }
e->notifyData = notifyData; else {
e->altHost = altHost; PL_InitEvent(&e->event, NULL, HandleGetURLEvent, DestroyGetURLEvent);
e->referrer = referrer; e->peer = peer;
e->forceJSEnabled = forceJSEnabled; e->url = url;
/*rslt = (NPError)*/PL_PostSynchronousEvent(mozilla_event_queue, &e->event); e->target = target;
rslt = NPERR_NO_ERROR; /* XXX irix c++ compiler doesn't like the above cast */ e->notifyData = notifyData;
e->altHost = altHost;
e->referrer = referrer;
e->forceJSEnabled = forceJSEnabled;
/*rslt = (NPError)*/PL_PostSynchronousEvent(mozilla_event_queue, &e->event);
rslt = NPERR_NO_ERROR; /* XXX irix c++ compiler doesn't like the above cast */
}
} }
peer->Release();
} }
instPeer->Release(); inst->Release();
} }
return fromNPError[rslt]; return fromNPError[rslt];
} }
@ -578,7 +586,7 @@ DestroyPostURLEvent(PLEvent* event)
} }
NS_METHOD NS_METHOD
nsPluginManager::PostURL(nsISupports* peer, const char* url, const char* target, nsPluginManager::PostURL(nsISupports* pinst, const char* url, const char* target,
PRUint32 postDataLen, const char* postData, PRUint32 postDataLen, const char* postData,
PRBool isFile, void* notifyData, PRBool isFile, void* notifyData,
const char* altHost, const char* referrer, const char* altHost, const char* referrer,
@ -586,47 +594,53 @@ nsPluginManager::PostURL(nsISupports* peer, const char* url, const char* target,
PRUint32 postHeadersLen, const char* postHeaders) PRUint32 postHeadersLen, const char* postHeaders)
{ {
NPError rslt = NPERR_INVALID_PARAM; NPError rslt = NPERR_INVALID_PARAM;
nsPluginInstancePeer* instPeer = NULL; nsIPluginInstance* inst = NULL;
if (peer->QueryInterface(kPluginInstancePeerCID, (void**)&instPeer) == NS_OK) { if (pinst->QueryInterface(kIPluginInstanceIID, (void**)&inst) == NS_OK) {
if (PR_CurrentThread() == mozilla_thread) { // Warning: Casting to our implementation type of plugin instance peer here:
NPP npp = instPeer->GetNPP(); nsPluginInstancePeer* peer;
PR_ASSERT(postHeaders == NULL); // XXX need to deal with postHeaders nsresult err = inst->GetPeer((nsIPluginInstancePeer**)&peer);
rslt = np_posturlinternal(npp, if (err == NS_OK) {
url, if (PR_CurrentThread() == mozilla_thread) {
target, NPP npp = peer->GetNPP();
altHost, PR_ASSERT(postHeaders == NULL); // XXX need to deal with postHeaders
referrer, rslt = np_posturlinternal(npp,
forceJSEnabled, url,
postDataLen, target,
postData, altHost,
isFile, referrer,
notifyData != NULL, forceJSEnabled,
notifyData); postDataLen,
} postData,
else { isFile,
PostURLEvent* e = PR_NEW(PostURLEvent); notifyData != NULL,
if (e == NULL) { notifyData);
rslt = NPERR_OUT_OF_MEMORY_ERROR;
} }
else { else {
PL_InitEvent(&e->event, NULL, HandlePostURLEvent, DestroyPostURLEvent); PostURLEvent* e = PR_NEW(PostURLEvent);
e->peer = instPeer; if (e == NULL) {
e->url = url; rslt = NPERR_OUT_OF_MEMORY_ERROR;
e->target = target; }
e->notifyData = notifyData; else {
e->altHost = altHost; PL_InitEvent(&e->event, NULL, HandlePostURLEvent, DestroyPostURLEvent);
e->referrer = referrer; e->peer = peer;
e->forceJSEnabled = forceJSEnabled; e->url = url;
e->postDataLen = postDataLen; e->target = target;
e->postData = postData; e->notifyData = notifyData;
e->isFile = isFile; e->altHost = altHost;
e->postHeadersLen = postHeadersLen; e->referrer = referrer;
e->postHeaders = postHeaders; e->forceJSEnabled = forceJSEnabled;
/*rslt = (NPError)*/PL_PostSynchronousEvent(mozilla_event_queue, &e->event); e->postDataLen = postDataLen;
rslt = NPERR_NO_ERROR; /* XXX irix c++ compiler doesn't like the above cast */ e->postData = postData;
e->isFile = isFile;
e->postHeadersLen = postHeadersLen;
e->postHeaders = postHeaders;
/*rslt = (NPError)*/PL_PostSynchronousEvent(mozilla_event_queue, &e->event);
rslt = NPERR_NO_ERROR; /* XXX irix c++ compiler doesn't like the above cast */
}
} }
peer->Release();
} }
instPeer->Release(); inst->Release();
} }
return fromNPError[rslt]; return fromNPError[rslt];
} }
@ -805,12 +819,14 @@ nsPluginInstancePeer::GetValue(nsPluginInstancePeerVariable variable, void *valu
return fromNPError[err]; return fromNPError[err];
} }
#if 0
NS_METHOD NS_METHOD
nsPluginInstancePeer::SetValue(nsPluginInstancePeerVariable variable, void *value) nsPluginInstancePeer::SetValue(nsPluginInstancePeerVariable variable, void *value)
{ {
NPError err = npn_setvalue(fNPP, (NPPVariable)variable, value); NPError err = npn_setvalue(fNPP, (NPPVariable)variable, value);
return fromNPError[err]; return fromNPError[err];
} }
#endif
NS_METHOD NS_METHOD
nsPluginInstancePeer::GetMIMEType(nsMIMEType *result) nsPluginInstancePeer::GetMIMEType(nsMIMEType *result)
@ -846,6 +862,17 @@ nsPluginInstancePeer::ShowStatus(const char* message)
return NS_OK; return NS_OK;
} }
NS_METHOD
nsPluginInstancePeer::SetWindowSize(PRUint32 width, PRUint32 height)
{
NPError err;
NPSize size;
size.width = width;
size.height = height;
err = npn_SetWindowSize((np_instance*)fNPP->ndata, &size);
return fromNPError[err];
}
NS_METHOD NS_METHOD
nsPluginInstancePeer::InvalidateRect(nsPluginRect *invalidRect) nsPluginInstancePeer::InvalidateRect(nsPluginRect *invalidRect)
{ {

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

@ -31,7 +31,7 @@ OBJS = .\$(OBJDIR)\npsimple.obj \
JDIRS = . JDIRS = .
JRI_GEN = \ xJRI_GEN = \
Simple \ Simple \
java.lang.Object \ java.lang.Object \
netscape.plugin.Plugin \ netscape.plugin.Plugin \
@ -76,7 +76,7 @@ GARBAGE = $(GARBAGE) _gen
#//------------------------------------------------------------------------ #//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak> include <$(DEPTH)/config/rules.mak>
LINCS=$(LINCS) -I$(PUBLIC)\plugin -I$(PUBLIC)\xpcom -I$(PUBLIC)\java -I$(PUBLIC)\plugimpl -I$(PUBLIC)\raptor LINCS=$(LINCS) -I$(PUBLIC)\plugin -I$(PUBLIC)\xpcom -I$(PUBLIC)\java -I$(PUBLIC)\plugimpl -I$(PUBLIC)\raptor -I_jri
install:: $(DLL) install:: $(DLL)
$(MAKE_INSTALL) $(XPDIST)\classes11\Simple.class $(DEPTH)\cmd\winfe\mkfiles32\x86dbg\plugins\simple $(MAKE_INSTALL) $(XPDIST)\classes11\Simple.class $(DEPTH)\cmd\winfe\mkfiles32\x86dbg\plugins\simple

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

@ -163,10 +163,6 @@ public:
NS_IMETHOD NS_IMETHOD
GetValue(nsPluginVariable variable, void *value); GetValue(nsPluginVariable variable, void *value);
// (Corresponds to NPP_SetValue.)
NS_IMETHOD
SetValue(nsPluginVariable variable, void *value);
// The old NPP_New call has been factored into two plugin instance methods: // The old NPP_New call has been factored into two plugin instance methods:
// //
// CreateInstance -- called once, after the plugin instance is created. This // CreateInstance -- called once, after the plugin instance is created. This
@ -266,6 +262,9 @@ public:
URLNotify(const char* url, const char* target, URLNotify(const char* url, const char* target,
nsPluginReason reason, void* notifyData); nsPluginReason reason, void* notifyData);
NS_IMETHOD
GetValue(nsPluginInstanceVariable variable, void *value);
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// SimplePluginInstance specific methods: // SimplePluginInstance specific methods:
@ -504,12 +503,6 @@ SimplePlugin::GetValue(nsPluginVariable variable, void *value)
return err; return err;
} }
NS_METHOD
SimplePlugin::SetValue(nsPluginVariable variable, void *value)
{
return NS_OK;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++ /*+++++++++++++++++++++++++++++++++++++++++++++++++
* GetJavaClass: * GetJavaClass:
* *
@ -788,6 +781,12 @@ SimplePluginInstance::URLNotify(const char* url, const char* target,
return NS_OK; return NS_OK;
} }
NS_METHOD
SimplePluginInstance::GetValue(nsPluginInstanceVariable variable, void *value)
{
return NS_OK;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// SimplePluginStream Methods // SimplePluginStream Methods
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////