Line data Source code
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 : explicit nsXULCommandDispatcher(nsIDocument* aDocument);
31 :
32 : // nsISupports
33 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
34 72 : NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULCommandDispatcher,
35 : nsIDOMXULCommandDispatcher)
36 :
37 : // nsIDOMXULCommandDispatcher interface
38 : NS_DECL_NSIDOMXULCOMMANDDISPATCHER
39 :
40 : void Disconnect();
41 : protected:
42 : virtual ~nsXULCommandDispatcher();
43 :
44 : already_AddRefed<nsPIWindowRoot> GetWindowRoot();
45 :
46 : nsIContent* GetRootFocusedContentAndWindow(nsPIDOMWindowOuter** aWindow);
47 :
48 : nsCOMPtr<nsIDocument> mDocument;
49 :
50 0 : class Updater {
51 : public:
52 4 : Updater(nsIDOMElement* aElement,
53 : const nsAString& aEvents,
54 : const nsAString& aTargets)
55 4 : : mElement(aElement),
56 : mEvents(aEvents),
57 : mTargets(aTargets),
58 4 : mNext(nullptr)
59 4 : {}
60 :
61 : nsCOMPtr<nsIDOMElement> mElement;
62 : nsString mEvents;
63 : nsString mTargets;
64 : Updater* mNext;
65 : };
66 :
67 : Updater* mUpdaters;
68 :
69 : bool Matches(const nsString& aList,
70 : const nsAString& aElement);
71 :
72 : bool mLocked;
73 : nsTArray<nsString> mPendingUpdates;
74 : };
75 :
76 : #endif // nsXULCommandDispatcher_h__
|