1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/extensions/cookie/nsCookiePermission.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef nsCookiePermission_h__ 1.9 +#define nsCookiePermission_h__ 1.10 + 1.11 +#include "nsICookiePermission.h" 1.12 +#include "nsIPermissionManager.h" 1.13 +#include "nsIObserver.h" 1.14 +#include "nsCOMPtr.h" 1.15 +#include "mozIThirdPartyUtil.h" 1.16 + 1.17 +class nsIPrefBranch; 1.18 + 1.19 +class nsCookiePermission : public nsICookiePermission 1.20 + , public nsIObserver 1.21 +{ 1.22 +public: 1.23 + NS_DECL_ISUPPORTS 1.24 + NS_DECL_NSICOOKIEPERMISSION 1.25 + NS_DECL_NSIOBSERVER 1.26 + 1.27 + nsCookiePermission() 1.28 + : mCookiesLifetimeSec(INT64_MAX) 1.29 + , mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY 1.30 + , mCookiesAlwaysAcceptSession(false) 1.31 + {} 1.32 + virtual ~nsCookiePermission() {} 1.33 + 1.34 + bool Init(); 1.35 + void PrefChanged(nsIPrefBranch *, const char *); 1.36 + 1.37 +private: 1.38 + bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); }; 1.39 + 1.40 + nsCOMPtr<nsIPermissionManager> mPermMgr; 1.41 + nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil; 1.42 + 1.43 + int64_t mCookiesLifetimeSec; // lifetime limit specified in seconds 1.44 + uint8_t mCookiesLifetimePolicy; // pref for how long cookies are stored 1.45 + bool mCookiesAlwaysAcceptSession; // don't prompt for session cookies 1.46 +}; 1.47 + 1.48 +// {EF565D0A-AB9A-4A13-9160-0644CDFD859A} 1.49 +#define NS_COOKIEPERMISSION_CID \ 1.50 + {0xEF565D0A, 0xAB9A, 0x4A13, {0x91, 0x60, 0x06, 0x44, 0xcd, 0xfd, 0x85, 0x9a }} 1.51 + 1.52 +#endif