extensions/cookie/nsCookiePermission.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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/. */
     5 #ifndef nsCookiePermission_h__
     6 #define nsCookiePermission_h__
     8 #include "nsICookiePermission.h"
     9 #include "nsIPermissionManager.h"
    10 #include "nsIObserver.h"
    11 #include "nsCOMPtr.h"
    12 #include "mozIThirdPartyUtil.h"
    14 class nsIPrefBranch;
    16 class nsCookiePermission : public nsICookiePermission
    17                          , public nsIObserver
    18 {
    19 public:
    20   NS_DECL_ISUPPORTS
    21   NS_DECL_NSICOOKIEPERMISSION
    22   NS_DECL_NSIOBSERVER
    24   nsCookiePermission()
    25     : mCookiesLifetimeSec(INT64_MAX)
    26     , mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY
    27     , mCookiesAlwaysAcceptSession(false)
    28     {}
    29   virtual ~nsCookiePermission() {}
    31   bool Init();
    32   void PrefChanged(nsIPrefBranch *, const char *);
    34 private:
    35    bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); };
    37   nsCOMPtr<nsIPermissionManager> mPermMgr;
    38   nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
    40   int64_t      mCookiesLifetimeSec;            // lifetime limit specified in seconds
    41   uint8_t      mCookiesLifetimePolicy;         // pref for how long cookies are stored
    42   bool mCookiesAlwaysAcceptSession;    // don't prompt for session cookies
    43 };
    45 // {EF565D0A-AB9A-4A13-9160-0644CDFD859A}
    46 #define NS_COOKIEPERMISSION_CID \
    47  {0xEF565D0A, 0xAB9A, 0x4A13, {0x91, 0x60, 0x06, 0x44, 0xcd, 0xfd, 0x85, 0x9a }}
    49 #endif

mercurial