/work/obj-fuzz/dist/include/mozilla/extensions/DocumentObserver.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; 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 | | #ifndef mozilla_extensions_DocumentObserver_h |
7 | | #define mozilla_extensions_DocumentObserver_h |
8 | | |
9 | | #include "mozilla/dom/BindingDeclarations.h" |
10 | | #include "mozilla/dom/MozDocumentObserverBinding.h" |
11 | | |
12 | | #include "mozilla/extensions/WebExtensionContentScript.h" |
13 | | |
14 | | class nsILoadInfo; |
15 | | class nsPIDOMWindowOuter; |
16 | | |
17 | | namespace mozilla { |
18 | | namespace extensions { |
19 | | |
20 | | class DocumentObserver final : public nsISupports |
21 | | , public nsWrapperCache |
22 | | { |
23 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
24 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DocumentObserver) |
25 | | |
26 | | static already_AddRefed<DocumentObserver> |
27 | | Constructor(dom::GlobalObject& aGlobal, |
28 | | dom::MozDocumentCallback& aCallbacks, |
29 | | ErrorResult& aRv); |
30 | | |
31 | | void Observe(const dom::Sequence<OwningNonNull<MozDocumentMatcher>>& matchers, ErrorResult& aRv); |
32 | | |
33 | | void Disconnect(); |
34 | | |
35 | 0 | const nsTArray<RefPtr<MozDocumentMatcher>>& Matchers() const { return mMatchers; } |
36 | | |
37 | | void NotifyMatch(MozDocumentMatcher& aMatcher, nsPIDOMWindowOuter* aWindow); |
38 | | void NotifyMatch(MozDocumentMatcher& aMatcher, nsILoadInfo* aLoadInfo); |
39 | | |
40 | 0 | nsISupports* GetParentObject() const { return mParent; } |
41 | | JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
42 | | |
43 | | protected: |
44 | 0 | virtual ~DocumentObserver() = default; |
45 | | |
46 | | private: |
47 | | explicit DocumentObserver(nsISupports* aParent, dom::MozDocumentCallback& aCallbacks) |
48 | | : mParent(aParent) |
49 | | , mCallbacks(&aCallbacks) |
50 | 0 | {} |
51 | | |
52 | | nsCOMPtr<nsISupports> mParent; |
53 | | RefPtr<dom::MozDocumentCallback> mCallbacks; |
54 | | nsTArray<RefPtr<MozDocumentMatcher>> mMatchers; |
55 | | }; |
56 | | |
57 | | } // namespace extensions |
58 | | } // namespace mozilla |
59 | | |
60 | | #endif // mozilla_extensions_DocumentObserver_h |
61 | | |