dom/base/nsDOMWindowList.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/nsDOMWindowList.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +#ifndef nsDOMWindowList_h___
     1.9 +#define nsDOMWindowList_h___
    1.10 +
    1.11 +#include "nsCOMPtr.h"
    1.12 +#include "nsIDOMWindowCollection.h"
    1.13 +#include <stdint.h>
    1.14 +#include "nsIDocShell.h"
    1.15 +
    1.16 +class nsIDocShell;
    1.17 +class nsIDOMWindow;
    1.18 +
    1.19 +class nsDOMWindowList : public nsIDOMWindowCollection
    1.20 +{
    1.21 +public:
    1.22 +  nsDOMWindowList(nsIDocShell *aDocShell);
    1.23 +  virtual ~nsDOMWindowList();
    1.24 +
    1.25 +  NS_DECL_ISUPPORTS
    1.26 +  NS_DECL_NSIDOMWINDOWCOLLECTION
    1.27 +
    1.28 +  uint32_t GetLength();
    1.29 +  already_AddRefed<nsIDOMWindow> IndexedGetter(uint32_t aIndex, bool& aFound);
    1.30 +
    1.31 +  //local methods
    1.32 +  NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
    1.33 +  already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemAt(uint32_t aIndex)
    1.34 +  {
    1.35 +    EnsureFresh();
    1.36 +    nsCOMPtr<nsIDocShellTreeItem> item;
    1.37 +    if (mDocShellNode) {
    1.38 +      mDocShellNode->GetChildAt(aIndex, getter_AddRefs(item));
    1.39 +    }
    1.40 +    return item.forget();
    1.41 +  }
    1.42 +
    1.43 +protected:
    1.44 +  // Note: this function may flush and cause mDocShellNode to become null.
    1.45 +  void EnsureFresh();
    1.46 +
    1.47 +  nsIDocShell* mDocShellNode; //Weak Reference
    1.48 +};
    1.49 +
    1.50 +#endif // nsDOMWindowList_h___

mercurial