2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-03-22 04:24:51 +03:00
|
|
|
|
|
|
|
#ifndef nsCookiePermission_h__
|
|
|
|
#define nsCookiePermission_h__
|
|
|
|
|
|
|
|
#include "nsICookiePermission.h"
|
2003-08-16 01:04:54 +04:00
|
|
|
#include "nsIPermissionManager.h"
|
2003-10-11 01:23:44 +04:00
|
|
|
#include "nsIObserver.h"
|
2003-08-16 01:04:54 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2003-10-16 17:17:12 +04:00
|
|
|
#include "prlong.h"
|
2009-01-21 10:46:28 +03:00
|
|
|
#include "nsIPrivateBrowsingService.h"
|
2003-03-22 04:24:51 +03:00
|
|
|
|
2003-10-11 01:23:44 +04:00
|
|
|
class nsIPrefBranch;
|
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
class nsCookiePermission : public nsICookiePermission
|
2003-10-11 01:23:44 +04:00
|
|
|
, public nsIObserver
|
2003-03-22 04:24:51 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICOOKIEPERMISSION
|
2003-10-11 01:23:44 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
nsCookiePermission()
|
2004-03-10 09:47:49 +03:00
|
|
|
: mCookiesLifetimeSec(LL_MAXINT)
|
2004-05-05 06:06:38 +04:00
|
|
|
, mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY
|
2011-10-17 18:59:28 +04:00
|
|
|
, mCookiesAlwaysAcceptSession(false)
|
2003-10-11 01:23:44 +04:00
|
|
|
{}
|
|
|
|
virtual ~nsCookiePermission() {}
|
|
|
|
|
2010-03-26 02:02:28 +03:00
|
|
|
bool Init();
|
|
|
|
void PrefChanged(nsIPrefBranch *, const char *);
|
2003-08-16 01:04:54 +04:00
|
|
|
|
|
|
|
private:
|
2010-03-26 02:02:28 +03:00
|
|
|
bool EnsureInitialized() { return mPermMgr != NULL || Init(); };
|
|
|
|
bool InPrivateBrowsing();
|
2009-01-21 10:46:28 +03:00
|
|
|
|
2003-08-16 01:04:54 +04:00
|
|
|
nsCOMPtr<nsIPermissionManager> mPermMgr;
|
2009-01-21 10:46:28 +03:00
|
|
|
nsCOMPtr<nsIPrivateBrowsingService> mPBService;
|
2003-10-11 01:23:44 +04:00
|
|
|
|
2007-06-18 01:52:22 +04:00
|
|
|
PRInt64 mCookiesLifetimeSec; // lifetime limit specified in seconds
|
2004-03-10 09:47:49 +03:00
|
|
|
PRUint8 mCookiesLifetimePolicy; // pref for how long cookies are stored
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCookiesAlwaysAcceptSession; // don't prompt for session cookies
|
2003-03-22 04:24:51 +03:00
|
|
|
};
|
|
|
|
|
2007-06-22 15:12:13 +04:00
|
|
|
// {EF565D0A-AB9A-4A13-9160-0644CDFD859A}
|
2003-03-22 04:24:51 +03:00
|
|
|
#define NS_COOKIEPERMISSION_CID \
|
|
|
|
{0xEF565D0A, 0xAB9A, 0x4A13, {0x91, 0x60, 0x06, 0x44, 0xcd, 0xfd, 0x85, 0x9a }}
|
|
|
|
|
|
|
|
#endif
|