michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsCookiePermission_h__ michael@0: #define nsCookiePermission_h__ michael@0: michael@0: #include "nsICookiePermission.h" michael@0: #include "nsIPermissionManager.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "mozIThirdPartyUtil.h" michael@0: michael@0: class nsIPrefBranch; michael@0: michael@0: class nsCookiePermission : public nsICookiePermission michael@0: , public nsIObserver michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSICOOKIEPERMISSION michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: nsCookiePermission() michael@0: : mCookiesLifetimeSec(INT64_MAX) michael@0: , mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY michael@0: , mCookiesAlwaysAcceptSession(false) michael@0: {} michael@0: virtual ~nsCookiePermission() {} michael@0: michael@0: bool Init(); michael@0: void PrefChanged(nsIPrefBranch *, const char *); michael@0: michael@0: private: michael@0: bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); }; michael@0: michael@0: nsCOMPtr mPermMgr; michael@0: nsCOMPtr mThirdPartyUtil; michael@0: michael@0: int64_t mCookiesLifetimeSec; // lifetime limit specified in seconds michael@0: uint8_t mCookiesLifetimePolicy; // pref for how long cookies are stored michael@0: bool mCookiesAlwaysAcceptSession; // don't prompt for session cookies michael@0: }; michael@0: michael@0: // {EF565D0A-AB9A-4A13-9160-0644CDFD859A} michael@0: #define NS_COOKIEPERMISSION_CID \ michael@0: {0xEF565D0A, 0xAB9A, 0x4A13, {0x91, 0x60, 0x06, 0x44, 0xcd, 0xfd, 0x85, 0x9a }} michael@0: michael@0: #endif