Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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__
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"
14 class nsIPrefBranch;
16 ////////////////////////////////////////////////////////////////////////////////
18 class nsContentBlocker MOZ_FINAL : public nsIContentPolicy,
19 public nsIObserver,
20 public nsSupportsWeakReference
21 {
22 public:
24 // nsISupports
25 NS_DECL_ISUPPORTS
26 NS_DECL_NSICONTENTPOLICY
27 NS_DECL_NSIOBSERVER
29 nsContentBlocker();
30 nsresult Init();
32 private:
33 ~nsContentBlocker() {}
35 void PrefChanged(nsIPrefBranch *, const char *);
36 nsresult TestPermission(nsIURI *aCurrentURI,
37 nsIURI *aFirstURI,
38 int32_t aContentType,
39 bool *aPermission,
40 bool *aFromPrefs);
42 nsCOMPtr<nsIPermissionManager> mPermissionManager;
43 nsCOMPtr<nsIPrefBranch> mPrefBranchInternal;
44 static uint8_t mBehaviorPref[];
45 };
47 #define NS_CONTENTBLOCKER_CID \
48 { 0x4ca6b67b, 0x5cc7, 0x4e71, \
49 { 0xa9, 0x8a, 0x97, 0xaf, 0x1c, 0x13, 0x48, 0x62 } }
51 #define NS_CONTENTBLOCKER_CONTRACTID "@mozilla.org/permissions/contentblocker;1"
53 #endif /* nsContentBlocker_h__ */