dom/base/nsDOMWindowList.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:2f2c4e8f5354
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___
7
8 #include "nsCOMPtr.h"
9 #include "nsIDOMWindowCollection.h"
10 #include <stdint.h>
11 #include "nsIDocShell.h"
12
13 class nsIDocShell;
14 class nsIDOMWindow;
15
16 class nsDOMWindowList : public nsIDOMWindowCollection
17 {
18 public:
19 nsDOMWindowList(nsIDocShell *aDocShell);
20 virtual ~nsDOMWindowList();
21
22 NS_DECL_ISUPPORTS
23 NS_DECL_NSIDOMWINDOWCOLLECTION
24
25 uint32_t GetLength();
26 already_AddRefed<nsIDOMWindow> IndexedGetter(uint32_t aIndex, bool& aFound);
27
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 }
39
40 protected:
41 // Note: this function may flush and cause mDocShellNode to become null.
42 void EnsureFresh();
43
44 nsIDocShell* mDocShellNode; //Weak Reference
45 };
46
47 #endif // nsDOMWindowList_h___

mercurial