hooked up the plugin manager to the webshell.
This commit is contained in:
Родитель
e8157d4857
Коммит
3bc803ac1f
|
@ -31,6 +31,9 @@
|
|||
#include "nsWidgetsCID.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "plevent.h"
|
||||
#include "nsplugin.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsPluginsCID.h"
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
|
@ -154,6 +157,8 @@ public:
|
|||
|
||||
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
||||
|
||||
static nsresult CreatePluginHost(void);
|
||||
|
||||
protected:
|
||||
nsIScriptGlobalObject *mScriptGlobal;
|
||||
nsIScriptContext* mScriptContext;
|
||||
|
@ -181,6 +186,9 @@ protected:
|
|||
nsScrollPreference mScrollPref;
|
||||
|
||||
void ReleaseChildren();
|
||||
|
||||
static nsIPluginHost *mPluginHost;
|
||||
static nsIPluginManager *mPluginManager;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -202,10 +210,39 @@ static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
|
|||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
||||
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
|
||||
static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID);
|
||||
|
||||
// XXX not sure
|
||||
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
|
||||
|
||||
nsIPluginHost *nsWebShell::mPluginHost = nsnull;
|
||||
nsIPluginManager *nsWebShell::mPluginManager = nsnull;
|
||||
|
||||
nsresult nsWebShell::CreatePluginHost(void)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (nsnull == mPluginManager)
|
||||
{
|
||||
rv = NSRepository::CreateInstance(kCPluginHostCID, nsnull,
|
||||
kIPluginManagerIID,
|
||||
(void**)&mPluginManager);
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == mPluginManager->QueryInterface(kIPluginHostIID,
|
||||
(void **)&mPluginHost))
|
||||
{
|
||||
mPluginHost->Init();
|
||||
mPluginHost->LoadPlugins();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Note: operator new zeros our memory
|
||||
|
@ -309,6 +346,11 @@ nsWebShell::QueryCapability(const nsIID &aIID, void** aInstancePtr)
|
|||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//XXX this seems a little wrong. MMP
|
||||
if (nsnull != mPluginManager)
|
||||
return mPluginManager->QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -349,6 +391,11 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
//XXX make sure plugins have started up. this really needs to
|
||||
//be associated with the nsIContentViewerContainer interfaces,
|
||||
//not the nsIWebShell interfaces. this is a hack. MMP
|
||||
CreatePluginHost();
|
||||
|
||||
mScrollPref = aScrolling;
|
||||
|
||||
WEB_TRACE(WEB_TRACE_CALLS,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "nsplugin.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#define nsObjectFrameSuper nsLeafFrame
|
||||
|
@ -199,14 +200,19 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
|
||||
static NS_DEFINE_IID(kIContentViewerContainerIID, NS_ICONTENT_VIEWER_CONTAINER_IID);
|
||||
|
||||
nsISupports *container, *pluginsup;
|
||||
nsIPluginHost *pm;
|
||||
nsIContentViewerContainer *cv;
|
||||
|
||||
rv = aPresContext.GetContainer(&container);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = container->QueryInterface(kIPluginHostIID, (void **)&pm);
|
||||
rv = container->QueryInterface(kIContentViewerContainerIID, (void **)&cv);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = cv->QueryCapability(kIPluginHostIID, (void **)&pm);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
nsString type;
|
||||
|
@ -233,6 +239,9 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
NS_RELEASE(pm);
|
||||
}
|
||||
|
||||
NS_RELEASE(cv);
|
||||
}
|
||||
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "nsplugin.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#define nsObjectFrameSuper nsLeafFrame
|
||||
|
@ -199,14 +200,19 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
|
||||
static NS_DEFINE_IID(kIContentViewerContainerIID, NS_ICONTENT_VIEWER_CONTAINER_IID);
|
||||
|
||||
nsISupports *container, *pluginsup;
|
||||
nsIPluginHost *pm;
|
||||
nsIContentViewerContainer *cv;
|
||||
|
||||
rv = aPresContext.GetContainer(&container);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = container->QueryInterface(kIPluginHostIID, (void **)&pm);
|
||||
rv = container->QueryInterface(kIContentViewerContainerIID, (void **)&cv);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
rv = cv->QueryCapability(kIPluginHostIID, (void **)&pm);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
nsString type;
|
||||
|
@ -233,6 +239,9 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
NS_RELEASE(pm);
|
||||
}
|
||||
|
||||
NS_RELEASE(cv);
|
||||
}
|
||||
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ IGNORE_MANIFEST=1
|
|||
THIS_MAKEFILE=nglayout.mak
|
||||
THAT_MAKEFILE=makefile.win
|
||||
|
||||
!if !defined(MODULAR_NETLIB) || !defined(STANDALONE_IMAGE_LIB)
|
||||
!if !defined(MODULAR_NETLIB) || !defined(STANDALONE_IMAGE_LIB) || !defined(NGLAYOUT_PLUGINS)
|
||||
ERR_MSG = ^
|
||||
You need to set MODULAR_NETLIB=1 and STANDALONE_IMAGE_LIB=1 ^
|
||||
in your environment.
|
||||
You need to set MODULAR_NETLIB=1, STANDALONE_IMAGE_LIB=1 ^
|
||||
and NGLAYOUT_PLUGINS=1 in your environment.
|
||||
!ERROR $(ERR_MSG)
|
||||
!endif
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ REQUIRES=xpcom raptor dom js netlib
|
|||
|
||||
EXTRA_DSO_LDOPTS += -lm
|
||||
|
||||
INCLUDES += -I../public -I$(PUBLIC)/raptor -I$(PUBLIC)/xpcom -I$(PUBLIC)/dom -I$(PUBLIC)/js -I(PUBLIC)/netlib
|
||||
INCLUDES += -I../public -I$(PUBLIC)/raptor -I$(PUBLIC)/xpcom -I$(PUBLIC)/dom -I$(PUBLIC)/js -I$(PUBLIC)/netlib -I$(PUBLIC)/plugin -I$(PUBLIC)/java
|
||||
|
||||
DEFINES = -D_IMPL_NS_WEB
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ CPP_OBJS= \
|
|||
$(NULL)
|
||||
|
||||
LINCS=-I..\public -I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib \
|
||||
-I$(PUBLIC)\plugin -I$(PUBLIC)\java
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = raptorweb
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#include "nsWidgetsCID.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "plevent.h"
|
||||
#include "nsplugin.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsPluginsCID.h"
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
|
@ -154,6 +157,8 @@ public:
|
|||
|
||||
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
||||
|
||||
static nsresult CreatePluginHost(void);
|
||||
|
||||
protected:
|
||||
nsIScriptGlobalObject *mScriptGlobal;
|
||||
nsIScriptContext* mScriptContext;
|
||||
|
@ -181,6 +186,9 @@ protected:
|
|||
nsScrollPreference mScrollPref;
|
||||
|
||||
void ReleaseChildren();
|
||||
|
||||
static nsIPluginHost *mPluginHost;
|
||||
static nsIPluginManager *mPluginManager;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -202,10 +210,39 @@ static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
|
|||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
|
||||
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
|
||||
static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID);
|
||||
|
||||
// XXX not sure
|
||||
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
|
||||
|
||||
nsIPluginHost *nsWebShell::mPluginHost = nsnull;
|
||||
nsIPluginManager *nsWebShell::mPluginManager = nsnull;
|
||||
|
||||
nsresult nsWebShell::CreatePluginHost(void)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (nsnull == mPluginManager)
|
||||
{
|
||||
rv = NSRepository::CreateInstance(kCPluginHostCID, nsnull,
|
||||
kIPluginManagerIID,
|
||||
(void**)&mPluginManager);
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
if (NS_OK == mPluginManager->QueryInterface(kIPluginHostIID,
|
||||
(void **)&mPluginHost))
|
||||
{
|
||||
mPluginHost->Init();
|
||||
mPluginHost->LoadPlugins();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Note: operator new zeros our memory
|
||||
|
@ -309,6 +346,11 @@ nsWebShell::QueryCapability(const nsIID &aIID, void** aInstancePtr)
|
|||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//XXX this seems a little wrong. MMP
|
||||
if (nsnull != mPluginManager)
|
||||
return mPluginManager->QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -349,6 +391,11 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling)
|
||||
{
|
||||
//XXX make sure plugins have started up. this really needs to
|
||||
//be associated with the nsIContentViewerContainer interfaces,
|
||||
//not the nsIWebShell interfaces. this is a hack. MMP
|
||||
CreatePluginHost();
|
||||
|
||||
mScrollPref = aScrolling;
|
||||
|
||||
WEB_TRACE(WEB_TRACE_CALLS,
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
#include "nsWidgetsCID.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsViewsCID.h"
|
||||
|
||||
#ifdef VIEWER_PLUGINS
|
||||
#include "nsPluginsCID.h"
|
||||
#endif
|
||||
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
@ -77,10 +74,7 @@ static NS_DEFINE_IID(kCScrollingViewCID, NS_SCROLLING_VIEW_CID);
|
|||
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
|
||||
static NS_DEFINE_IID(kCDocumentLoaderCID, NS_DOCUMENTLOADER_CID);
|
||||
static NS_DEFINE_IID(kThrobberCID, NS_THROBBER_CID);
|
||||
|
||||
#ifdef VIEWER_PLUGINS
|
||||
static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID);
|
||||
#endif
|
||||
|
||||
extern "C" void
|
||||
NS_SetupRegistry()
|
||||
|
@ -110,8 +104,5 @@ NS_SetupRegistry()
|
|||
NSRepository::RegisterFactory(kCDocumentLoaderCID, WEB_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kThrobberCID, WEB_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kPrefCID, PREF_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
#ifdef VIEWER_PLUGINS
|
||||
NSRepository::RegisterFactory(kCPluginHostCID, PLUGIN_DLL, PR_FALSE, PR_FALSE);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -35,11 +35,6 @@
|
|||
#include "JSConsole.h"
|
||||
#endif
|
||||
|
||||
#ifdef VIEWER_PLUGINS
|
||||
static nsIPluginManager *gPluginManager = nsnull;
|
||||
static nsIPluginHost *gPluginHost = nsnull;
|
||||
#endif
|
||||
|
||||
extern nsresult NS_NewBrowserWindowFactory(nsIFactory** aFactory);
|
||||
extern "C" void NS_SetupRegistry();
|
||||
extern "C" int NET_PollSockets();
|
||||
|
@ -145,26 +140,6 @@ nsViewerApp::Initialize(int argc, char** argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef VIEWER_PLUGINS
|
||||
if (nsnull == gPluginManager) {
|
||||
rv = NSRepository::CreateInstance(kCPluginHostCID, nsnull,
|
||||
kIPluginManagerIID,
|
||||
(void**)&gPluginManager);
|
||||
if (NS_OK==rv)
|
||||
{
|
||||
if (NS_OK == gPluginManager->QueryInterface(kIPluginHostIID,
|
||||
(void **)&gPluginHost))
|
||||
{
|
||||
gPluginHost->Init();
|
||||
gPluginHost->LoadPlugins();
|
||||
}
|
||||
}
|
||||
|
||||
// It's ok if we can't host plugins
|
||||
rv = NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Finally process our arguments
|
||||
rv = ProcessArguments(argc, argv);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче