Added changes to get a hold of the webshell.

This commit is contained in:
rhp%netscape.com 1999-02-11 19:56:40 +00:00
parent 3288a5382a
commit 33d49032e4
2 changed files with 59 additions and 9 deletions

View File

@ -29,6 +29,11 @@ DLL=.\$(OBJDIR)\$(MODULE).dll
DEFINES=-D_IMPL_NS_DOM -DWIN32_LEAN_AND_MEAN
OBJS = \
.\$(OBJDIR)\nsJSMsgAppCore.obj \
.\$(OBJDIR)\nsMsgAppCore.obj \
$(NULL)
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
@ -56,17 +61,11 @@ LLIBS = \
$(DIST)\lib\js3250.lib \
$(DIST)\lib\jsdombase_s.lib \
$(DIST)\lib\raptorbase.lib \
$(DIST)\lib\raptorgfxwin.lib \
$(LIBNSPR) \
$(DIST)\lib\raptorgfxwin.lib \
$(LIBNSPR) \
$(DIST)\lib\libplc21.lib \
$(NULL)
OBJS = \
.\$(OBJDIR)\nsJSMsgAppCore.obj \
.\$(OBJDIR)\nsMsgAppCore.obj \
$(NULL)
include <$(DEPTH)\config\rules.mak>
clobber::

View File

@ -22,6 +22,13 @@
#include "nsIDOMBaseAppCore.h"
#include "nsJSMsgAppCore.h"
/* rhp - for access to webshell */
#include "nsCOMPtr.h"
#include "nsIDOMWindow.h"
#include "nsIWebShell.h"
#include "nsIWebShellWindow.h"
#include "nsIScriptGlobalObject.h"
static NS_DEFINE_IID(kIMsgAppCoreIID, NS_IDOMMSGAPPCORE_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIDOMBaseAppCoreIID, NS_IDOMBASEAPPCORE_IID);
@ -44,11 +51,17 @@ public:
// nsIMsgAppCore
NS_IMETHOD GetNewMail();
NS_IMETHOD SetWindow(nsIDOMWindow* aWin);
private:
nsString mId;
void *mScriptObject;
/* rhp - need this to drive message display */
nsIDOMWindow *mWindow;
nsIWebShell *mWebShell;
};
//
@ -58,7 +71,7 @@ nsMsgAppCore::nsMsgAppCore()
{
NS_INIT_REFCNT();
mScriptObject = nsnull;
mWebShell = nsnull;
}
nsMsgAppCore::~nsMsgAppCore()
@ -175,3 +188,41 @@ NS_NewMsgAppCore(nsIDOMMsgAppCore **aResult)
}
return NS_ERROR_NOT_INITIALIZED;
}
NS_IMETHODIMP
nsMsgAppCore::SetWindow(nsIDOMWindow* aWin)
{
mWindow = aWin;
NS_ADDREF(aWin);
/* rhp - Needed to access the webshell to drive message display */
printf("nsMsgAppCore::SetWindow(): Getting the webShell of interest...\n");
nsCOMPtr<nsIScriptGlobalObject> globalObj( aWin );
if (!globalObj)
{
return NS_ERROR_FAILURE;
}
nsIWebShell *webShell;
globalObj->GetWebShell(&webShell);
if (nsnull != webShell)
{
nsIWebShellContainer *webShellContainer;
webShell->GetContainer(webShellContainer);
if (nsnull != webShellContainer)
{
/* NOTE: Need to know what the name of the frame for the message window is
named */
webShellContainer->FindWebShellWithName(nsAutoString("browser.messagewindow"),
mWebShell);
NS_RELEASE(webShellContainer);
printf("nsMsgAppCore::SetWindow(): Got the webShell of interest...\n");
}
NS_RELEASE(webShell);
}
return NS_OK;
}