Back to index

lightning-sunbird  0.9+nobinonly
nsChromeTreeOwner.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is the Mozilla browser.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications, Inc.
00020  * Portions created by the Initial Developer are Copyright (C) 1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Travis Bogard <travis@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 // Local Includes
00041 #include "nsChromeTreeOwner.h"
00042 #include "nsXULWindow.h"
00043 
00044 // Helper Classes
00045 #include "nsString.h"
00046 #include "nsIEmbeddingSiteWindow.h"
00047 #include "nsIEmbeddingSiteWindow2.h"
00048 #include "nsIGenericFactory.h"
00049 #include "nsIServiceManager.h"
00050 #include "nsIDocShellTreeItem.h"
00051 
00052 // Interfaces needed to include
00053 #include "nsIPrompt.h"
00054 #include "nsIAuthPrompt.h"
00055 #include "nsIWebProgress.h"
00056 #include "nsIWindowMediator.h"
00057 #include "nsIDOMNode.h"
00058 #include "nsIDOMElement.h"
00059 #include "nsIDOMNodeList.h"
00060 #include "nsIDOMWindowInternal.h"
00061 #include "nsIDOMXULElement.h"
00062 #include "nsIXULBrowserWindow.h"
00063 
00064 // CIDs
00065 static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
00066 
00067 //*****************************************************************************
00068 // nsChromeTreeOwner string literals
00069 //*****************************************************************************
00070 
00071 struct nsChromeTreeOwnerLiterals
00072 {
00073   const nsLiteralString kPersist;
00074   const nsLiteralString kScreenX;
00075   const nsLiteralString kScreenY;
00076   const nsLiteralString kWidth;
00077   const nsLiteralString kHeight;
00078   const nsLiteralString kSizemode;
00079   const nsLiteralString kSpace;
00080 
00081   nsChromeTreeOwnerLiterals()
00082     : NS_LITERAL_STRING_INIT(kPersist,"persist")
00083     , NS_LITERAL_STRING_INIT(kScreenX,"screenX")
00084     , NS_LITERAL_STRING_INIT(kScreenY,"screenY")
00085     , NS_LITERAL_STRING_INIT(kWidth,"width")
00086     , NS_LITERAL_STRING_INIT(kHeight,"height")
00087     , NS_LITERAL_STRING_INIT(kSizemode,"sizemode")
00088     , NS_LITERAL_STRING_INIT(kSpace," ")
00089   {}
00090 };
00091 
00092 static nsChromeTreeOwnerLiterals *gLiterals;
00093 
00094 nsresult
00095 nsChromeTreeOwner::InitGlobals()
00096 {
00097   NS_ASSERTION(gLiterals == nsnull, "already initialized");
00098   gLiterals = new nsChromeTreeOwnerLiterals();
00099   if (!gLiterals)
00100     return NS_ERROR_OUT_OF_MEMORY;
00101   return NS_OK;
00102 }
00103 
00104 void
00105 nsChromeTreeOwner::FreeGlobals()
00106 {
00107   delete gLiterals;
00108   gLiterals = nsnull;
00109 }
00110 
00111 //*****************************************************************************
00112 //***    nsChromeTreeOwner: Object Management
00113 //*****************************************************************************
00114 
00115 nsChromeTreeOwner::nsChromeTreeOwner() : mXULWindow(nsnull)
00116 {
00117 }
00118 
00119 nsChromeTreeOwner::~nsChromeTreeOwner()
00120 {
00121 }
00122 
00123 //*****************************************************************************
00124 // nsChromeTreeOwner::nsISupports
00125 //*****************************************************************************   
00126 
00127 NS_IMPL_ADDREF(nsChromeTreeOwner)
00128 NS_IMPL_RELEASE(nsChromeTreeOwner)
00129 
00130 NS_INTERFACE_MAP_BEGIN(nsChromeTreeOwner)
00131    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellTreeOwner)
00132    NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
00133    NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner_MOZILLA_1_8_BRANCH)
00134    NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
00135    NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
00136    NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
00137    NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
00138 NS_INTERFACE_MAP_END
00139 
00140 //*****************************************************************************
00141 // nsChromeTreeOwner::nsIInterfaceRequestor
00142 //*****************************************************************************   
00143 
00144 NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
00145 {
00146   NS_ENSURE_ARG_POINTER(aSink);
00147 
00148   if(aIID.Equals(NS_GET_IID(nsIPrompt)))
00149     return mXULWindow->GetInterface(aIID, aSink);
00150   if(aIID.Equals(NS_GET_IID(nsIAuthPrompt)))
00151     return mXULWindow->GetInterface(aIID, aSink);
00152   if(aIID.Equals(NS_GET_IID(nsIWebBrowserChrome)))
00153     return mXULWindow->GetInterface(aIID, aSink);
00154   if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow)))
00155     return mXULWindow->GetInterface(aIID, aSink);
00156   if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow2)))
00157     return mXULWindow->GetInterface(aIID, aSink);
00158   if (aIID.Equals(NS_GET_IID(nsIXULWindow)))
00159     return mXULWindow->QueryInterface(aIID, aSink);
00160 
00161   return QueryInterface(aIID, aSink);
00162 }
00163 
00164 //*****************************************************************************
00165 // nsChromeTreeOwner::nsIDocShellTreeOwner
00166 //*****************************************************************************   
00167 
00168 NS_IMETHODIMP nsChromeTreeOwner::FindItemWithName(const PRUnichar* aName,
00169    nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor,
00170    nsIDocShellTreeItem** aFoundItem)
00171 {
00172    NS_ENSURE_ARG_POINTER(aFoundItem);
00173 
00174    *aFoundItem = nsnull;
00175 
00176    PRBool fIs_Content = PR_FALSE;
00177 
00178    /* Special Cases */
00179    if(!aName || !*aName)
00180       return NS_OK;
00181 
00182    nsDependentString name(aName);
00183 
00184    if(name.LowerCaseEqualsLiteral("_blank"))
00185       return NS_OK;
00186    // _main is an IE target which should be case-insensitive but isn't
00187    // see bug 217886 for details
00188    if(name.LowerCaseEqualsLiteral("_content") || name.EqualsLiteral("_main"))
00189       {
00190       fIs_Content = PR_TRUE;
00191       mXULWindow->GetPrimaryContentShell(aFoundItem);
00192       if(*aFoundItem)
00193          return NS_OK;
00194       // Otherwise fall through and ask the other windows for a content area.
00195       }
00196 
00197    nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(kWindowMediatorCID));
00198    NS_ENSURE_TRUE(windowMediator, NS_ERROR_FAILURE);
00199 
00200    nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
00201    NS_ENSURE_SUCCESS(windowMediator->GetXULWindowEnumerator(nsnull, 
00202       getter_AddRefs(windowEnumerator)), NS_ERROR_FAILURE);
00203    
00204    PRBool more;
00205    
00206    windowEnumerator->HasMoreElements(&more);
00207    while(more)
00208       {
00209       nsCOMPtr<nsISupports> nextWindow = nsnull;
00210       windowEnumerator->GetNext(getter_AddRefs(nextWindow));
00211       nsCOMPtr<nsIXULWindow> xulWindow(do_QueryInterface(nextWindow));
00212       NS_ENSURE_TRUE(xulWindow, NS_ERROR_FAILURE);
00213 
00214       nsCOMPtr<nsIDocShellTreeItem> shellAsTreeItem;
00215      
00216       if(fIs_Content)
00217          {
00218          xulWindow->GetPrimaryContentShell(aFoundItem);
00219          }
00220       else
00221          {
00222          // Note that we don't look for targetable content shells here...
00223          // in fact, we aren't looking for content shells at all!
00224          nsCOMPtr<nsIDocShell> shell;
00225          xulWindow->GetDocShell(getter_AddRefs(shell));
00226          shellAsTreeItem = do_QueryInterface(shell);
00227          if (shellAsTreeItem) {
00228            // Get the root tree item of same type, since roots are the only
00229            // things that call into the treeowner to look for named items.
00230            nsCOMPtr<nsIDocShellTreeItem> root;
00231            shellAsTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
00232            shellAsTreeItem = root;
00233          }
00234          if(shellAsTreeItem && aRequestor != shellAsTreeItem)
00235             {
00236             // Do this so we can pass in the tree owner as the requestor so the child knows not
00237             // to call back up.
00238             nsCOMPtr<nsIDocShellTreeOwner> shellOwner;
00239             shellAsTreeItem->GetTreeOwner(getter_AddRefs(shellOwner));
00240             nsCOMPtr<nsISupports> shellOwnerSupports(do_QueryInterface(shellOwner));
00241 
00242             shellAsTreeItem->FindItemWithName(aName, shellOwnerSupports,
00243                                               aOriginalRequestor, aFoundItem);
00244             }
00245          }
00246       if(*aFoundItem)
00247          return NS_OK;   
00248       windowEnumerator->HasMoreElements(&more);
00249       }
00250    return NS_OK;      
00251 }
00252 
00253 NS_IMETHODIMP nsChromeTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
00254    PRBool aPrimary, const PRUnichar* aID)
00255 {
00256    NS_ENSURE_STATE(mXULWindow);
00257    if (aID) {
00258      return mXULWindow->ContentShellAdded(aContentShell, aPrimary, PR_FALSE,
00259                                           nsDependentString(aID));
00260    }
00261 
00262    return mXULWindow->ContentShellAdded(aContentShell, aPrimary, PR_FALSE,
00263                                         EmptyString());
00264 }
00265 
00266 NS_IMETHODIMP nsChromeTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
00267 {
00268    return mXULWindow->GetPrimaryContentShell(aShell);
00269 }
00270 
00271 NS_IMETHODIMP nsChromeTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
00272    PRInt32 aCX, PRInt32 aCY)
00273 {
00274    return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
00275 }
00276 
00277 NS_IMETHODIMP
00278 nsChromeTreeOwner::SetPersistence(PRBool aPersistPosition,
00279                                   PRBool aPersistSize,
00280                                   PRBool aPersistSizeMode)
00281 {
00282   nsCOMPtr<nsIDOMElement> docShellElement;
00283   mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
00284   if (!docShellElement)
00285     return NS_ERROR_FAILURE;
00286 
00287   nsAutoString persistString;
00288   docShellElement->GetAttribute(gLiterals->kPersist, persistString);
00289 
00290   PRBool saveString = PR_FALSE;
00291   PRInt32 index;
00292 
00293 #define FIND_PERSIST_STRING(aString, aCond)            \
00294   index = persistString.Find(aString);                 \
00295   if (!aCond && index > kNotFound) {                   \
00296     persistString.Cut(index, aString.Length());        \
00297     saveString = PR_TRUE;                              \
00298   } else if (aCond && index == kNotFound) {            \
00299     persistString.Append(gLiterals->kSpace + aString); \
00300     saveString = PR_TRUE;                              \
00301   }
00302   FIND_PERSIST_STRING(gLiterals->kScreenX,  aPersistPosition);
00303   FIND_PERSIST_STRING(gLiterals->kScreenY,  aPersistPosition);
00304   FIND_PERSIST_STRING(gLiterals->kWidth,    aPersistSize);
00305   FIND_PERSIST_STRING(gLiterals->kHeight,   aPersistSize);
00306   FIND_PERSIST_STRING(gLiterals->kSizemode, aPersistSizeMode);
00307 
00308   if (saveString) 
00309     docShellElement->SetAttribute(gLiterals->kPersist, persistString);
00310 
00311   return NS_OK;
00312 }
00313 
00314 NS_IMETHODIMP
00315 nsChromeTreeOwner::GetPersistence(PRBool* aPersistPosition,
00316                                   PRBool* aPersistSize,
00317                                   PRBool* aPersistSizeMode)
00318 {
00319   nsCOMPtr<nsIDOMElement> docShellElement;
00320   mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
00321   if (!docShellElement) 
00322     return NS_ERROR_FAILURE;
00323 
00324   nsAutoString persistString;
00325   docShellElement->GetAttribute(gLiterals->kPersist, persistString);
00326 
00327   // data structure doesn't quite match the question, but it's close enough
00328   // for what we want (since this method is never actually called...)
00329   if (aPersistPosition)
00330     *aPersistPosition = persistString.Find(gLiterals->kScreenX) > kNotFound ||
00331                         persistString.Find(gLiterals->kScreenY) > kNotFound;
00332   if (aPersistSize)
00333     *aPersistSize = persistString.Find(gLiterals->kWidth) > kNotFound ||
00334                     persistString.Find(gLiterals->kHeight) > kNotFound;
00335   if (aPersistSizeMode)
00336     *aPersistSizeMode = persistString.Find(gLiterals->kSizemode) > kNotFound;
00337 
00338   return NS_OK;
00339 }
00340 
00341 //*****************************************************************************
00342 // nsChromeTreeOwner::nsIBaseWindow
00343 //*****************************************************************************   
00344 
00345 NS_IMETHODIMP nsChromeTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
00346    nsIWidget* parentWidget, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)   
00347 {
00348    // Ignore wigdet parents for now.  Don't think those are a vaild thing to call.
00349    NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, PR_FALSE), NS_ERROR_FAILURE);
00350 
00351    return NS_OK;
00352 }
00353 
00354 NS_IMETHODIMP nsChromeTreeOwner::Create()
00355 {
00356    NS_ASSERTION(PR_FALSE, "You can't call this");
00357    return NS_ERROR_UNEXPECTED;
00358 }
00359 
00360 NS_IMETHODIMP nsChromeTreeOwner::Destroy()
00361 {
00362    return mXULWindow->Destroy();
00363 }
00364 
00365 NS_IMETHODIMP nsChromeTreeOwner::SetPosition(PRInt32 x, PRInt32 y)
00366 {
00367    return mXULWindow->SetPosition(x, y);
00368 }
00369 
00370 NS_IMETHODIMP nsChromeTreeOwner::GetPosition(PRInt32* x, PRInt32* y)
00371 {
00372    return mXULWindow->GetPosition(x, y);
00373 }
00374 
00375 NS_IMETHODIMP nsChromeTreeOwner::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
00376 {
00377    return mXULWindow->SetSize(cx, cy, fRepaint);
00378 }
00379 
00380 NS_IMETHODIMP nsChromeTreeOwner::GetSize(PRInt32* cx, PRInt32* cy)
00381 {
00382    return mXULWindow->GetSize(cx, cy);
00383 }
00384 
00385 NS_IMETHODIMP nsChromeTreeOwner::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
00386    PRInt32 cy, PRBool fRepaint)
00387 {
00388    return mXULWindow->SetPositionAndSize(x, y, cx, cy, fRepaint);
00389 }
00390 
00391 NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(PRInt32* x, PRInt32* y, PRInt32* cx,
00392    PRInt32* cy)
00393 {
00394    return mXULWindow->GetPositionAndSize(x, y, cx, cy);
00395 }
00396 
00397 NS_IMETHODIMP nsChromeTreeOwner::Repaint(PRBool aForce)
00398 {
00399    return mXULWindow->Repaint(aForce);
00400 }
00401 
00402 NS_IMETHODIMP nsChromeTreeOwner::GetParentWidget(nsIWidget** aParentWidget)
00403 {
00404    return mXULWindow->GetParentWidget(aParentWidget);
00405 }
00406 
00407 NS_IMETHODIMP nsChromeTreeOwner::SetParentWidget(nsIWidget* aParentWidget)
00408 {
00409    NS_ASSERTION(PR_FALSE, "You can't call this");
00410    return NS_ERROR_NOT_IMPLEMENTED;
00411 }
00412 
00413 NS_IMETHODIMP nsChromeTreeOwner::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
00414 {
00415    return mXULWindow->GetParentNativeWindow(aParentNativeWindow);
00416 }
00417 
00418 NS_IMETHODIMP nsChromeTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow)
00419 {
00420    NS_ASSERTION(PR_FALSE, "You can't call this");
00421    return NS_ERROR_NOT_IMPLEMENTED;
00422 }
00423 
00424 NS_IMETHODIMP nsChromeTreeOwner::GetVisibility(PRBool* aVisibility)
00425 {
00426    return mXULWindow->GetVisibility(aVisibility);
00427 }
00428 
00429 NS_IMETHODIMP nsChromeTreeOwner::SetVisibility(PRBool aVisibility)
00430 {
00431    return mXULWindow->SetVisibility(aVisibility);
00432 }
00433 
00434 NS_IMETHODIMP nsChromeTreeOwner::GetEnabled(PRBool *aEnabled)
00435 {
00436    return mXULWindow->GetEnabled(aEnabled);
00437 }
00438 
00439 NS_IMETHODIMP nsChromeTreeOwner::SetEnabled(PRBool aEnable)
00440 {
00441    return mXULWindow->SetEnabled(aEnable);
00442 }
00443 
00444 NS_IMETHODIMP nsChromeTreeOwner::GetBlurSuppression(PRBool *aBlurSuppression)
00445 {
00446   return mXULWindow->GetBlurSuppression(aBlurSuppression);
00447 }
00448 
00449 NS_IMETHODIMP nsChromeTreeOwner::SetBlurSuppression(PRBool aBlurSuppression)
00450 {
00451   return mXULWindow->SetBlurSuppression(aBlurSuppression);
00452 }
00453 
00454 NS_IMETHODIMP nsChromeTreeOwner::GetMainWidget(nsIWidget** aMainWidget)
00455 {
00456    NS_ENSURE_ARG_POINTER(aMainWidget);
00457 
00458    *aMainWidget = mXULWindow->mWindow;
00459    NS_IF_ADDREF(*aMainWidget);
00460 
00461    return NS_OK;
00462 }
00463 
00464 NS_IMETHODIMP nsChromeTreeOwner::SetFocus()
00465 {
00466    return mXULWindow->SetFocus();
00467 }
00468 
00469 NS_IMETHODIMP nsChromeTreeOwner::GetTitle(PRUnichar** aTitle)
00470 {
00471    return mXULWindow->GetTitle(aTitle);
00472 }
00473 
00474 NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const PRUnichar* aTitle)
00475 {
00476    return mXULWindow->SetTitle(aTitle);
00477 }
00478 
00479 //*****************************************************************************
00480 // nsChromeTreeOwner::nsIWebProgressListener
00481 //*****************************************************************************   
00482 
00483 NS_IMETHODIMP
00484 nsChromeTreeOwner::OnProgressChange(nsIWebProgress* aWebProgress,
00485                                     nsIRequest* aRequest,
00486                                     PRInt32 aCurSelfProgress,
00487                                     PRInt32 aMaxSelfProgress, 
00488                                     PRInt32 aCurTotalProgress,
00489                                     PRInt32 aMaxTotalProgress)
00490 {
00491    return NS_OK;
00492 }
00493 
00494 NS_IMETHODIMP
00495 nsChromeTreeOwner::OnStateChange(nsIWebProgress* aWebProgress,
00496                                  nsIRequest* aRequest,
00497                                  PRUint32 aProgressStateFlags,
00498                                  nsresult aStatus)
00499 {
00500    return NS_OK;
00501 }
00502 
00503 NS_IMETHODIMP nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
00504                                                   nsIRequest* aRequest,
00505                                                   nsIURI* aLocation)
00506 {
00507   PRBool itsForYou = PR_TRUE;
00508 
00509   if (aWebProgress) {
00510     nsCOMPtr<nsIDOMWindow> progressWin;
00511     aWebProgress->GetDOMWindow(getter_AddRefs(progressWin));
00512 
00513     nsCOMPtr<nsIDocShell> docshell;
00514     mXULWindow->GetDocShell(getter_AddRefs(docshell));
00515     nsCOMPtr<nsIDOMWindow> ourWin(do_QueryInterface(docshell));
00516 
00517     if (ourWin != progressWin)
00518       itsForYou = PR_FALSE;
00519   }
00520 
00521    // If loading a new root .xul document, then redo chrome.
00522   if (itsForYou)
00523     mXULWindow->mChromeLoaded = PR_FALSE;
00524   return NS_OK;
00525 }
00526 
00527 NS_IMETHODIMP 
00528 nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
00529                                   nsIRequest* aRequest,
00530                                   nsresult aStatus,
00531                                   const PRUnichar* aMessage)
00532 {
00533     return NS_OK;
00534 }
00535 
00536 
00537 
00538 NS_IMETHODIMP 
00539 nsChromeTreeOwner::OnSecurityChange(nsIWebProgress *aWebProgress, 
00540                                     nsIRequest *aRequest, 
00541                                     PRUint32 state)
00542 {
00543     return NS_OK;
00544 }
00545 
00546 //*****************************************************************************
00547 // nsChromeTreeOwner::nsIDocShellTreeOwner_MOZILLA_1_8_BRANCH
00548 //*****************************************************************************   
00549 NS_IMETHODIMP
00550 nsChromeTreeOwner::ContentShellAdded2(nsIDocShellTreeItem* aContentShell,
00551                                       PRBool aPrimary, PRBool aTargetable,
00552                                       const nsAString& aID)
00553 {
00554   NS_ENSURE_STATE(mXULWindow);
00555   return mXULWindow->ContentShellAdded(aContentShell, aPrimary, aTargetable,
00556                                        aID);
00557 }
00558 
00559 NS_IMETHODIMP
00560 nsChromeTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell)
00561 {
00562   NS_ENSURE_STATE(mXULWindow);
00563   return mXULWindow->ContentShellRemoved(aContentShell);
00564 }
00565 
00566 //*****************************************************************************
00567 // nsChromeTreeOwner: Helpers
00568 //*****************************************************************************   
00569 
00570 //*****************************************************************************
00571 // nsChromeTreeOwner: Accessors
00572 //*****************************************************************************   
00573 
00574 void nsChromeTreeOwner::XULWindow(nsXULWindow* aXULWindow)
00575 {
00576    mXULWindow = aXULWindow;
00577 }
00578 
00579 nsXULWindow* nsChromeTreeOwner::XULWindow()
00580 {
00581    return mXULWindow;
00582 }