Bug 1700051: part 46) Const-qualify `mozInlineSpellStatus::mAnchorRange`. r=smaug
[gecko.git] / netwerk / cookie / CookieServiceChild.h
blobe0a49e8ebbc8f6644bbc02dfdf0bf7f181155015
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 "nsIObserver.h"
14 #include "nsIPrefBranch.h"
15 #include "mozIThirdPartyUtil.h"
16 #include "nsWeakReference.h"
17 #include "nsThreadUtils.h"
19 class nsIEffectiveTLDService;
20 class nsILoadInfo;
22 namespace mozilla {
23 namespace net {
25 class Cookie;
26 class CookieStruct;
28 class CookieServiceChild final : public PCookieServiceChild,
29 public nsICookieService,
30 public nsIObserver,
31 public nsITimerCallback,
32 public nsSupportsWeakReference {
33 friend class PCookieServiceChild;
35 public:
36 NS_DECL_ISUPPORTS
37 NS_DECL_NSICOOKIESERVICE
38 NS_DECL_NSIOBSERVER
39 NS_DECL_NSITIMERCALLBACK
41 typedef nsTArray<RefPtr<Cookie>> CookiesList;
42 typedef nsClassHashtable<CookieKey, CookiesList> CookiesMap;
44 CookieServiceChild();
46 static already_AddRefed<CookieServiceChild> GetSingleton();
48 void TrackCookieLoad(nsIChannel* aChannel);
50 private:
51 ~CookieServiceChild();
52 void MoveCookies();
54 void RecordDocumentCookie(Cookie* aCookie, const OriginAttributes& aAttrs);
56 uint32_t CountCookiesFromHashTable(const nsACString& aBaseDomain,
57 const OriginAttributes& aOriginAttrs);
59 void PrefChanged(nsIPrefBranch* aPrefBranch);
61 static bool RequireThirdPartyCheck(nsILoadInfo* aLoadInfo);
63 mozilla::ipc::IPCResult RecvTrackCookiesLoad(
64 nsTArray<CookieStruct>&& aCookiesList, const OriginAttributes& aAttrs);
66 mozilla::ipc::IPCResult RecvRemoveAll();
68 mozilla::ipc::IPCResult RecvRemoveBatchDeletedCookies(
69 nsTArray<CookieStruct>&& aCookiesList,
70 nsTArray<OriginAttributes>&& aAttrsList);
72 mozilla::ipc::IPCResult RecvRemoveCookie(const CookieStruct& aCookie,
73 const OriginAttributes& aAttrs);
75 mozilla::ipc::IPCResult RecvAddCookie(const CookieStruct& aCookie,
76 const OriginAttributes& aAttrs);
78 CookiesMap mCookiesMap;
79 nsCOMPtr<nsITimer> mCookieTimer;
80 nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
81 nsCOMPtr<nsIEffectiveTLDService> mTLDService;
84 } // namespace net
85 } // namespace mozilla
87 #endif // mozilla_net_CookieServiceChild_h__