Removing IsModal,ShowModal,ExitModalLoop methods from nsIDocShellTreeOwner. General API cleanup. bug 70481 r=ccarlen,hyatt

This commit is contained in:
danm%netscape.com 2001-03-12 23:08:29 +00:00
parent 4c2e60e963
commit a8ddb2eb2f
9 changed files with 44 additions and 150 deletions

View File

@ -27,7 +27,6 @@
*/
interface nsIDocShellTreeItem;
interface nsIWebBrowserChrome;
[scriptable, uuid(80F30E10-A7CF-11d3-AFC5-00A024FFC08C)]
interface nsIDocShellTreeOwner : nsISupports
@ -66,23 +65,6 @@ interface nsIDocShellTreeOwner : nsISupports
*/
void sizeShellTo(in nsIDocShellTreeItem shell, in long cx, in long cy);
/*
Shows the window as a modal window.
*/
void showModal();
/**
Is the window modal (that is, currently executing a modal loop)?
@return true if it's a modal window
*/
boolean isModal();
/**
Exit a modal loop if we're in one
@param aStatus - the result code to return from showModal
*/
void exitModalLoop(in nsresult aStatus);
/*
Tells the implementer of this interface to create a new window. This is
a new logical window. Meaning in some implementations the result may not

View File

@ -481,28 +481,6 @@ CWebBrowserContainer::SizeShellTo(nsIDocShellTreeItem* aShell,
}
NS_IMETHODIMP
CWebBrowserContainer::ShowModal()
{
// Ignore request to be shown modally
return NS_OK;
}
NS_IMETHODIMP
CWebBrowserContainer::IsModal(PRBool *_retval)
{
// we're not
*_retval = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
CWebBrowserContainer::ExitModalLoop(nsresult aStatus)
{
// Ignore request to exit modal loop
return NS_OK;
}
NS_IMETHODIMP CWebBrowserContainer::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
{

View File

@ -497,7 +497,7 @@ NS_IMETHODIMP GtkMozEmbedChrome::IsWindowModal(PRBool *_retval)
NS_IMETHODIMP GtkMozEmbedChrome::ExitModalEventLoop(nsresult aStatus)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ExitModalLoop\n"));
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ExitModalEventLoop\n"));
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -697,25 +697,6 @@ NS_IMETHODIMP GtkMozEmbedChrome::SizeShellTo(nsIDocShellTreeItem *shell,
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::ShowModal(void)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ShowModal\n"));
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::IsModal(PRBool *_retval)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::IsModal\n"));
*_retval = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::ExitModalLoop(nsresult aStatus)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ExitModalLoop\n"));
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem **_retval)
{

View File

@ -447,7 +447,7 @@ NS_IMETHODIMP PhMozEmbedChrome::IsWindowModal(PRBool *_retval)
NS_IMETHODIMP PhMozEmbedChrome::ExitModalEventLoop(nsresult aStatus)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("PhMozEmbedChrome::ExitModalLoop\n"));
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("PhMozEmbedChrome::ExitModalEventLoop\n"));
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -608,25 +608,6 @@ NS_IMETHODIMP PhMozEmbedChrome::SizeShellTo(nsIDocShellTreeItem *shell,
return NS_OK;
}
NS_IMETHODIMP PhMozEmbedChrome::ShowModal(void)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("PhMozEmbedChrome::ShowModal\n"));
return NS_OK;
}
NS_IMETHODIMP PhMozEmbedChrome::IsModal(PRBool *_retval)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("PhMozEmbedChrome::IsModal\n"));
*_retval = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP PhMozEmbedChrome::ExitModalLoop(nsresult aStatus)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("PhMozEmbedChrome::ExitModalLoop\n"));
return NS_OK;
}
NS_IMETHODIMP PhMozEmbedChrome::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem **_retval)
{

View File

@ -369,30 +369,6 @@ NS_IMETHODIMP nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
return mWebBrowserChrome->SizeBrowserTo(browserCX, browserCY);
}
NS_IMETHODIMP nsDocShellTreeOwner::ShowModal()
{
if(mTreeOwner)
return mTreeOwner->ShowModal();
return mWebBrowserChrome->ShowAsModal();
}
NS_IMETHODIMP nsDocShellTreeOwner::IsModal(PRBool *_retval)
{
if(mTreeOwner)
return mTreeOwner->IsModal(_retval);
return mWebBrowserChrome->IsWindowModal(_retval);
}
NS_IMETHODIMP nsDocShellTreeOwner::ExitModalLoop(nsresult aStatus)
{
if(mTreeOwner)
return mTreeOwner->ExitModalLoop(aStatus);
return mWebBrowserChrome->ExitModalEventLoop(aStatus);
}
NS_IMETHODIMP nsDocShellTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
{

View File

@ -436,9 +436,18 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent,
// no extant window? make a new one.
if (!newDocShellItem) {
windowIsNew = PR_TRUE;
// is the parent (if any) modal? if so, we must be, too.
PRBool weAreModal = PR_FALSE;
if (parentTreeOwner)
parentTreeOwner->IsModal(&weAreModal);
if (parentTreeOwner) {
nsCOMPtr<nsIInterfaceRequestor> parentRequestor(do_QueryInterface(parentTreeOwner));
if (parentRequestor) {
nsCOMPtr<nsIWebBrowserChrome> parentChrome;
parentRequestor->GetInterface(NS_GET_IID(nsIWebBrowserChrome), getter_AddRefs(parentChrome));
if (parentChrome)
parentChrome->IsWindowModal(&weAreModal);
}
}
if (weAreModal || (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)) {
rv = queueGuard.Push();
if (NS_SUCCEEDED(rv)) {
@ -592,12 +601,21 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent,
if (windowIsNew)
SizeOpenedDocShellItem(newDocShellItem, aParent, features, chromeFlags);
if (windowIsModal) {
nsCOMPtr<nsIDocShellTreeOwner> newTreeOwner;
newDocShellItem->GetTreeOwner(getter_AddRefs(newTreeOwner));
nsCOMPtr<nsIInterfaceRequestor> newRequestor;
nsCOMPtr<nsIWebBrowserChrome> newChrome;
newDocShellItem->GetTreeOwner(getter_AddRefs(newTreeOwner));
if (newTreeOwner)
newTreeOwner->ShowModal();
newRequestor = do_QueryInterface(newTreeOwner);
if (newRequestor)
newRequestor->GetInterface(NS_GET_IID(nsIWebBrowserChrome), getter_AddRefs(newChrome));
if (newChrome)
newChrome->ShowAsModal();
NS_ASSERTION(newChrome, "show modal window failed: no available chrome");
}
return NS_OK;

View File

@ -333,7 +333,15 @@ nsPrefMigration::ProcessPrefs(PRBool showProgressAsModalWindow)
if (NS_FAILED(rv)) return rv;
if (showProgressAsModalWindow) {
mPMProgressWindow->ShowModal();
nsCOMPtr<nsIInterfaceRequestor> progressRequestor(do_QueryInterface(mPMProgressWindow));
nsCOMPtr<nsIWebBrowserChrome> progressChrome;
if (progressRequestor)
progressRequestor->GetInterface(NS_GET_IID(nsIWebBrowserChrome), getter_AddRefs(progressChrome));
if (progressChrome)
progressChrome->ShowAsModal();
NS_ASSERTION(progressChrome, "show modal window failed: no available chrome");
}
else {
// we are automatically migrating the profile, so there is no

View File

@ -72,15 +72,15 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
{
NS_ENSURE_ARG_POINTER(aSink);
NS_ENSURE_ARG_POINTER(aSink);
if(aIID.Equals(NS_GET_IID(nsIPrompt)))
return mXULWindow->GetInterface(aIID, aSink);
else
return QueryInterface(aIID, aSink);
if(aIID.Equals(NS_GET_IID(nsIPrompt)))
return mXULWindow->GetInterface(aIID, aSink);
NS_IF_ADDREF(((nsISupports*)*aSink));
return NS_OK;
if(aIID.Equals(NS_GET_IID(nsIWebBrowserChrome)))
return mXULWindow->GetInterface(aIID, aSink);
return QueryInterface(aIID, aSink);
}
//*****************************************************************************
@ -177,21 +177,6 @@ NS_IMETHODIMP nsChromeTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
{
return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
}
NS_IMETHODIMP nsChromeTreeOwner::ShowModal()
{
return mXULWindow->ShowModal();
}
NS_IMETHODIMP nsChromeTreeOwner::IsModal(PRBool *_retval)
{
*_retval = mXULWindow->mContinueModalLoop;
return NS_OK;
}
NS_IMETHODIMP nsChromeTreeOwner::ExitModalLoop(nsresult aStatus)
{
return mXULWindow->ExitModalLoop(aStatus);
}
NS_IMETHODIMP nsChromeTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)

View File

@ -206,22 +206,6 @@ NS_IMETHODIMP nsContentTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
}
NS_IMETHODIMP nsContentTreeOwner::ShowModal()
{
return mXULWindow->ShowModal();
}
NS_IMETHODIMP nsContentTreeOwner::IsModal(PRBool *_retval)
{
*_retval = mXULWindow->mContinueModalLoop;
return NS_OK;
}
NS_IMETHODIMP nsContentTreeOwner::ExitModalLoop(nsresult aStatus)
{
return mXULWindow->ExitModalLoop(aStatus);
}
NS_IMETHODIMP nsContentTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
{
@ -400,17 +384,18 @@ NS_IMETHODIMP nsContentTreeOwner::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
NS_IMETHODIMP nsContentTreeOwner::ShowAsModal()
{
return ShowModal();
return mXULWindow->ShowModal();
}
NS_IMETHODIMP nsContentTreeOwner::IsWindowModal(PRBool *_retval)
{
return IsModal(_retval);
*_retval = mXULWindow->mContinueModalLoop;
return NS_OK;
}
NS_IMETHODIMP nsContentTreeOwner::ExitModalEventLoop(nsresult aStatus)
{
return ExitModalLoop(aStatus);
return mXULWindow->ExitModalLoop(aStatus);
}
//*****************************************************************************