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