added support for plugintaginfo2 and jvmtaginfo.

git-svn-id: svn://10.0.0.236/trunk@11187 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
michaelp%netscape.com
1998-09-27 22:24:54 +00:00
parent d62a69de3c
commit 7c26bd90f5
4 changed files with 1038 additions and 10 deletions

View File

@@ -48,7 +48,9 @@ NS_IMPL_ADDREF(nsPluginInstancePeerImpl);
NS_IMPL_RELEASE(nsPluginInstancePeerImpl);
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
static NS_DEFINE_IID(kIPluginInstancePeerIID, NS_IPLUGININSTANCEPEER_IID);
static NS_DEFINE_IID(kIJVMPluginTagInfoIID, NS_IJVMPLUGINTAGINFO_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
nsresult nsPluginInstancePeerImpl :: QueryInterface(const nsIID& iid, void** instance)
@@ -70,6 +72,20 @@ nsresult nsPluginInstancePeerImpl :: QueryInterface(const nsIID& iid, void** ins
return NS_OK;
}
if (iid.Equals(kIPluginTagInfo2IID))
{
*instance = (void *)(nsIPluginTagInfo2 *)this;
AddRef();
return NS_OK;
}
if (iid.Equals(kIJVMPluginTagInfoIID))
{
*instance = (void *)(nsIJVMPluginTagInfo *)this;
AddRef();
return NS_OK;
}
if (iid.Equals(kISupportsIID))
{
*instance = (void *)(nsISupports *)(nsIPluginTagInfo *)this;
@@ -112,19 +128,35 @@ printf("instance peer newstream called\n");
NS_IMETHODIMP nsPluginInstancePeerImpl :: ShowStatus(const char* message)
{
printf("instance peer showstatus called\n");
return NS_OK;
if (nsnull != mOwner)
return mOwner->ShowStatus(message);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values)
{
if (nsnull != mOwner)
return mOwner->GetAttributes(n, names, values);
{
nsIPluginTagInfo *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfoIID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetAttributes(n, names, values);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
n = 0;
names = nsnull;
values = nsnull;
return NS_ERROR_FAILURE;
}
}
@@ -132,7 +164,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl :: GetAttributes(PRUint16& n, const char*
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetAttribute(const char* name, const char* *result)
{
if (nsnull != mOwner)
return mOwner->GetAttribute(name, result);
{
nsIPluginTagInfo *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfoIID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetAttribute(name, result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = "";
@@ -140,6 +185,417 @@ NS_IMETHODIMP nsPluginInstancePeerImpl :: GetAttribute(const char* name, const c
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetTagType(nsPluginTagType *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetTagType(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = nsPluginTagType_Unknown;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetTagText(const char* *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetTagText(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = "";
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetParameters(PRUint16& n, const char*const*& names, const char*const*& values)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetParameters(n, names, values);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
n = 0;
names = nsnull;
values = nsnull;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetParameter(const char* name, const char* *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetParameter(name, result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = "";
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetDocumentBase(const char* *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetDocumentBase(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = "";
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetDocumentEncoding(const char* *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetDocumentEncoding(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = "";
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetAlignment(const char* *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetAlignment(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = "";
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetWidth(PRUint32 *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetWidth(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetHeight(PRUint32 *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetHeight(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetBorderVertSpace(PRUint32 *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetBorderVertSpace(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetBorderHorizSpace(PRUint32 *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetBorderHorizSpace(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetUniqueID(PRUint32 *result)
{
if (nsnull != mOwner)
{
nsIPluginTagInfo2 *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetUniqueID(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetCode(const char* *result)
{
if (nsnull != mOwner)
{
nsIJVMPluginTagInfo *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetCode(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetCodeBase(const char* *result)
{
if (nsnull != mOwner)
{
nsIJVMPluginTagInfo *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetCodeBase(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetArchive(const char* *result)
{
if (nsnull != mOwner)
{
nsIJVMPluginTagInfo *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetArchive(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetName(const char* *result)
{
if (nsnull != mOwner)
{
nsIJVMPluginTagInfo *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetName(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: GetMayScript(PRBool *result)
{
if (nsnull != mOwner)
{
nsIJVMPluginTagInfo *tinfo;
nsresult rv;
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
if (NS_OK == rv)
{
rv = tinfo->GetMayScript(result);
NS_RELEASE(tinfo);
}
return rv;
}
else
{
*result = 0;
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP nsPluginInstancePeerImpl :: SetWindowSize(PRUint32 width, PRUint32 height)
{
printf("instance peer setwindowsize called\n");

View File

@@ -22,8 +22,11 @@
#include "nsIPluginInstancePeer.h"
#include "nsIPluginTagInfo.h"
#include "nsIPluginInstanceOwner.h"
#include "nsIJVMPluginTagInfo.h"
class nsPluginInstancePeerImpl : public nsIPluginInstancePeer, public nsIPluginTagInfo
class nsPluginInstancePeerImpl : public nsIPluginInstancePeer,
public nsIPluginTagInfo2,
public nsIJVMPluginTagInfo
{
public:
nsPluginInstancePeerImpl();
@@ -59,6 +62,61 @@ public:
NS_IMETHOD
GetAttribute(const char* name, const char* *result);
//nsIPluginTagInfo2 interface
NS_IMETHOD
GetTagType(nsPluginTagType *result);
NS_IMETHOD
GetTagText(const char* *result);
NS_IMETHOD
GetParameters(PRUint16& n, const char*const*& names, const char*const*& values);
NS_IMETHOD
GetParameter(const char* name, const char* *result);
NS_IMETHOD
GetDocumentBase(const char* *result);
NS_IMETHOD
GetDocumentEncoding(const char* *result);
NS_IMETHOD
GetAlignment(const char* *result);
NS_IMETHOD
GetWidth(PRUint32 *result);
NS_IMETHOD
GetHeight(PRUint32 *result);
NS_IMETHOD
GetBorderVertSpace(PRUint32 *result);
NS_IMETHOD
GetBorderHorizSpace(PRUint32 *result);
NS_IMETHOD
GetUniqueID(PRUint32 *result);
//nsIJVMPluginTagInfo interface
NS_IMETHOD
GetCode(const char* *result);
NS_IMETHOD
GetCodeBase(const char* *result);
NS_IMETHOD
GetArchive(const char* *result);
NS_IMETHOD
GetName(const char* *result);
NS_IMETHOD
GetMayScript(PRBool *result);
//locals
nsresult Initialize(nsIPluginInstanceOwner *aInstance,