/work/obj-fuzz/dist/include/mozilla/dom/URLClassifierParent.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_dom_URLClassifierParent_h |
8 | | #define mozilla_dom_URLClassifierParent_h |
9 | | |
10 | | #include "mozilla/dom/PURLClassifierParent.h" |
11 | | #include "mozilla/dom/PURLClassifierLocalParent.h" |
12 | | #include "nsIURIClassifier.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace dom { |
16 | | |
17 | | template<typename BaseProtocol> |
18 | | class URLClassifierParentBase : public nsIURIClassifierCallback, |
19 | | public BaseProtocol |
20 | | { |
21 | | public: |
22 | | // nsIURIClassifierCallback. |
23 | | NS_IMETHOD OnClassifyComplete(nsresult aErrorCode, |
24 | | const nsACString& aList, |
25 | | const nsACString& aProvider, |
26 | | const nsACString& aFullHash) override |
27 | 0 | { |
28 | 0 | if (mIPCOpen) { |
29 | 0 | ClassifierInfo info = ClassifierInfo(nsCString(aList), |
30 | 0 | nsCString(aProvider), |
31 | 0 | nsCString(aFullHash)); |
32 | 0 | Unused << BaseProtocol::Send__delete__(this, info, aErrorCode); |
33 | 0 | } |
34 | 0 | return NS_OK; |
35 | 0 | } Unexecuted instantiation: mozilla::dom::URLClassifierParentBase<mozilla::dom::PURLClassifierParent>::OnClassifyComplete(nsresult, nsTSubstring<char> const&, nsTSubstring<char> const&, nsTSubstring<char> const&) Unexecuted instantiation: mozilla::dom::URLClassifierParentBase<mozilla::dom::PURLClassifierLocalParent>::OnClassifyComplete(nsresult, nsTSubstring<char> const&, nsTSubstring<char> const&, nsTSubstring<char> const&) |
36 | | |
37 | | // Custom. |
38 | | void ClassificationFailed() |
39 | 0 | { |
40 | 0 | if (mIPCOpen) { |
41 | 0 | Unused << BaseProtocol::Send__delete__(this, void_t(), NS_ERROR_FAILURE); |
42 | 0 | } |
43 | 0 | } |
44 | | |
45 | | protected: |
46 | 0 | ~URLClassifierParentBase() = default; Unexecuted instantiation: mozilla::dom::URLClassifierParentBase<mozilla::dom::PURLClassifierParent>::~URLClassifierParentBase() Unexecuted instantiation: mozilla::dom::URLClassifierParentBase<mozilla::dom::PURLClassifierLocalParent>::~URLClassifierParentBase() |
47 | | bool mIPCOpen = true; |
48 | | }; |
49 | | |
50 | | ////////////////////////////////////////////////////////////// |
51 | | // URLClassifierParent |
52 | | |
53 | | class URLClassifierParent : public URLClassifierParentBase<PURLClassifierParent> |
54 | | { |
55 | | public: |
56 | | NS_DECL_THREADSAFE_ISUPPORTS |
57 | | |
58 | | mozilla::ipc::IPCResult StartClassify(nsIPrincipal* aPrincipal, |
59 | | bool aUseTrackingProtection, |
60 | | bool* aSuccess); |
61 | | private: |
62 | | ~URLClassifierParent() = default; |
63 | | |
64 | | // Override PURLClassifierParent::ActorDestroy. We seem to unable to |
65 | | // override from the base template class. |
66 | | void ActorDestroy(ActorDestroyReason aWhy) override; |
67 | | }; |
68 | | |
69 | | ////////////////////////////////////////////////////////////// |
70 | | // URLClassifierLocalParent |
71 | | |
72 | | class URLClassifierLocalParent : public URLClassifierParentBase<PURLClassifierLocalParent> |
73 | | { |
74 | | public: |
75 | | NS_DECL_THREADSAFE_ISUPPORTS |
76 | | |
77 | | mozilla::ipc::IPCResult StartClassify(nsIURI* aURI, const nsACString& aTables); |
78 | | |
79 | | private: |
80 | | ~URLClassifierLocalParent() = default; |
81 | | |
82 | | // Override PURLClassifierParent::ActorDestroy. |
83 | | void ActorDestroy(ActorDestroyReason aWhy) override; |
84 | | }; |
85 | | |
86 | | } // namespace dom |
87 | | } // namespace mozilla |
88 | | |
89 | | #endif // mozilla_dom_URLClassifierParent_h |