This commit is contained in:
michaelp%netscape.com 1998-08-02 03:20:22 +00:00
Родитель c0fc0c1696
Коммит 7e93511cca
14 изменённых файлов: 394 добавлений и 2 удалений

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

@ -34,6 +34,7 @@ CPPSRCS = \
ns4xPluginInstance.cpp \
ns4xPluginStream.cpp \
nsPluginInstancePeer.cpp \
nsPluginStreamPeer.cpp \
$(NULL)
REQUIRES = raptor plugin java xpcom

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

@ -38,6 +38,7 @@ OBJS = \
.\$(OBJDIR)\ns4xPluginInstance.obj \
.\$(OBJDIR)\ns4xPluginStream.obj \
.\$(OBJDIR)\nsPluginInstancePeer.obj \
.\$(OBJDIR)\nsPluginStreamPeer.obj \
$(NULL)
LINCS= \

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

@ -21,12 +21,13 @@
#include "xp_core.h"
#include "nsplugindefs.h"
#include "nsIFactory.h"
#define NS_IPLUGINHOST_IID \
{ 0x264c0640, 0x1c31, 0x11d2, \
{ 0xa8, 0x2e, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
struct nsIPluginHost : public nsISupports
struct nsIPluginHost : public nsIFactory
{
public:

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

@ -23,6 +23,7 @@
#include "ns4xPlugin.h"
#include "nsMalloc.h" //this is evil...
#include "nsPluginInstancePeer.h"
#include "nsPluginStreamPeer.h"
#ifdef XP_PC
#include "windows.h"
@ -108,7 +109,9 @@ nsPluginTag :: ~nsPluginTag()
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
static NS_DEFINE_IID(kIPluginStreamPeerIID, NS_IPLUGINSTREAMPEER_IID);
static NS_DEFINE_IID(kIMallocIID, NS_IMALLOC_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
nsPluginHostImpl :: nsPluginHostImpl()
@ -158,6 +161,13 @@ nsresult nsPluginHostImpl :: QueryInterface(const nsIID& aIID,
return NS_OK;
}
if (aIID.Equals(kIFactoryIID))
{
*aInstancePtrResult = (void *)((nsIFactory *)this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIMallocIID))
{
*aInstancePtrResult = mMalloc;
@ -630,3 +640,34 @@ printf("unable to find plugin to handle %s\n", aMimeType);
return NS_ERROR_FAILURE;
}
}
nsresult nsPluginHostImpl :: CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (aResult == NULL)
return NS_ERROR_NULL_POINTER;
nsISupports *inst = nsnull;
if (aIID.Equals(kIPluginStreamPeerIID))
inst = (nsISupports *)(nsIPluginStreamPeer *)new nsPluginStreamPeer();
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 nsPluginHostImpl :: LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}

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

@ -109,6 +109,14 @@ public:
NS_IMETHOD
InstantiatePlugin(char *aMimeType, nsIPluginInstance ** aPluginInst);
//nsIFactory interface
NS_IMETHOD CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
private:
char *mPluginPath;
nsPluginTag *mPlugins;

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

@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.
*/
#include "nsPluginStreamPeer.h"
nsPluginStreamPeer :: nsPluginStreamPeer()
{
}
nsPluginStreamPeer :: ~nsPluginStreamPeer()
{
}
NS_IMPL_ADDREF(nsPluginStreamPeer);
NS_IMPL_RELEASE(nsPluginStreamPeer);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPluginStreamPeerIID, NS_IPLUGINSTREAMPEER_IID);
//static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
NS_IMETHODIMP nsPluginStreamPeer :: QueryInterface(const nsIID& iid, void** instance)
{
if (instance == NULL)
return NS_ERROR_NULL_POINTER;
if (iid.Equals(kIPluginStreamPeerIID))
{
*instance = (void *)(nsIPluginStreamPeer *)this;
AddRef();
return NS_OK;
}
else if (iid.Equals(kISupportsIID))
{
*instance = (void *)(nsISupports *)this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetURL(const char* *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetEnd(PRUint32 *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetLastModified(PRUint32 *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetNotifyData(void* *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetReason(nsPluginReason *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetMIMEType(nsMIMEType *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: Initialize(void)
{
return NS_OK;
}

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

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.
*/
#ifndef nsPluginStreamPeer_h___
#define nsPluginStreamPeer_h___
#include "nsIPluginStreamPeer.h"
class nsPluginStreamPeer : public nsIPluginStreamPeer
{
public:
nsPluginStreamPeer();
~nsPluginStreamPeer();
NS_DECL_ISUPPORTS
NS_IMETHOD
GetURL(const char* *result);
NS_IMETHOD
GetEnd(PRUint32 *result);
NS_IMETHOD
GetLastModified(PRUint32 *result);
NS_IMETHOD
GetNotifyData(void* *result);
NS_IMETHOD
GetReason(nsPluginReason *result);
NS_IMETHOD
GetMIMEType(nsMIMEType *result);
NS_IMETHOD
Initialize(void);
};
#endif

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

@ -34,6 +34,7 @@ CPPSRCS = \
ns4xPluginInstance.cpp \
ns4xPluginStream.cpp \
nsPluginInstancePeer.cpp \
nsPluginStreamPeer.cpp \
$(NULL)
REQUIRES = raptor plugin java xpcom

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

@ -38,6 +38,7 @@ OBJS = \
.\$(OBJDIR)\ns4xPluginInstance.obj \
.\$(OBJDIR)\ns4xPluginStream.obj \
.\$(OBJDIR)\nsPluginInstancePeer.obj \
.\$(OBJDIR)\nsPluginStreamPeer.obj \
$(NULL)
LINCS= \

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

@ -21,12 +21,13 @@
#include "xp_core.h"
#include "nsplugindefs.h"
#include "nsIFactory.h"
#define NS_IPLUGINHOST_IID \
{ 0x264c0640, 0x1c31, 0x11d2, \
{ 0xa8, 0x2e, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
struct nsIPluginHost : public nsISupports
struct nsIPluginHost : public nsIFactory
{
public:

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

@ -23,6 +23,7 @@
#include "ns4xPlugin.h"
#include "nsMalloc.h" //this is evil...
#include "nsPluginInstancePeer.h"
#include "nsPluginStreamPeer.h"
#ifdef XP_PC
#include "windows.h"
@ -108,7 +109,9 @@ nsPluginTag :: ~nsPluginTag()
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
static NS_DEFINE_IID(kIPluginStreamPeerIID, NS_IPLUGINSTREAMPEER_IID);
static NS_DEFINE_IID(kIMallocIID, NS_IMALLOC_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
nsPluginHostImpl :: nsPluginHostImpl()
@ -158,6 +161,13 @@ nsresult nsPluginHostImpl :: QueryInterface(const nsIID& aIID,
return NS_OK;
}
if (aIID.Equals(kIFactoryIID))
{
*aInstancePtrResult = (void *)((nsIFactory *)this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIMallocIID))
{
*aInstancePtrResult = mMalloc;
@ -630,3 +640,34 @@ printf("unable to find plugin to handle %s\n", aMimeType);
return NS_ERROR_FAILURE;
}
}
nsresult nsPluginHostImpl :: CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (aResult == NULL)
return NS_ERROR_NULL_POINTER;
nsISupports *inst = nsnull;
if (aIID.Equals(kIPluginStreamPeerIID))
inst = (nsISupports *)(nsIPluginStreamPeer *)new nsPluginStreamPeer();
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 nsPluginHostImpl :: LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}

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

@ -109,6 +109,14 @@ public:
NS_IMETHOD
InstantiatePlugin(char *aMimeType, nsIPluginInstance ** aPluginInst);
//nsIFactory interface
NS_IMETHOD CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
private:
char *mPluginPath;
nsPluginTag *mPlugins;

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

@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.
*/
#include "nsPluginStreamPeer.h"
nsPluginStreamPeer :: nsPluginStreamPeer()
{
}
nsPluginStreamPeer :: ~nsPluginStreamPeer()
{
}
NS_IMPL_ADDREF(nsPluginStreamPeer);
NS_IMPL_RELEASE(nsPluginStreamPeer);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPluginStreamPeerIID, NS_IPLUGINSTREAMPEER_IID);
//static NS_DEFINE_IID(kISeekablePluginStreamPeerIID, NS_ISEEKABLEPLUGINSTREAMPEER_IID);
NS_IMETHODIMP nsPluginStreamPeer :: QueryInterface(const nsIID& iid, void** instance)
{
if (instance == NULL)
return NS_ERROR_NULL_POINTER;
if (iid.Equals(kIPluginStreamPeerIID))
{
*instance = (void *)(nsIPluginStreamPeer *)this;
AddRef();
return NS_OK;
}
else if (iid.Equals(kISupportsIID))
{
*instance = (void *)(nsISupports *)this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetURL(const char* *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetEnd(PRUint32 *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetLastModified(PRUint32 *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetNotifyData(void* *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetReason(nsPluginReason *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: GetMIMEType(nsMIMEType *result)
{
return NS_OK;
}
NS_IMETHODIMP nsPluginStreamPeer :: Initialize(void)
{
return NS_OK;
}

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

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.
*/
#ifndef nsPluginStreamPeer_h___
#define nsPluginStreamPeer_h___
#include "nsIPluginStreamPeer.h"
class nsPluginStreamPeer : public nsIPluginStreamPeer
{
public:
nsPluginStreamPeer();
~nsPluginStreamPeer();
NS_DECL_ISUPPORTS
NS_IMETHOD
GetURL(const char* *result);
NS_IMETHOD
GetEnd(PRUint32 *result);
NS_IMETHOD
GetLastModified(PRUint32 *result);
NS_IMETHOD
GetNotifyData(void* *result);
NS_IMETHOD
GetReason(nsPluginReason *result);
NS_IMETHOD
GetMIMEType(nsMIMEType *result);
NS_IMETHOD
Initialize(void);
};
#endif