Skip to content

Commit 6c87b58

Browse files
committed
Add an OnDestoryWindow callback method to the MozEmbed project. This allows our OpenID window to auto-close. Note: We will need to release this source code to our MozEmbed fork on Github.
1 parent d7486d7 commit 6c87b58

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Gecko/WebBrowserChrome.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,18 @@ NS_IMETHODIMP WebBrowserChrome::SetChromeFlags(PRUint32 aChromeFlags)
121121
NS_IMETHODIMP WebBrowserChrome::DestroyBrowserWindow()
122122
{
123123
if (mIsModal)
124+
{
124125
ExitModalEventLoop(NS_OK);
126+
}
127+
else
128+
{
129+
MozViewListener * pListener = pMozView->GetListener();
130+
if (!pListener)
131+
return NS_ERROR_NOT_IMPLEMENTED;
132+
133+
return pListener->OnDestroyWindow();
134+
}
135+
125136
return NS_ERROR_NOT_IMPLEMENTED;
126137
}
127138

Gecko/embed.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,3 +623,8 @@ void MozViewListener::OnConsoleMessage(const char * /*aMessage*/)
623623
void MozViewListener::OnFocusChanged(PRBool /*aForward*/)
624624
{
625625
}
626+
627+
nsresult MozViewListener::OnDestroyWindow()
628+
{
629+
return NS_OK;
630+
}

Gecko/embed.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,11 @@ class MozViewListener
504504
* previous sibling is to be focused (Shift-Tab)
505505
*/
506506
virtual void OnFocusChanged(PRBool aForward);
507+
508+
/**
509+
* Inform the application about a Close Window request
510+
*/
511+
virtual nsresult OnDestroyWindow();
507512

508513
protected:
509514
MozView* mMozView;

0 commit comments

Comments
 (0)