LCOV - app.info - xpfe/appshell/src/nsChromeTreeOwner.cpp

LCOV - code coverage report
| Current view: | directory - xpfe/appshell/src - nsChromeTreeOwner.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 240 | 13 | 5.4 %
| Date: | 2012-07-07 | Functions: | 48 | 4 | 8.3 %

           1                 : /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
           2                 :  *
           3                 :  * ***** BEGIN LICENSE BLOCK *****
           4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           5                 :  *
           6                 :  * The contents of this file are subject to the Mozilla Public License Version
           7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           8                 :  * the License. You may obtain a copy of the License at
           9                 :  * http://www.mozilla.org/MPL/
          10                 :  *
          11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          13                 :  * for the specific language governing rights and limitations under the
          14                 :  * License.
          15                 :  *
          16                 :  * The Original Code is the Mozilla browser.
          17                 :  *
          18                 :  * The Initial Developer of the Original Code is
          19                 :  * Netscape Communications, Inc.
          20                 :  * Portions created by the Initial Developer are Copyright (C) 1999
          21                 :  * the Initial Developer. All Rights Reserved.
          22                 :  *
          23                 :  * Contributor(s):
          24                 :  *   Travis Bogard <travis@netscape.com>
          25                 :  *
          26                 :  * Alternatively, the contents of this file may be used under the terms of
          27                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          28                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          30                 :  * of those above. If you wish to allow use of your version of this file only
          31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          32                 :  * use your version of this file under the terms of the MPL, indicate your
          33                 :  * decision by deleting the provisions above and replace them with the notice
          34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          35                 :  * the provisions above, a recipient may use your version of this file under
          36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          37                 :  *
          38                 :  * ***** END LICENSE BLOCK ***** */
          39                 :
          40                 : // Local Includes
          41                 : #include "nsChromeTreeOwner.h"
          42                 : #include "nsXULWindow.h"
          43                 :
          44                 : // Helper Classes
          45                 : #include "nsString.h"
          46                 : #include "nsIEmbeddingSiteWindow.h"
          47                 : #include "nsIEmbeddingSiteWindow2.h"
          48                 : #include "nsIServiceManager.h"
          49                 : #include "nsIDocShellTreeItem.h"
          50                 :
          51                 : // Interfaces needed to include
          52                 : #include "nsIPrompt.h"
          53                 : #include "nsIAuthPrompt.h"
          54                 : #include "nsIWebProgress.h"
          55                 : #include "nsIWindowMediator.h"
          56                 : #include "nsIDOMNode.h"
          57                 : #include "nsIDOMElement.h"
          58                 : #include "nsIDOMNodeList.h"
          59                 : #include "nsIDOMXULElement.h"
          60                 : #include "nsIXULBrowserWindow.h"
          61                 :
          62                 : // CIDs
          63                 : static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
          64                 :
          65                 : //*****************************************************************************
          66                 : // nsChromeTreeOwner string literals
          67                 : //*****************************************************************************
          68                 :
          69                 : struct nsChromeTreeOwnerLiterals
          70             161 : {
          71                 :   const nsLiteralString kPersist;
          72                 :   const nsLiteralString kScreenX;
          73                 :   const nsLiteralString kScreenY;
          74                 :   const nsLiteralString kWidth;
          75                 :   const nsLiteralString kHeight;
          76                 :   const nsLiteralString kSizemode;
          77                 :   const nsLiteralString kSpace;
          78                 :
          79             161 :   nsChromeTreeOwnerLiterals()
          80                 :     : NS_LITERAL_STRING_INIT(kPersist,"persist")
          81                 :     , NS_LITERAL_STRING_INIT(kScreenX,"screenX")
          82                 :     , NS_LITERAL_STRING_INIT(kScreenY,"screenY")
          83                 :     , NS_LITERAL_STRING_INIT(kWidth,"width")
          84                 :     , NS_LITERAL_STRING_INIT(kHeight,"height")
          85                 :     , NS_LITERAL_STRING_INIT(kSizemode,"sizemode")
          86             161 :     , NS_LITERAL_STRING_INIT(kSpace," ")
          87             161 :   {}
          88                 : };
          89                 :
          90                 : static nsChromeTreeOwnerLiterals *gLiterals;
          91                 :
          92                 : nsresult
          93             161 : nsChromeTreeOwner::InitGlobals()
          94                 : {
          95             161 :   NS_ASSERTION(gLiterals == nsnull, "already initialized");
          96             161 :   gLiterals = new nsChromeTreeOwnerLiterals();
          97             161 :   if (!gLiterals)
          98               0 :     return NS_ERROR_OUT_OF_MEMORY;
          99             161 :   return NS_OK;
         100                 : }
         101                 :
         102                 : void
         103             161 : nsChromeTreeOwner::FreeGlobals()
         104                 : {
         105             161 :   delete gLiterals;
         106             161 :   gLiterals = nsnull;
         107             161 : }
         108                 :
         109                 : //*****************************************************************************
         110                 : //***    nsChromeTreeOwner: Object Management
         111                 : //*****************************************************************************
         112                 :
         113               0 : nsChromeTreeOwner::nsChromeTreeOwner() : mXULWindow(nsnull)
         114                 : {
         115               0 : }
         116                 :
         117               0 : nsChromeTreeOwner::~nsChromeTreeOwner()
         118                 : {
         119               0 : }
         120                 :
         121                 : //*****************************************************************************
         122                 : // nsChromeTreeOwner::nsISupports
         123                 : //*****************************************************************************
         124                 :
         125               0 : NS_IMPL_ADDREF(nsChromeTreeOwner)
         126               0 : NS_IMPL_RELEASE(nsChromeTreeOwner)
         127                 :
         128               0 : NS_INTERFACE_MAP_BEGIN(nsChromeTreeOwner)
         129               0 :    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellTreeOwner)
         130               0 :    NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
         131               0 :    NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
         132               0 :    NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
         133               0 :    NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
         134               0 :    NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
         135               0 : NS_INTERFACE_MAP_END
         136                 :
         137                 : //*****************************************************************************
         138                 : // nsChromeTreeOwner::nsIInterfaceRequestor
         139                 : //*****************************************************************************
         140                 :
         141               0 : NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
         142                 : {
         143               0 :   NS_ENSURE_ARG_POINTER(aSink);
         144                 :
         145               0 :   if(aIID.Equals(NS_GET_IID(nsIPrompt))) {
         146               0 :     NS_ENSURE_STATE(mXULWindow);
         147               0 :     return mXULWindow->GetInterface(aIID, aSink);
         148                 :   }
         149               0 :   if(aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
         150               0 :     NS_ENSURE_STATE(mXULWindow);
         151               0 :     return mXULWindow->GetInterface(aIID, aSink);
         152                 :   }
         153               0 :   if(aIID.Equals(NS_GET_IID(nsIWebBrowserChrome))) {
         154               0 :     NS_ENSURE_STATE(mXULWindow);
         155               0 :     return mXULWindow->GetInterface(aIID, aSink);
         156                 :   }
         157               0 :   if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow))) {
         158               0 :     NS_ENSURE_STATE(mXULWindow);
         159               0 :     return mXULWindow->GetInterface(aIID, aSink);
         160                 :   }
         161               0 :   if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow2))) {
         162               0 :     NS_ENSURE_STATE(mXULWindow);
         163               0 :     return mXULWindow->GetInterface(aIID, aSink);
         164                 :   }
         165               0 :   if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
         166               0 :     NS_ENSURE_STATE(mXULWindow);
         167               0 :     return mXULWindow->QueryInterface(aIID, aSink);
         168                 :   }
         169                 :
         170               0 :   return QueryInterface(aIID, aSink);
         171                 : }
         172                 :
         173                 : //*****************************************************************************
         174                 : // nsChromeTreeOwner::nsIDocShellTreeOwner
         175                 : //*****************************************************************************
         176                 :
         177               0 : NS_IMETHODIMP nsChromeTreeOwner::FindItemWithName(const PRUnichar* aName,
         178                 :    nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor,
         179                 :    nsIDocShellTreeItem** aFoundItem)
         180                 : {
         181               0 :    NS_ENSURE_ARG_POINTER(aFoundItem);
         182                 :
         183               0 :    *aFoundItem = nsnull;
         184                 :
         185               0 :    bool fIs_Content = false;
         186                 :
         187                 :    /* Special Cases */
         188               0 :    if(!aName || !*aName)
         189               0 :       return NS_OK;
         190                 :
         191               0 :    nsDependentString name(aName);
         192                 :
         193               0 :    if(name.LowerCaseEqualsLiteral("_blank"))
         194               0 :       return NS_OK;
         195                 :    // _main is an IE target which should be case-insensitive but isn't
         196                 :    // see bug 217886 for details
         197               0 :    if(name.LowerCaseEqualsLiteral("_content") || name.EqualsLiteral("_main"))
         198                 :       {
         199               0 :       NS_ENSURE_STATE(mXULWindow);
         200               0 :       fIs_Content = true;
         201               0 :       mXULWindow->GetPrimaryContentShell(aFoundItem);
         202               0 :       if(*aFoundItem)
         203               0 :          return NS_OK;
         204                 :       // Otherwise fall through and ask the other windows for a content area.
         205                 :       }
         206                 :
         207               0 :    nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(kWindowMediatorCID));
         208               0 :    NS_ENSURE_TRUE(windowMediator, NS_ERROR_FAILURE);
         209                 :
         210               0 :    nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
         211               0 :    NS_ENSURE_SUCCESS(windowMediator->GetXULWindowEnumerator(nsnull,
         212                 :       getter_AddRefs(windowEnumerator)), NS_ERROR_FAILURE);
         213                 :
         214                 :    bool more;
         215                 :
         216               0 :    windowEnumerator->HasMoreElements(&more);
         217               0 :    while(more)
         218                 :       {
         219               0 :       nsCOMPtr<nsISupports> nextWindow = nsnull;
         220               0 :       windowEnumerator->GetNext(getter_AddRefs(nextWindow));
         221               0 :       nsCOMPtr<nsIXULWindow> xulWindow(do_QueryInterface(nextWindow));
         222               0 :       NS_ENSURE_TRUE(xulWindow, NS_ERROR_FAILURE);
         223                 :
         224               0 :       nsCOMPtr<nsIDocShellTreeItem> shellAsTreeItem;
         225                 :
         226               0 :       if(fIs_Content)
         227                 :          {
         228               0 :          xulWindow->GetPrimaryContentShell(aFoundItem);
         229                 :          }
         230                 :       else
         231                 :          {
         232                 :          // Note that we don't look for targetable content shells here...
         233                 :          // in fact, we aren't looking for content shells at all!
         234               0 :          nsCOMPtr<nsIDocShell> shell;
         235               0 :          xulWindow->GetDocShell(getter_AddRefs(shell));
         236               0 :          shellAsTreeItem = do_QueryInterface(shell);
         237               0 :          if (shellAsTreeItem) {
         238                 :            // Get the root tree item of same type, since roots are the only
         239                 :            // things that call into the treeowner to look for named items.
         240               0 :            nsCOMPtr<nsIDocShellTreeItem> root;
         241               0 :            shellAsTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
         242               0 :            shellAsTreeItem = root;
         243                 :          }
         244               0 :          if(shellAsTreeItem && aRequestor != shellAsTreeItem)
         245                 :             {
         246                 :             // Do this so we can pass in the tree owner as the requestor so the child knows not
         247                 :             // to call back up.
         248               0 :             nsCOMPtr<nsIDocShellTreeOwner> shellOwner;
         249               0 :             shellAsTreeItem->GetTreeOwner(getter_AddRefs(shellOwner));
         250               0 :             nsCOMPtr<nsISupports> shellOwnerSupports(do_QueryInterface(shellOwner));
         251                 :
         252               0 :             shellAsTreeItem->FindItemWithName(aName, shellOwnerSupports,
         253               0 :                                               aOriginalRequestor, aFoundItem);
         254                 :             }
         255                 :          }
         256               0 :       if(*aFoundItem)
         257               0 :          return NS_OK;
         258               0 :       windowEnumerator->HasMoreElements(&more);
         259                 :       }
         260               0 :    return NS_OK;
         261                 : }
         262                 :
         263                 : NS_IMETHODIMP
         264               0 : nsChromeTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
         265                 :                                      bool aPrimary, bool aTargetable,
         266                 :                                      const nsAString& aID)
         267                 : {
         268               0 :   NS_ENSURE_STATE(mXULWindow);
         269                 :   return mXULWindow->ContentShellAdded(aContentShell, aPrimary, aTargetable,
         270               0 :                                        aID);
         271                 : }
         272                 :
         273                 : NS_IMETHODIMP
         274               0 : nsChromeTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell)
         275                 : {
         276               0 :   NS_ENSURE_STATE(mXULWindow);
         277               0 :   return mXULWindow->ContentShellRemoved(aContentShell);
         278                 : }
         279                 :
         280               0 : NS_IMETHODIMP nsChromeTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
         281                 : {
         282               0 :    NS_ENSURE_STATE(mXULWindow);
         283               0 :    return mXULWindow->GetPrimaryContentShell(aShell);
         284                 : }
         285                 :
         286               0 : NS_IMETHODIMP nsChromeTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
         287                 :    PRInt32 aCX, PRInt32 aCY)
         288                 : {
         289               0 :    NS_ENSURE_STATE(mXULWindow);
         290               0 :    return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
         291                 : }
         292                 :
         293                 : NS_IMETHODIMP
         294               0 : nsChromeTreeOwner::SetPersistence(bool aPersistPosition,
         295                 :                                   bool aPersistSize,
         296                 :                                   bool aPersistSizeMode)
         297                 : {
         298               0 :   NS_ENSURE_STATE(mXULWindow);
         299               0 :   nsCOMPtr<nsIDOMElement> docShellElement;
         300               0 :   mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
         301               0 :   if (!docShellElement)
         302               0 :     return NS_ERROR_FAILURE;
         303                 :
         304               0 :   nsAutoString persistString;
         305               0 :   docShellElement->GetAttribute(gLiterals->kPersist, persistString);
         306                 :
         307               0 :   bool saveString = false;
         308                 :   PRInt32 index;
         309                 :
         310                 : #define FIND_PERSIST_STRING(aString, aCond)            \
         311                 :   index = persistString.Find(aString);                 \
         312                 :   if (!aCond && index > kNotFound) {                   \
         313                 :     persistString.Cut(index, aString.Length());        \
         314                 :     saveString = true;                              \
         315                 :   } else if (aCond && index == kNotFound) {            \
         316                 :     persistString.Append(gLiterals->kSpace + aString); \
         317                 :     saveString = true;                              \
         318                 :   }
         319               0 :   FIND_PERSIST_STRING(gLiterals->kScreenX,  aPersistPosition);
         320               0 :   FIND_PERSIST_STRING(gLiterals->kScreenY,  aPersistPosition);
         321               0 :   FIND_PERSIST_STRING(gLiterals->kWidth,    aPersistSize);
         322               0 :   FIND_PERSIST_STRING(gLiterals->kHeight,   aPersistSize);
         323               0 :   FIND_PERSIST_STRING(gLiterals->kSizemode, aPersistSizeMode);
         324                 :
         325               0 :   if (saveString)
         326               0 :     docShellElement->SetAttribute(gLiterals->kPersist, persistString);
         327                 :
         328               0 :   return NS_OK;
         329                 : }
         330                 :
         331                 : NS_IMETHODIMP
         332               0 : nsChromeTreeOwner::GetPersistence(bool* aPersistPosition,
         333                 :                                   bool* aPersistSize,
         334                 :                                   bool* aPersistSizeMode)
         335                 : {
         336               0 :   NS_ENSURE_STATE(mXULWindow);
         337               0 :   nsCOMPtr<nsIDOMElement> docShellElement;
         338               0 :   mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
         339               0 :   if (!docShellElement)
         340               0 :     return NS_ERROR_FAILURE;
         341                 :
         342               0 :   nsAutoString persistString;
         343               0 :   docShellElement->GetAttribute(gLiterals->kPersist, persistString);
         344                 :
         345                 :   // data structure doesn't quite match the question, but it's close enough
         346                 :   // for what we want (since this method is never actually called...)
         347               0 :   if (aPersistPosition)
         348               0 :     *aPersistPosition = persistString.Find(gLiterals->kScreenX) > kNotFound ||
         349               0 :                         persistString.Find(gLiterals->kScreenY) > kNotFound;
         350               0 :   if (aPersistSize)
         351               0 :     *aPersistSize = persistString.Find(gLiterals->kWidth) > kNotFound ||
         352               0 :                     persistString.Find(gLiterals->kHeight) > kNotFound;
         353               0 :   if (aPersistSizeMode)
         354               0 :     *aPersistSizeMode = persistString.Find(gLiterals->kSizemode) > kNotFound;
         355                 :
         356               0 :   return NS_OK;
         357                 : }
         358                 :
         359                 : NS_IMETHODIMP
         360               0 : nsChromeTreeOwner::GetTargetableShellCount(PRUint32* aResult)
         361                 : {
         362               0 :   *aResult = 0;
         363               0 :   return NS_OK;
         364                 : }
         365                 :
         366                 : //*****************************************************************************
         367                 : // nsChromeTreeOwner::nsIBaseWindow
         368                 : //*****************************************************************************
         369                 :
         370               0 : NS_IMETHODIMP nsChromeTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
         371                 :    nsIWidget* parentWidget, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
         372                 : {
         373                 :    // Ignore widget parents for now.  Don't think those are a vaild thing to call.
         374               0 :    NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, false), NS_ERROR_FAILURE);
         375                 :
         376               0 :    return NS_OK;
         377                 : }
         378                 :
         379               0 : NS_IMETHODIMP nsChromeTreeOwner::Create()
         380                 : {
         381               0 :    NS_ASSERTION(false, "You can't call this");
         382               0 :    return NS_ERROR_UNEXPECTED;
         383                 : }
         384                 :
         385               0 : NS_IMETHODIMP nsChromeTreeOwner::Destroy()
         386                 : {
         387               0 :    NS_ENSURE_STATE(mXULWindow);
         388               0 :    return mXULWindow->Destroy();
         389                 : }
         390                 :
         391               0 : NS_IMETHODIMP nsChromeTreeOwner::SetPosition(PRInt32 x, PRInt32 y)
         392                 : {
         393               0 :    NS_ENSURE_STATE(mXULWindow);
         394               0 :    return mXULWindow->SetPosition(x, y);
         395                 : }
         396                 :
         397               0 : NS_IMETHODIMP nsChromeTreeOwner::GetPosition(PRInt32* x, PRInt32* y)
         398                 : {
         399               0 :    NS_ENSURE_STATE(mXULWindow);
         400               0 :    return mXULWindow->GetPosition(x, y);
         401                 : }
         402                 :
         403               0 : NS_IMETHODIMP nsChromeTreeOwner::SetSize(PRInt32 cx, PRInt32 cy, bool fRepaint)
         404                 : {
         405               0 :    NS_ENSURE_STATE(mXULWindow);
         406               0 :    return mXULWindow->SetSize(cx, cy, fRepaint);
         407                 : }
         408                 :
         409               0 : NS_IMETHODIMP nsChromeTreeOwner::GetSize(PRInt32* cx, PRInt32* cy)
         410                 : {
         411               0 :    NS_ENSURE_STATE(mXULWindow);
         412               0 :    return mXULWindow->GetSize(cx, cy);
         413                 : }
         414                 :
         415               0 : NS_IMETHODIMP nsChromeTreeOwner::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
         416                 :    PRInt32 cy, bool fRepaint)
         417                 : {
         418               0 :    NS_ENSURE_STATE(mXULWindow);
         419               0 :    return mXULWindow->SetPositionAndSize(x, y, cx, cy, fRepaint);
         420                 : }
         421                 :
         422               0 : NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(PRInt32* x, PRInt32* y, PRInt32* cx,
         423                 :    PRInt32* cy)
         424                 : {
         425               0 :    NS_ENSURE_STATE(mXULWindow);
         426               0 :    return mXULWindow->GetPositionAndSize(x, y, cx, cy);
         427                 : }
         428                 :
         429               0 : NS_IMETHODIMP nsChromeTreeOwner::Repaint(bool aForce)
         430                 : {
         431               0 :    NS_ENSURE_STATE(mXULWindow);
         432               0 :    return mXULWindow->Repaint(aForce);
         433                 : }
         434                 :
         435               0 : NS_IMETHODIMP nsChromeTreeOwner::GetParentWidget(nsIWidget** aParentWidget)
         436                 : {
         437               0 :    NS_ENSURE_STATE(mXULWindow);
         438               0 :    return mXULWindow->GetParentWidget(aParentWidget);
         439                 : }
         440                 :
         441               0 : NS_IMETHODIMP nsChromeTreeOwner::SetParentWidget(nsIWidget* aParentWidget)
         442                 : {
         443               0 :    NS_ASSERTION(false, "You can't call this");
         444               0 :    return NS_ERROR_NOT_IMPLEMENTED;
         445                 : }
         446                 :
         447               0 : NS_IMETHODIMP nsChromeTreeOwner::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
         448                 : {
         449               0 :    NS_ENSURE_STATE(mXULWindow);
         450               0 :    return mXULWindow->GetParentNativeWindow(aParentNativeWindow);
         451                 : }
         452                 :
         453               0 : NS_IMETHODIMP nsChromeTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow)
         454                 : {
         455               0 :    NS_ASSERTION(false, "You can't call this");
         456               0 :    return NS_ERROR_NOT_IMPLEMENTED;
         457                 : }
         458                 :
         459               0 : NS_IMETHODIMP nsChromeTreeOwner::GetVisibility(bool* aVisibility)
         460                 : {
         461               0 :    NS_ENSURE_STATE(mXULWindow);
         462               0 :    return mXULWindow->GetVisibility(aVisibility);
         463                 : }
         464                 :
         465               0 : NS_IMETHODIMP nsChromeTreeOwner::SetVisibility(bool aVisibility)
         466                 : {
         467               0 :    NS_ENSURE_STATE(mXULWindow);
         468               0 :    return mXULWindow->SetVisibility(aVisibility);
         469                 : }
         470                 :
         471               0 : NS_IMETHODIMP nsChromeTreeOwner::GetEnabled(bool *aEnabled)
         472                 : {
         473               0 :    NS_ENSURE_STATE(mXULWindow);
         474               0 :    return mXULWindow->GetEnabled(aEnabled);
         475                 : }
         476                 :
         477               0 : NS_IMETHODIMP nsChromeTreeOwner::SetEnabled(bool aEnable)
         478                 : {
         479               0 :    NS_ENSURE_STATE(mXULWindow);
         480               0 :    return mXULWindow->SetEnabled(aEnable);
         481                 : }
         482                 :
         483               0 : NS_IMETHODIMP nsChromeTreeOwner::GetMainWidget(nsIWidget** aMainWidget)
         484                 : {
         485               0 :    NS_ENSURE_ARG_POINTER(aMainWidget);
         486               0 :    NS_ENSURE_STATE(mXULWindow);
         487                 :
         488               0 :    *aMainWidget = mXULWindow->mWindow;
         489               0 :    NS_IF_ADDREF(*aMainWidget);
         490                 :
         491               0 :    return NS_OK;
         492                 : }
         493                 :
         494               0 : NS_IMETHODIMP nsChromeTreeOwner::SetFocus()
         495                 : {
         496               0 :    NS_ENSURE_STATE(mXULWindow);
         497               0 :    return mXULWindow->SetFocus();
         498                 : }
         499                 :
         500               0 : NS_IMETHODIMP nsChromeTreeOwner::GetTitle(PRUnichar** aTitle)
         501                 : {
         502               0 :    NS_ENSURE_STATE(mXULWindow);
         503               0 :    return mXULWindow->GetTitle(aTitle);
         504                 : }
         505                 :
         506               0 : NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const PRUnichar* aTitle)
         507                 : {
         508               0 :    NS_ENSURE_STATE(mXULWindow);
         509               0 :    return mXULWindow->SetTitle(aTitle);
         510                 : }
         511                 :
         512                 : //*****************************************************************************
         513                 : // nsChromeTreeOwner::nsIWebProgressListener
         514                 : //*****************************************************************************
         515                 :
         516                 : NS_IMETHODIMP
         517               0 : nsChromeTreeOwner::OnProgressChange(nsIWebProgress* aWebProgress,
         518                 :                                     nsIRequest* aRequest,
         519                 :                                     PRInt32 aCurSelfProgress,
         520                 :                                     PRInt32 aMaxSelfProgress,
         521                 :                                     PRInt32 aCurTotalProgress,
         522                 :                                     PRInt32 aMaxTotalProgress)
         523                 : {
         524               0 :    return NS_OK;
         525                 : }
         526                 :
         527                 : NS_IMETHODIMP
         528               0 : nsChromeTreeOwner::OnStateChange(nsIWebProgress* aWebProgress,
         529                 :                                  nsIRequest* aRequest,
         530                 :                                  PRUint32 aProgressStateFlags,
         531                 :                                  nsresult aStatus)
         532                 : {
         533               0 :    return NS_OK;
         534                 : }
         535                 :
         536               0 : NS_IMETHODIMP nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
         537                 :                                                   nsIRequest* aRequest,
         538                 :                                                   nsIURI* aLocation,
         539                 :                                                   PRUint32 aFlags)
         540                 : {
         541               0 :   bool itsForYou = true;
         542                 :
         543               0 :   if (aWebProgress) {
         544               0 :     NS_ENSURE_STATE(mXULWindow);
         545               0 :     nsCOMPtr<nsIDOMWindow> progressWin;
         546               0 :     aWebProgress->GetDOMWindow(getter_AddRefs(progressWin));
         547                 :
         548               0 :     nsCOMPtr<nsIDocShell> docshell;
         549               0 :     mXULWindow->GetDocShell(getter_AddRefs(docshell));
         550               0 :     nsCOMPtr<nsIDOMWindow> ourWin(do_QueryInterface(docshell));
         551                 :
         552               0 :     if (ourWin != progressWin)
         553               0 :       itsForYou = false;
         554                 :   }
         555                 :
         556                 :    // If loading a new root .xul document, then redo chrome.
         557               0 :   if (itsForYou) {
         558               0 :     NS_ENSURE_STATE(mXULWindow);
         559               0 :     mXULWindow->mChromeLoaded = false;
         560                 :   }
         561               0 :   return NS_OK;
         562                 : }
         563                 :
         564                 : NS_IMETHODIMP
         565               0 : nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
         566                 :                                   nsIRequest* aRequest,
         567                 :                                   nsresult aStatus,
         568                 :                                   const PRUnichar* aMessage)
         569                 : {
         570               0 :     return NS_OK;
         571                 : }
         572                 :
         573                 :
         574                 :
         575                 : NS_IMETHODIMP
         576               0 : nsChromeTreeOwner::OnSecurityChange(nsIWebProgress *aWebProgress,
         577                 :                                     nsIRequest *aRequest,
         578                 :                                     PRUint32 state)
         579                 : {
         580               0 :     return NS_OK;
         581                 : }
         582                 :
         583                 : //*****************************************************************************
         584                 : // nsChromeTreeOwner: Helpers
         585                 : //*****************************************************************************
         586                 :
         587                 : //*****************************************************************************
         588                 : // nsChromeTreeOwner: Accessors
         589                 : //*****************************************************************************
         590                 :
         591               0 : void nsChromeTreeOwner::XULWindow(nsXULWindow* aXULWindow)
         592                 : {
         593               0 :    mXULWindow = aXULWindow;
         594               0 : }
         595                 :
         596               0 : nsXULWindow* nsChromeTreeOwner::XULWindow()
         597                 : {
         598               0 :    return mXULWindow;
         599                 : }

Generated by: LCOV version 1.7