Bug 1807268 - Re-enable verifyShowClipboardSuggestionsToggleTest UI test r=jajohnson
[gecko.git] / netwerk / cookie / CookieServiceChild.h
blob562ee7f1aeddf010aa6f3b5b3a15ef4405a7cdb7
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_net_CookieServiceChild_h__
7 #define mozilla_net_CookieServiceChild_h__
9 #include "CookieKey.h"
10 #include "mozilla/net/PCookieServiceChild.h"
11 #include "nsClassHashtable.h"
12 #include "nsICookieService.h"
13 #include "mozIThirdPartyUtil.h"
14 #include "nsWeakReference.h"
15 #include "nsThreadUtils.h"
17 class nsIEffectiveTLDService;
18 class nsILoadInfo;
20 namespace mozilla {
21 namespace net {
23 class Cookie;
24 class CookieStruct;
26 class CookieServiceChild final : public PCookieServiceChild,
27 public nsICookieService,
28 public nsSupportsWeakReference {
29 friend class PCookieServiceChild;
31 public:
32 NS_DECL_ISUPPORTS
33 NS_DECL_NSICOOKIESERVICE
35 typedef nsTArray<RefPtr<Cookie>> CookiesList;
36 typedef nsClassHashtable<CookieKey, CookiesList> CookiesMap;
38 CookieServiceChild();
40 void Init();
42 static already_AddRefed<CookieServiceChild> GetSingleton();
44 RefPtr<GenericPromise> TrackCookieLoad(nsIChannel* aChannel);
46 private:
47 ~CookieServiceChild();
49 void RecordDocumentCookie(Cookie* aCookie, const OriginAttributes& aAttrs);
51 uint32_t CountCookiesFromHashTable(const nsACString& aBaseDomain,
52 const OriginAttributes& aOriginAttrs);
54 static bool RequireThirdPartyCheck(nsILoadInfo* aLoadInfo);
56 mozilla::ipc::IPCResult RecvTrackCookiesLoad(
57 nsTArray<CookieStructTable>&& aCookiesListTable);
59 mozilla::ipc::IPCResult RecvRemoveAll();
61 mozilla::ipc::IPCResult RecvRemoveBatchDeletedCookies(
62 nsTArray<CookieStruct>&& aCookiesList,
63 nsTArray<OriginAttributes>&& aAttrsList);
65 mozilla::ipc::IPCResult RecvRemoveCookie(const CookieStruct& aCookie,
66 const OriginAttributes& aAttrs);
68 mozilla::ipc::IPCResult RecvAddCookie(const CookieStruct& aCookie,
69 const OriginAttributes& aAttrs);
71 void RemoveSingleCookie(const CookieStruct& aCookie,
72 const OriginAttributes& aAttrs);
74 CookiesMap mCookiesMap;
75 nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
76 nsCOMPtr<nsIEffectiveTLDService> mTLDService;
79 } // namespace net
80 } // namespace mozilla
82 #endif // mozilla_net_CookieServiceChild_h__