Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 4; 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
6
/*
7
8
This is the focus manager for XUL documents.
9
10
*/
11
12
#ifndef nsXULCommandDispatcher_h__
13
#define nsXULCommandDispatcher_h__
14
15
#include "nsCOMPtr.h"
16
#include "nsIDOMXULCommandDispatcher.h"
17
#include "nsWeakReference.h"
18
#include "nsString.h"
19
#include "nsCycleCollectionParticipant.h"
20
#include "mozilla/RefPtr.h"
21
22
class nsPIWindowRoot;
23
24
namespace mozilla {
25
namespace dom {
26
class Document;
27
class Element;
28
} // namespace dom
29
} // namespace mozilla
30
31
class nsXULCommandDispatcher : public nsIDOMXULCommandDispatcher,
32
public nsSupportsWeakReference {
33
public:
34
explicit nsXULCommandDispatcher(mozilla::dom::Document* aDocument);
35
36
// nsISupports
37
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
38
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULCommandDispatcher,
39
nsIDOMXULCommandDispatcher)
40
41
// nsIDOMXULCommandDispatcher interface
42
NS_DECL_NSIDOMXULCOMMANDDISPATCHER
43
44
void Disconnect();
45
46
protected:
47
virtual ~nsXULCommandDispatcher();
48
49
already_AddRefed<nsPIWindowRoot> GetWindowRoot();
50
51
mozilla::dom::Element* GetRootFocusedContentAndWindow(
52
nsPIDOMWindowOuter** aWindow);
53
54
RefPtr<mozilla::dom::Document> mDocument;
55
56
class Updater {
57
public:
58
Updater(mozilla::dom::Element* aElement, const nsAString& aEvents,
59
const nsAString& aTargets)
60
: mElement(aElement),
61
mEvents(aEvents),
62
mTargets(aTargets),
63
mNext(nullptr) {}
64
65
RefPtr<mozilla::dom::Element> mElement;
66
nsString mEvents;
67
nsString mTargets;
68
Updater* mNext;
69
};
70
71
Updater* mUpdaters;
72
73
bool Matches(const nsString& aList, const nsAString& aElement);
74
75
bool mLocked;
76
nsTArray<nsString> mPendingUpdates;
77
};
78
79
#endif // nsXULCommandDispatcher_h__