mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-31 21:21:08 +00:00
Added support for chrome close callback.
This commit is contained in:
parent
b62831f11d
commit
da441f7701
@ -108,6 +108,8 @@ CBrowserContext::CBrowserContext()
|
||||
, mMochaImagesLooping(false)
|
||||
, mMochaImagesDelayed(false)
|
||||
, mInNoMoreUsers(false)
|
||||
, mCloseCallback(nil)
|
||||
, mCloseCallbackArg(nil)
|
||||
{
|
||||
mLoadImagesOverride = false;
|
||||
mDelayImages = CPrefs::GetBoolean( CPrefs::DelayImages );
|
||||
@ -143,6 +145,8 @@ CBrowserContext::CBrowserContext(MWContextType inType)
|
||||
, mMochaImagesLooping(false)
|
||||
, mMochaImagesDelayed(false)
|
||||
, mInNoMoreUsers(false)
|
||||
, mCloseCallback(nil)
|
||||
, mCloseCallbackArg(nil)
|
||||
{
|
||||
mLoadImagesOverride = false;
|
||||
mDelayImages = CPrefs::GetBoolean( CPrefs::DelayImages );
|
||||
@ -179,6 +183,8 @@ CBrowserContext::CBrowserContext(const CBrowserContext& inOriginal)
|
||||
, mMochaImagesLooping(false)
|
||||
, mMochaImagesDelayed(false)
|
||||
, mInNoMoreUsers(false)
|
||||
, mCloseCallback(nil)
|
||||
, mCloseCallbackArg(nil)
|
||||
{
|
||||
mLoadImagesOverride = inOriginal.IsLoadImagesOverride();
|
||||
mDelayImages = inOriginal.IsImageLoadingDelayed();
|
||||
@ -214,8 +220,27 @@ CBrowserContext::~CBrowserContext()
|
||||
XP_FREE(mContext.name);
|
||||
mContext.name = NULL;
|
||||
}
|
||||
|
||||
// 98-05-27 pinkerton - call close callback
|
||||
if ( mCloseCallback )
|
||||
(*mCloseCallback)(mCloseCallbackArg);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// SetCloseCallback
|
||||
//
|
||||
// Set a callback (from the chrome structure) to be called when this window/context goes
|
||||
// away.
|
||||
//
|
||||
void
|
||||
CBrowserContext :: SetCloseCallback ( void (* close_callback)(void *close_arg), void* close_arg )
|
||||
{
|
||||
mCloseCallback = close_callback;
|
||||
mCloseCallbackArg = close_arg;
|
||||
}
|
||||
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
// ¥
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
@ -88,6 +88,8 @@ class CBrowserContext : public CNSContext
|
||||
|
||||
virtual Boolean SupportsPageServices();
|
||||
|
||||
void SetCloseCallback ( void (* close_callback)(void *close_arg), void* close_arg );
|
||||
|
||||
// FIX ME!!! ACCESSOR for unique ID
|
||||
|
||||
// LAYERS / COMPOSITOR
|
||||
@ -107,6 +109,7 @@ class CBrowserContext : public CNSContext
|
||||
LO_EmbedStruct* inEmbed,
|
||||
CL_Event* inEvent);
|
||||
|
||||
|
||||
// HISTORY
|
||||
virtual void RememberHistoryPosition(
|
||||
Int32 inX,
|
||||
@ -464,6 +467,9 @@ class CBrowserContext : public CNSContext
|
||||
|
||||
Boolean mInNoMoreUsers;
|
||||
|
||||
void (* mCloseCallback)(void *); // called on window close
|
||||
void* mCloseCallbackArg;
|
||||
|
||||
}; // class CBrowserContext
|
||||
|
||||
inline CBrowserContext::operator MWContext*()
|
||||
|
@ -404,6 +404,11 @@ MWContext* FE_MakeNewWindow(MWContext* old_context,
|
||||
/* jpm changes: get Shift_JIS & MacRoman 8bit to display correctly in security dialogs */
|
||||
if ((chrome != nil) && (theContext != nil))
|
||||
{
|
||||
// pinkerton - 98-05-27
|
||||
// save the close callback so that we can run it when the context goes away. Make sure
|
||||
// we are setting this on the _new_ context, not the old one.
|
||||
theBrowserContext->SetCloseCallback ( chrome->close_callback, chrome->close_arg );
|
||||
|
||||
if (chrome->type == MWContextDialog)
|
||||
{
|
||||
CNSContext* theNSContext = ExtractNSContext(theContext);
|
||||
@ -437,11 +442,18 @@ MWContext* FE_MakeNewWindow(MWContext* old_context,
|
||||
|
||||
void FE_UpdateChrome(MWContext *inContext, Chrome *inChrome)
|
||||
{
|
||||
CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(ExtractBrowserContext(inContext));
|
||||
CBrowserContext* brContext = ExtractBrowserContext(inContext);
|
||||
CBrowserWindow* theWindow = CBrowserWindow::WindowForContext(brContext);
|
||||
|
||||
if (theWindow != nil)
|
||||
{
|
||||
theWindow->SetChromeInfo(inChrome);
|
||||
|
||||
if ( inChrome ) {
|
||||
// 98-05-27 pinkerton
|
||||
// Set the callback info so we do the right thing when the window goes away
|
||||
brContext->SetCloseCallback ( inChrome->close_callback, inChrome->close_arg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user