michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsDOMWindowList_h___ michael@0: #define nsDOMWindowList_h___ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIDOMWindowCollection.h" michael@0: #include michael@0: #include "nsIDocShell.h" michael@0: michael@0: class nsIDocShell; michael@0: class nsIDOMWindow; michael@0: michael@0: class nsDOMWindowList : public nsIDOMWindowCollection michael@0: { michael@0: public: michael@0: nsDOMWindowList(nsIDocShell *aDocShell); michael@0: virtual ~nsDOMWindowList(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIDOMWINDOWCOLLECTION michael@0: michael@0: uint32_t GetLength(); michael@0: already_AddRefed IndexedGetter(uint32_t aIndex, bool& aFound); michael@0: michael@0: //local methods michael@0: NS_IMETHOD SetDocShell(nsIDocShell* aDocShell); michael@0: already_AddRefed GetDocShellTreeItemAt(uint32_t aIndex) michael@0: { michael@0: EnsureFresh(); michael@0: nsCOMPtr item; michael@0: if (mDocShellNode) { michael@0: mDocShellNode->GetChildAt(aIndex, getter_AddRefs(item)); michael@0: } michael@0: return item.forget(); michael@0: } michael@0: michael@0: protected: michael@0: // Note: this function may flush and cause mDocShellNode to become null. michael@0: void EnsureFresh(); michael@0: michael@0: nsIDocShell* mDocShellNode; //Weak Reference michael@0: }; michael@0: michael@0: #endif // nsDOMWindowList_h___