Fix bug #82705. Add mechanism to emit signal for windows without parents. r=pavlov,sr=tor,a=chofmann (Round 2)

This commit is contained in:
blizzard@redhat.com
2001-05-29 22:35:46 +00:00
parent 3f6d0d80f9
commit 090c9baffc
7 changed files with 216 additions and 19 deletions

View File

@@ -23,6 +23,9 @@
#include "EmbedPrivate.h"
#include "EmbedWindow.h"
// in order to create orphaned windows
#include "gtkmozembedprivate.h"
EmbedWindowCreator::EmbedWindowCreator(void)
{
NS_INIT_REFCNT();
@@ -43,16 +46,25 @@ EmbedWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent,
GtkMozEmbed *newEmbed = nsnull;
// Find the EmbedPrivate object for this web browser chrome object.
EmbedPrivate *embedPrivate = EmbedPrivate::FindPrivateForBrowser(aParent);
if (!embedPrivate)
return NS_ERROR_FAILURE;
gtk_signal_emit(GTK_OBJECT(embedPrivate->mOwningWidget),
moz_embed_signals[NEW_WINDOW],
&newEmbed, (guint)aChromeFlags);
// No parent? Ask via the singleton object instead.
if (!aParent) {
gtk_moz_embed_single_create_window(&newEmbed,
(guint)aChromeFlags);
}
else {
// Find the EmbedPrivate object for this web browser chrome object.
EmbedPrivate *embedPrivate = EmbedPrivate::FindPrivateForBrowser(aParent);
if (!embedPrivate)
return NS_ERROR_FAILURE;
gtk_signal_emit(GTK_OBJECT(embedPrivate->mOwningWidget),
moz_embed_signals[NEW_WINDOW],
&newEmbed, (guint)aChromeFlags);
}
// check to make sure that we made a new window
if (!newEmbed)
return NS_ERROR_FAILURE;
@@ -64,6 +76,11 @@ EmbedWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent,
EmbedPrivate *newEmbedPrivate = NS_STATIC_CAST(EmbedPrivate *,
newEmbed->data);
// set the chrome flag on the new window if it's a chrome open
if (aChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)
newEmbedPrivate->mIsChrome = PR_TRUE;
*_retval = NS_STATIC_CAST(nsIWebBrowserChrome *,
(newEmbedPrivate->mWindow));