/src/mozilla-central/extensions/cookie/nsCookiePermission.h
Line | Count | Source (jump to first uncovered line) |
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 | | |
5 | | #ifndef nsCookiePermission_h__ |
6 | | #define nsCookiePermission_h__ |
7 | | |
8 | | #include "nsICookiePermission.h" |
9 | | #include "nsIPermissionManager.h" |
10 | | #include "nsIObserver.h" |
11 | | #include "nsCOMPtr.h" |
12 | | #include "mozIThirdPartyUtil.h" |
13 | | |
14 | | class nsIPrefBranch; |
15 | | |
16 | | class nsCookiePermission final : public nsICookiePermission |
17 | | , public nsIObserver |
18 | | { |
19 | | public: |
20 | | NS_DECL_ISUPPORTS |
21 | | NS_DECL_NSICOOKIEPERMISSION |
22 | | NS_DECL_NSIOBSERVER |
23 | | |
24 | | // Singleton accessor |
25 | | static already_AddRefed<nsICookiePermission> GetOrCreate(); |
26 | | static void Shutdown(); |
27 | | |
28 | | bool Init(); |
29 | | void PrefChanged(nsIPrefBranch *, const char *); |
30 | | |
31 | | private: |
32 | | nsCookiePermission() |
33 | | : mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY |
34 | 0 | {} |
35 | 0 | virtual ~nsCookiePermission() {} |
36 | | |
37 | 0 | bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); }; |
38 | | |
39 | | nsCOMPtr<nsIPermissionManager> mPermMgr; |
40 | | nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil; |
41 | | |
42 | | uint8_t mCookiesLifetimePolicy; // pref for how long cookies are stored |
43 | | }; |
44 | | |
45 | | #endif |