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 mozilla_dom_XULPersist_h
8
#define mozilla_dom_XULPersist_h
9
10
#ifndef MOZ_NEW_XULSTORE
11
class nsIXULStore;
12
#endif
13
14
namespace mozilla {
15
namespace dom {
16
17
class XULPersist final : public nsStubDocumentObserver {
18
public:
19
NS_DECL_ISUPPORTS
20
21
explicit XULPersist(Document* aDocument);
22
void Init();
23
void DropDocumentReference();
24
25
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
26
27
protected:
28
void Persist(mozilla::dom::Element* aElement, int32_t aNameSpaceID,
29
nsAtom* aAttribute);
30
31
private:
32
~XULPersist();
33
nsresult ApplyPersistentAttributes();
34
nsresult ApplyPersistentAttributesInternal();
35
nsresult ApplyPersistentAttributesToElements(const nsAString& aID,
36
nsCOMArray<Element>& aElements);
37
38
#ifndef MOZ_NEW_XULSTORE
39
nsCOMPtr<nsIXULStore> mLocalStore;
40
#endif
41
42
// A weak pointer to our document. Nulled out by DropDocumentReference.
43
Document* MOZ_NON_OWNING_REF mDocument;
44
};
45
46
} // namespace dom
47
} // namespace mozilla
48
49
#endif // mozilla_dom_XULPersist_h