Bug 565541 (1/2) - Add targetableShellCount to nsIDocShellTreeOwner. r=bz

Basically, this will return a the number of tabs when nsIDocShellTreeOwner is
a nsContentTreeOwner.

--HG--
extra : rebase_source : b998c4bd81fc95a099dbcd246f4a3df85acd861e
This commit is contained in:
Mounir Lamouri 2011-04-14 14:27:53 -07:00
parent b26e5d06c1
commit b9a14ba1c4
4 changed files with 33 additions and 1 deletions

View File

@ -45,7 +45,7 @@
interface nsIDocShellTreeItem;
[scriptable, uuid(bc0eb30e-656e-491e-a7ae-7f460b660c8d)]
[scriptable, uuid(932f9f93-8e21-4728-a527-cafc64b4d831)]
interface nsIDocShellTreeOwner : nsISupports
{
/*
@ -116,4 +116,9 @@ interface nsIDocShellTreeOwner : nsISupports
void getPersistence(out boolean aPersistPosition,
out boolean aPersistSize,
out boolean aPersistSizeMode);
/*
Gets the number of targettable docshells.
*/
readonly attribute unsigned long targetableShellCount;
};

View File

@ -467,6 +467,18 @@ nsDocShellTreeOwner::GetPersistence(PRBool* aPersistPosition,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocShellTreeOwner::GetTargetableShellCount(PRUint32* aResult)
{
if(mTreeOwner) {
mTreeOwner->GetTargetableShellCount(aResult);
} else {
*aResult = 0;
}
return NS_OK;
}
//*****************************************************************************
// nsDocShellTreeOwner::nsIBaseWindow
//*****************************************************************************

View File

@ -357,6 +357,13 @@ nsChromeTreeOwner::GetPersistence(PRBool* aPersistPosition,
return NS_OK;
}
NS_IMETHODIMP
nsChromeTreeOwner::GetTargetableShellCount(PRUint32* aResult)
{
*aResult = 0;
return NS_OK;
}
//*****************************************************************************
// nsChromeTreeOwner::nsIBaseWindow
//*****************************************************************************

View File

@ -434,6 +434,14 @@ nsContentTreeOwner::GetPersistence(PRBool* aPersistPosition,
return NS_OK;
}
NS_IMETHODIMP
nsContentTreeOwner::GetTargetableShellCount(PRUint32* aResult)
{
NS_ENSURE_STATE(mXULWindow);
*aResult = mXULWindow->mTargetableShells.Count();
return NS_OK;
}
//*****************************************************************************
// nsContentTreeOwner::nsIWebBrowserChrome3
//*****************************************************************************