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