зеркало из https://github.com/mozilla/pjs.git
Bug 17732 -- fixing streaming API from plugin to browser, some formatting fixed, r=peterl, sr=rpotts
This commit is contained in:
Родитель
ad74e6349e
Коммит
5d42b1e824
|
@ -814,8 +814,11 @@ _posturl(NPP npp, const char *relativeURL, const char *target,
|
|||
// A little helper class used to wrap up plugin manager streams (that is,
|
||||
// streams from the plugin to the browser).
|
||||
|
||||
class ns4xStreamWrapper
|
||||
class ns4xStreamWrapper : nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
nsIOutputStream *fStream;
|
||||
NPStream fNPStream;
|
||||
|
@ -828,6 +831,8 @@ public:
|
|||
NPStream* GetNPStream(void) { return &fNPStream; };
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ns4xStreamWrapper, nsISupports);
|
||||
|
||||
ns4xStreamWrapper::ns4xStreamWrapper(nsIOutputStream* stream)
|
||||
: fStream(stream)
|
||||
{
|
||||
|
|
|
@ -73,8 +73,7 @@ nsPluginInstancePeerImpl::~nsPluginInstancePeerImpl()
|
|||
mInstance = nsnull;
|
||||
NS_IF_RELEASE(mOwner);
|
||||
|
||||
if (nsnull != mMIMEType)
|
||||
{
|
||||
if (nsnull != mMIMEType) {
|
||||
PR_Free((void *)mMIMEType);
|
||||
mMIMEType = nsnull;
|
||||
}
|
||||
|
@ -91,52 +90,46 @@ NS_IMPL_RELEASE(nsPluginInstancePeerImpl);
|
|||
|
||||
nsresult nsPluginInstancePeerImpl::QueryInterface(const nsIID& iid, void** instance)
|
||||
{
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (instance == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (iid.Equals(NS_GET_IID(nsIPluginInstancePeer)) || iid.Equals(NS_GET_IID(nsIPluginInstancePeer2)))
|
||||
{
|
||||
*instance = (void *)(nsIPluginInstancePeer2*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(NS_GET_IID(nsIPluginInstancePeer)) || iid.Equals(NS_GET_IID(nsIPluginInstancePeer2))) {
|
||||
*instance = (void *)(nsIPluginInstancePeer2*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIWindowlessPluginInstancePeerIID))//~~~
|
||||
{
|
||||
*instance = (void *)(nsIWindowlessPluginInstancePeer*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(kIWindowlessPluginInstancePeerIID)) {
|
||||
*instance = (void *)(nsIWindowlessPluginInstancePeer*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIPluginTagInfoIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginTagInfo *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(kIPluginTagInfoIID)) {
|
||||
*instance = (void *)(nsIPluginTagInfo *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIPluginTagInfo2IID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginTagInfo2 *)this;
|
||||
AddRef();
|
||||
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(kIJVMPluginTagInfoIID)) {
|
||||
*instance = (void *)(nsIJVMPluginTagInfo *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kISupportsIID))
|
||||
{
|
||||
*instance = (void *)(nsISupports *)(nsIPluginTagInfo *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(kISupportsIID)) {
|
||||
*instance = (void *)(nsISupports *)(nsIPluginTagInfo *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetValue(nsPluginInstancePeerVariable variable, void *value)
|
||||
|
@ -177,82 +170,79 @@ class nsPluginStreamToFile : public nsIOutputStream
|
|||
{
|
||||
public:
|
||||
|
||||
nsPluginStreamToFile(const char* target, nsIPluginInstanceOwner* owner);
|
||||
virtual ~nsPluginStreamToFile();
|
||||
nsPluginStreamToFile(const char* target, nsIPluginInstanceOwner* owner);
|
||||
virtual ~nsPluginStreamToFile();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOUTPUTSTREAM
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOUTPUTSTREAM
|
||||
|
||||
protected:
|
||||
char* mTarget;
|
||||
nsFileURL mFileURL;
|
||||
nsFileSpec mFileSpec;
|
||||
nsCOMPtr<nsIFileSpecOutputStream> mFileThing;
|
||||
nsIPluginInstanceOwner* mOwner;
|
||||
char* mTarget;
|
||||
nsFileURL mFileURL;
|
||||
nsFileSpec mFileSpec;
|
||||
nsCOMPtr<nsIFileSpecOutputStream> mFileThing;
|
||||
nsIPluginInstanceOwner* mOwner;
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF(nsPluginStreamToFile);
|
||||
NS_IMPL_RELEASE(nsPluginStreamToFile);
|
||||
|
||||
nsPluginStreamToFile::nsPluginStreamToFile(const char* target, nsIPluginInstanceOwner* owner)
|
||||
: mTarget(PL_strdup(target))
|
||||
, mFileURL(nsnull)
|
||||
, mOwner(owner)
|
||||
nsPluginStreamToFile::nsPluginStreamToFile(const char* target, nsIPluginInstanceOwner* owner) :
|
||||
mTarget(PL_strdup(target)),
|
||||
mFileURL(nsnull),
|
||||
mOwner(owner)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// open the file and prepare it for writing
|
||||
char buf[400], tpath[300];
|
||||
// open the file and prepare it for writing
|
||||
char buf[400], tpath[300];
|
||||
#ifdef XP_PC
|
||||
#ifdef XP_OS2
|
||||
PL_strcpy(tpath, getenv("TEMP"));
|
||||
#else
|
||||
::GetTempPath(sizeof(tpath), tpath);
|
||||
::GetTempPath(sizeof(tpath), tpath);
|
||||
#endif
|
||||
PRInt32 len = PL_strlen(tpath);
|
||||
PRInt32 len = PL_strlen(tpath);
|
||||
|
||||
if ((len > 0) && (tpath[len-1] != '\\'))
|
||||
{
|
||||
tpath[len] = '\\';
|
||||
tpath[len+1] = 0;
|
||||
}
|
||||
if ((len > 0) && (tpath[len-1] != '\\')) {
|
||||
tpath[len] = '\\';
|
||||
tpath[len+1] = 0;
|
||||
}
|
||||
#elif defined (XP_UNIX) || defined (XP_BEOS)
|
||||
PL_strcpy(tpath, "/tmp/");
|
||||
PL_strcpy(tpath, "/tmp/");
|
||||
#else
|
||||
tpath[0] = 0;
|
||||
tpath[0] = 0;
|
||||
#endif // XP_PC
|
||||
|
||||
PR_snprintf(buf, sizeof(buf), "%s%08X.html", tpath, this);
|
||||
PR_snprintf(buf, sizeof(buf), "%s%08X", tpath, this);
|
||||
|
||||
// Create and validate the file spec object. (When we have a constructor for the temp
|
||||
// directory, we should use this instead of the per-platform hack above).
|
||||
mFileSpec = PL_strdup(buf);
|
||||
if (mFileSpec.Error())
|
||||
return;
|
||||
|
||||
// Create and validate the file spec object. (When we have a constructor for the temp
|
||||
// directory, we should use this instead of the per-platform hack above).
|
||||
mFileSpec = PL_strdup(buf);
|
||||
if (mFileSpec.Error())
|
||||
return;
|
||||
|
||||
// create the file
|
||||
nsISupports* ourStream;
|
||||
if (NS_FAILED(NS_NewTypicalOutputFileStream(&ourStream, mFileSpec)))
|
||||
return;
|
||||
mFileThing = do_QueryInterface(ourStream);
|
||||
NS_RELEASE(ourStream);
|
||||
// create the file
|
||||
nsISupports* ourStream;
|
||||
if (NS_FAILED(NS_NewTypicalOutputFileStream(&ourStream, mFileSpec)))
|
||||
return;
|
||||
mFileThing = do_QueryInterface(ourStream);
|
||||
NS_RELEASE(ourStream);
|
||||
|
||||
mFileThing->Close();
|
||||
mFileThing->Close();
|
||||
|
||||
// construct the URL we'll use later in calls to GetURL()
|
||||
mFileURL = mFileSpec;
|
||||
// construct the URL we'll use later in calls to GetURL()
|
||||
mFileURL = mFileSpec;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
printf("File URL = %s\n", mFileURL.GetAsString());
|
||||
printf("File URL = %s\n", mFileURL.GetAsString());
|
||||
#endif
|
||||
}
|
||||
|
||||
nsPluginStreamToFile::~nsPluginStreamToFile()
|
||||
{
|
||||
if (nsnull != mTarget)
|
||||
PL_strfree(mTarget);
|
||||
|
||||
if (nsnull != mTarget)
|
||||
PL_strfree(mTarget);
|
||||
}
|
||||
|
||||
nsresult nsPluginStreamToFile::QueryInterface(const nsIID& aIID,
|
||||
|
@ -263,8 +253,7 @@ nsresult nsPluginStreamToFile::QueryInterface(const nsIID& aIID,
|
|||
if (nsnull == aInstancePtrResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(kIOutputStreamIID))
|
||||
{
|
||||
if (aIID.Equals(kIOutputStreamIID)) {
|
||||
*aInstancePtrResult = (void *)((nsIOutputStream *)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
|
@ -276,72 +265,71 @@ nsresult nsPluginStreamToFile::QueryInterface(const nsIID& aIID,
|
|||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::Flush()
|
||||
{
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount)
|
||||
{
|
||||
// write the data to the file and update the target
|
||||
nsCOMPtr<nsIOpenFile> thing;
|
||||
thing = do_QueryInterface(mFileThing);
|
||||
thing->Open(mFileSpec, (PR_RDWR|PR_APPEND), 0700);
|
||||
PRUint32 actualCount;
|
||||
mFileThing->Write(aBuf, aCount, &actualCount);
|
||||
mFileThing->Close();
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0, nsnull, 0);
|
||||
// write the data to the file and update the target
|
||||
nsCOMPtr<nsIOpenFile> thing;
|
||||
thing = do_QueryInterface(mFileThing);
|
||||
thing->Open(mFileSpec, (PR_WRONLY | PR_CREATE_FILE | PR_APPEND), 0700);
|
||||
PRUint32 actualCount;
|
||||
mFileThing->Write(aBuf, aCount, &actualCount);
|
||||
mFileThing->Close();
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0, nsnull, 0);
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
|
||||
{
|
||||
NS_NOTREACHED("WriteFrom");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_NOTREACHED("WriteFrom");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
|
||||
{
|
||||
NS_NOTREACHED("WriteSegments");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_NOTREACHED("WriteSegments");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::GetNonBlocking(PRBool *aNonBlocking)
|
||||
{
|
||||
NS_NOTREACHED("GetNonBlocking");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_NOTREACHED("GetNonBlocking");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::SetNonBlocking(PRBool aNonBlocking)
|
||||
{
|
||||
NS_NOTREACHED("SetNonBlocking");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_NOTREACHED("SetNonBlocking");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::GetObserver(nsIOutputStreamObserver * *aObserver)
|
||||
{
|
||||
NS_NOTREACHED("GetObserver");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_NOTREACHED("GetObserver");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::SetObserver(nsIOutputStreamObserver * aObserver)
|
||||
{
|
||||
NS_NOTREACHED("SetObserver");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_NOTREACHED("SetObserver");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::Close(void)
|
||||
{
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0, nsnull, 0);
|
||||
|
||||
return NS_OK;
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0, nsnull, 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// end of nsPluginStreamToFile
|
||||
|
@ -368,23 +356,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::ShowStatus(const char* message)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo *tinfo;
|
||||
nsresult rv;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfoIID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetAttributes(n, names, values);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
n = 0;
|
||||
names = nsnull;
|
||||
values = nsnull;
|
||||
|
@ -395,23 +380,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetAttributes(PRUint16& n, const char*co
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetAttribute(const char* name, const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo *tinfo;
|
||||
nsresult rv;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfoIID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetAttribute(name, result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = "";
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -419,19 +401,17 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetAttribute(const char* name, const cha
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetDOMElement(nsIDOMElement* *result)
|
||||
{
|
||||
if (mOwner == nsnull)
|
||||
{
|
||||
if (mOwner == nsnull) {
|
||||
*result = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetDOMElement(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
@ -441,23 +421,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetDOMElement(nsIDOMElement* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetTagType(nsPluginTagType *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetTagType(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = nsPluginTagType_Unknown;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -465,23 +442,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetTagType(nsPluginTagType *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetTagText(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetTagText(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = "";
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -489,23 +463,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetTagText(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetParameters(PRUint16& n, const char*const*& names, const char*const*& values)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetParameters(n, names, values);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
n = 0;
|
||||
names = nsnull;
|
||||
values = nsnull;
|
||||
|
@ -516,23 +487,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetParameters(PRUint16& n, const char*co
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetParameter(const char* name, const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetParameter(name, result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = "";
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -540,23 +508,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetParameter(const char* name, const cha
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentBase(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetDocumentBase(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = "";
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -564,23 +529,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentBase(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentEncoding(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetDocumentEncoding(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = "";
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -588,23 +550,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetDocumentEncoding(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetAlignment(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetAlignment(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = "";
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -612,23 +571,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetAlignment(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetWidth(PRUint32 *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetWidth(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -636,23 +592,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetWidth(PRUint32 *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetHeight(PRUint32 *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetHeight(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -660,23 +613,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetHeight(PRUint32 *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetBorderVertSpace(PRUint32 *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetBorderVertSpace(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -684,23 +634,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetBorderVertSpace(PRUint32 *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetBorderHorizSpace(PRUint32 *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetBorderHorizSpace(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -708,23 +655,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetBorderHorizSpace(PRUint32 *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetUniqueID(PRUint32 *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIPluginTagInfo2 *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIPluginTagInfo2IID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetUniqueID(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -732,23 +676,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetUniqueID(PRUint32 *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetCode(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIJVMPluginTagInfo *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetCode(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -756,23 +697,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetCode(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetCodeBase(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIJVMPluginTagInfo *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetCodeBase(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -780,23 +718,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetCodeBase(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetArchive(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIJVMPluginTagInfo *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetArchive(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -804,23 +739,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetArchive(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetName(const char* *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIJVMPluginTagInfo *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetName(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -828,23 +760,20 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetName(const char* *result)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstancePeerImpl::GetMayScript(PRBool *result)
|
||||
{
|
||||
if (nsnull != mOwner)
|
||||
{
|
||||
if (nsnull != mOwner) {
|
||||
nsIJVMPluginTagInfo *tinfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mOwner->QueryInterface(kIJVMPluginTagInfoIID, (void **)&tinfo);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == rv) {
|
||||
rv = tinfo->GetMayScript(result);
|
||||
NS_RELEASE(tinfo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*result = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -917,8 +846,7 @@ nsresult nsPluginInstancePeerImpl::Initialize(nsIPluginInstanceOwner *aOwner,
|
|||
aOwner->GetInstance(mInstance);
|
||||
NS_IF_RELEASE(mInstance);
|
||||
|
||||
if (nsnull != aMIMEType)
|
||||
{
|
||||
if (nsnull != aMIMEType) {
|
||||
mMIMEType = (nsMIMEType)PR_Malloc(PL_strlen(aMIMEType) + 1);
|
||||
|
||||
if (nsnull != mMIMEType)
|
||||
|
@ -979,21 +907,3 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::ForceRedraw(void)
|
|||
|
||||
return mOwner->ForceRedraw();
|
||||
}
|
||||
|
||||
/*void
|
||||
nsPluginInstancePeerImpl::SetStopped()
|
||||
{
|
||||
mStopped = PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginInstancePeerImpl::SetStarted()
|
||||
{
|
||||
mStopped = PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginInstancePeerImpl::IsStopped(PRBool *result)
|
||||
{
|
||||
*result = mStopped;
|
||||
}*/
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
|
||||
class nsPluginInstancePeerImpl : public nsIPluginInstancePeer2,
|
||||
public nsIWindowlessPluginInstancePeer,
|
||||
public nsIWindowlessPluginInstancePeer,
|
||||
public nsIPluginTagInfo2,
|
||||
public nsIJVMPluginTagInfo
|
||||
|
||||
|
@ -180,11 +180,6 @@ public:
|
|||
|
||||
nsresult GetOwner(nsIPluginInstanceOwner *&aOwner);
|
||||
|
||||
/* void SetStopped();
|
||||
void SetStarted();
|
||||
|
||||
void IsStopped(PRBool *result);*/
|
||||
|
||||
private:
|
||||
nsIPluginInstance *mInstance; //we don't add a ref to this
|
||||
nsIPluginInstanceOwner *mOwner; //we don't add a ref to this
|
||||
|
|
Загрузка…
Ссылка в новой задаче