|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 #ifndef nsContentBlocker_h__ |
|
5 #define nsContentBlocker_h__ |
|
6 |
|
7 #include "nsIContentPolicy.h" |
|
8 #include "nsIObserver.h" |
|
9 #include "nsWeakReference.h" |
|
10 #include "nsIPermissionManager.h" |
|
11 #include "nsIPrefBranch.h" |
|
12 #include "mozilla/Attributes.h" |
|
13 |
|
14 class nsIPrefBranch; |
|
15 |
|
16 //////////////////////////////////////////////////////////////////////////////// |
|
17 |
|
18 class nsContentBlocker MOZ_FINAL : public nsIContentPolicy, |
|
19 public nsIObserver, |
|
20 public nsSupportsWeakReference |
|
21 { |
|
22 public: |
|
23 |
|
24 // nsISupports |
|
25 NS_DECL_ISUPPORTS |
|
26 NS_DECL_NSICONTENTPOLICY |
|
27 NS_DECL_NSIOBSERVER |
|
28 |
|
29 nsContentBlocker(); |
|
30 nsresult Init(); |
|
31 |
|
32 private: |
|
33 ~nsContentBlocker() {} |
|
34 |
|
35 void PrefChanged(nsIPrefBranch *, const char *); |
|
36 nsresult TestPermission(nsIURI *aCurrentURI, |
|
37 nsIURI *aFirstURI, |
|
38 int32_t aContentType, |
|
39 bool *aPermission, |
|
40 bool *aFromPrefs); |
|
41 |
|
42 nsCOMPtr<nsIPermissionManager> mPermissionManager; |
|
43 nsCOMPtr<nsIPrefBranch> mPrefBranchInternal; |
|
44 static uint8_t mBehaviorPref[]; |
|
45 }; |
|
46 |
|
47 #define NS_CONTENTBLOCKER_CID \ |
|
48 { 0x4ca6b67b, 0x5cc7, 0x4e71, \ |
|
49 { 0xa9, 0x8a, 0x97, 0xaf, 0x1c, 0x13, 0x48, 0x62 } } |
|
50 |
|
51 #define NS_CONTENTBLOCKER_CONTRACTID "@mozilla.org/permissions/contentblocker;1" |
|
52 |
|
53 #endif /* nsContentBlocker_h__ */ |