Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/xul/nsXULCommandDispatcher.h
Line
Count
Source (jump to first uncovered line)
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 "nsString.h"
20
#include "nsCycleCollectionParticipant.h"
21
#include "mozilla/RefPtr.h"
22
23
class nsPIWindowRoot;
24
25
namespace mozilla {
26
namespace dom {
27
class Element;
28
} // namespace dom
29
} // namespace mozilla
30
31
class nsXULCommandDispatcher : public nsIDOMXULCommandDispatcher,
32
                               public nsSupportsWeakReference
33
{
34
public:
35
    explicit nsXULCommandDispatcher(nsIDocument* aDocument);
36
37
    // nsISupports
38
    NS_DECL_CYCLE_COLLECTING_ISUPPORTS
39
    NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULCommandDispatcher,
40
                                             nsIDOMXULCommandDispatcher)
41
42
    // nsIDOMXULCommandDispatcher interface
43
    NS_DECL_NSIDOMXULCOMMANDDISPATCHER
44
45
    void Disconnect();
46
protected:
47
    virtual ~nsXULCommandDispatcher();
48
49
    already_AddRefed<nsPIWindowRoot> GetWindowRoot();
50
51
    mozilla::dom::Element*
52
      GetRootFocusedContentAndWindow(nsPIDOMWindowOuter** aWindow);
53
54
    nsCOMPtr<nsIDocument> mDocument;
55
56
    class Updater {
57
    public:
58
      Updater(mozilla::dom::Element* aElement,
59
              const nsAString& aEvents,
60
              const nsAString& aTargets)
61
          : mElement(aElement),
62
            mEvents(aEvents),
63
            mTargets(aTargets),
64
            mNext(nullptr)
65
0
      {}
66
67
      RefPtr<mozilla::dom::Element> mElement;
68
      nsString                mEvents;
69
      nsString                mTargets;
70
      Updater*                mNext;
71
    };
72
73
    Updater* mUpdaters;
74
75
    bool Matches(const nsString& aList,
76
                   const nsAString& aElement);
77
78
    bool mLocked;
79
    nsTArray<nsString> mPendingUpdates;
80
};
81
82
#endif // nsXULCommandDispatcher_h__