Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef nsDocShellEnumerator_h___
8
#define nsDocShellEnumerator_h___
9
10
#include "nsTArray.h"
11
12
class nsDocShell;
13
class nsIDocShell;
14
15
class MOZ_STACK_CLASS nsDocShellEnumerator {
16
public:
17
enum class EnumerationDirection : uint8_t { Forwards, Backwards };
18
19
nsDocShellEnumerator(EnumerationDirection aDirection, int32_t aDocShellType,
20
nsDocShell& aRootItem);
21
22
public:
23
nsresult BuildDocShellArray(nsTArray<RefPtr<nsIDocShell>>& aItemArray);
24
25
private:
26
nsresult BuildArrayRecursiveForwards(
27
nsDocShell* aItem, nsTArray<RefPtr<nsIDocShell>>& aItemArray);
28
nsresult BuildArrayRecursiveBackwards(
29
nsDocShell* aItem, nsTArray<RefPtr<nsIDocShell>>& aItemArray);
30
31
private:
32
const RefPtr<nsDocShell> mRootItem;
33
34
const int32_t mDocShellType; // only want shells of this type
35
36
const EnumerationDirection mDirection;
37
};
38
39
#endif // nsDocShellEnumerator_h___