dom/base/nsDOMWindowList.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef nsDOMWindowList_h___
     6 #define nsDOMWindowList_h___
     8 #include "nsCOMPtr.h"
     9 #include "nsIDOMWindowCollection.h"
    10 #include <stdint.h>
    11 #include "nsIDocShell.h"
    13 class nsIDocShell;
    14 class nsIDOMWindow;
    16 class nsDOMWindowList : public nsIDOMWindowCollection
    17 {
    18 public:
    19   nsDOMWindowList(nsIDocShell *aDocShell);
    20   virtual ~nsDOMWindowList();
    22   NS_DECL_ISUPPORTS
    23   NS_DECL_NSIDOMWINDOWCOLLECTION
    25   uint32_t GetLength();
    26   already_AddRefed<nsIDOMWindow> IndexedGetter(uint32_t aIndex, bool& aFound);
    28   //local methods
    29   NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
    30   already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemAt(uint32_t aIndex)
    31   {
    32     EnsureFresh();
    33     nsCOMPtr<nsIDocShellTreeItem> item;
    34     if (mDocShellNode) {
    35       mDocShellNode->GetChildAt(aIndex, getter_AddRefs(item));
    36     }
    37     return item.forget();
    38   }
    40 protected:
    41   // Note: this function may flush and cause mDocShellNode to become null.
    42   void EnsureFresh();
    44   nsIDocShell* mDocShellNode; //Weak Reference
    45 };
    47 #endif // nsDOMWindowList_h___

mercurial