2010-03-25 23:02:28 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2010-03-25 23:02:28 +00:00
|
|
|
|
|
|
|
#ifndef mozilla_net_CookieServiceChild_h__
|
|
|
|
#define mozilla_net_CookieServiceChild_h__
|
|
|
|
|
2020-04-06 12:22:29 +00:00
|
|
|
#include "CookieKey.h"
|
2010-03-25 23:02:28 +00:00
|
|
|
#include "mozilla/net/PCookieServiceChild.h"
|
2017-08-03 11:00:41 +00:00
|
|
|
#include "nsClassHashtable.h"
|
2010-03-25 23:02:28 +00:00
|
|
|
#include "nsICookieService.h"
|
2010-10-19 16:37:03 +00:00
|
|
|
#include "mozIThirdPartyUtil.h"
|
2010-12-01 02:47:08 +00:00
|
|
|
#include "nsWeakReference.h"
|
2018-04-26 14:39:13 +00:00
|
|
|
#include "nsThreadUtils.h"
|
2010-03-25 23:02:28 +00:00
|
|
|
|
2017-08-03 11:00:41 +00:00
|
|
|
class nsIEffectiveTLDService;
|
2019-03-08 09:04:34 +00:00
|
|
|
class nsILoadInfo;
|
2017-08-03 11:00:41 +00:00
|
|
|
|
2010-03-25 23:02:28 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
2020-04-06 12:22:01 +00:00
|
|
|
|
|
|
|
class Cookie;
|
2017-08-03 11:00:41 +00:00
|
|
|
class CookieStruct;
|
2010-03-25 23:02:28 +00:00
|
|
|
|
2020-04-20 10:00:25 +00:00
|
|
|
class CookieServiceChild final : public PCookieServiceChild,
|
|
|
|
public nsICookieService,
|
|
|
|
public nsSupportsWeakReference {
|
2019-02-06 15:57:37 +00:00
|
|
|
friend class PCookieServiceChild;
|
|
|
|
|
2010-03-25 23:02:28 +00:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICOOKIESERVICE
|
|
|
|
|
2020-04-06 12:22:01 +00:00
|
|
|
typedef nsTArray<RefPtr<Cookie>> CookiesList;
|
2020-04-06 12:22:29 +00:00
|
|
|
typedef nsClassHashtable<CookieKey, CookiesList> CookiesMap;
|
2017-08-03 11:00:41 +00:00
|
|
|
|
2010-03-25 23:02:28 +00:00
|
|
|
CookieServiceChild();
|
|
|
|
|
2017-09-04 22:05:10 +00:00
|
|
|
static already_AddRefed<CookieServiceChild> GetSingleton();
|
2010-03-25 23:02:28 +00:00
|
|
|
|
2017-08-03 11:00:41 +00:00
|
|
|
void TrackCookieLoad(nsIChannel* aChannel);
|
|
|
|
|
2020-04-20 10:00:25 +00:00
|
|
|
private:
|
|
|
|
~CookieServiceChild();
|
2014-06-24 16:36:44 +00:00
|
|
|
|
2020-04-06 12:22:01 +00:00
|
|
|
void RecordDocumentCookie(Cookie* aCookie, const OriginAttributes& aAttrs);
|
2017-08-03 11:00:41 +00:00
|
|
|
|
2020-05-09 20:26:13 +00:00
|
|
|
uint32_t CountCookiesFromHashTable(const nsACString& aBaseDomain,
|
2017-08-03 09:59:31 +00:00
|
|
|
const OriginAttributes& aOriginAttrs);
|
|
|
|
|
2020-01-08 10:25:44 +00:00
|
|
|
static bool RequireThirdPartyCheck(nsILoadInfo* aLoadInfo);
|
2010-10-19 16:37:03 +00:00
|
|
|
|
2019-02-06 15:58:43 +00:00
|
|
|
mozilla::ipc::IPCResult RecvTrackCookiesLoad(
|
|
|
|
nsTArray<CookieStruct>&& aCookiesList, const OriginAttributes& aAttrs);
|
2017-08-03 11:00:41 +00:00
|
|
|
|
2019-02-06 15:58:43 +00:00
|
|
|
mozilla::ipc::IPCResult RecvRemoveAll();
|
2017-08-03 10:00:12 +00:00
|
|
|
|
2019-02-06 15:58:43 +00:00
|
|
|
mozilla::ipc::IPCResult RecvRemoveBatchDeletedCookies(
|
2017-08-03 10:00:12 +00:00
|
|
|
nsTArray<CookieStruct>&& aCookiesList,
|
2019-02-06 15:58:43 +00:00
|
|
|
nsTArray<OriginAttributes>&& aAttrsList);
|
2017-08-03 10:00:12 +00:00
|
|
|
|
2019-02-06 15:58:43 +00:00
|
|
|
mozilla::ipc::IPCResult RecvRemoveCookie(const CookieStruct& aCookie,
|
|
|
|
const OriginAttributes& aAttrs);
|
2017-08-03 10:00:12 +00:00
|
|
|
|
2019-02-06 15:58:43 +00:00
|
|
|
mozilla::ipc::IPCResult RecvAddCookie(const CookieStruct& aCookie,
|
|
|
|
const OriginAttributes& aAttrs);
|
2017-08-03 10:00:12 +00:00
|
|
|
|
2017-08-03 11:00:41 +00:00
|
|
|
CookiesMap mCookiesMap;
|
2010-10-19 16:37:03 +00:00
|
|
|
nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
|
2017-08-03 11:00:41 +00:00
|
|
|
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
2010-03-25 23:02:28 +00:00
|
|
|
};
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
2010-03-25 23:02:28 +00:00
|
|
|
|
|
|
|
#endif // mozilla_net_CookieServiceChild_h__
|