Bug 1868802: add `this` pointer to `nsHttpHandler::NotifyObservers`'s logging. r...
[gecko.git] / netwerk / cookie / CookieServiceParent.h
blob7492538d1c4579c659ce03f79315902cf5ba7b0d
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_CookieServiceParent_h
7 #define mozilla_net_CookieServiceParent_h
9 #include "mozilla/net/PCookieServiceParent.h"
10 #include "mozilla/net/CookieKey.h"
12 class nsIArray;
13 class nsICookie;
14 namespace mozilla {
15 class OriginAttributes;
18 class nsIEffectiveTLDService;
20 namespace mozilla {
21 namespace net {
23 class Cookie;
24 class CookieService;
26 class CookieServiceParent : public PCookieServiceParent {
27 friend class PCookieServiceParent;
29 public:
30 CookieServiceParent();
31 virtual ~CookieServiceParent() = default;
33 void TrackCookieLoad(nsIChannel* aChannel);
35 void RemoveBatchDeletedCookies(nsIArray* aCookieList);
37 void RemoveAll();
39 void RemoveCookie(const Cookie& aCookie);
41 void AddCookie(const Cookie& aCookie);
43 // This will return true if the CookieServiceParent is currently processing
44 // an update from the content process. This is used in ContentParent to make
45 // sure that we are only forwarding those cookie updates to other content
46 // processes, not the one they originated from.
47 bool ProcessingCookie() { return mProcessingCookie; }
49 bool ContentProcessHasCookie(const Cookie& cookie);
50 bool InsecureCookieOrSecureOrigin(const Cookie& cookie);
51 void UpdateCookieInContentList(nsIURI* aHostURI,
52 const OriginAttributes& aOriginAttrs);
54 mozilla::ipc::IPCResult SetCookies(
55 const nsCString& aBaseDomain, const OriginAttributes& aOriginAttributes,
56 nsIURI* aHost, bool aFromHttp, const nsTArray<CookieStruct>& aCookies,
57 dom::BrowsingContext* aBrowsingContext = nullptr);
59 protected:
60 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
62 mozilla::ipc::IPCResult RecvSetCookies(
63 const nsCString& aBaseDomain, const OriginAttributes& aOriginAttributes,
64 nsIURI* aHost, bool aFromHttp, const nsTArray<CookieStruct>& aCookies);
66 mozilla::ipc::IPCResult RecvPrepareCookieList(
67 nsIURI* aHost, const bool& aIsForeign,
68 const bool& aIsThirdPartyTrackingResource,
69 const bool& aIsThirdPartySocialTrackingResource,
70 const bool& aStorageAccessPermissionGranted,
71 const uint32_t& aRejectedReason, const bool& aIsSafeTopLevelNav,
72 const bool& aIsSameSiteForeign, const bool& aHadCrossSiteRedirects,
73 const OriginAttributes& aAttrs);
75 static void SerializeCookieList(const nsTArray<Cookie*>& aFoundCookieList,
76 nsTArray<CookieStruct>& aCookiesList,
77 nsIURI* aHostURI);
79 nsCOMPtr<nsIEffectiveTLDService> mTLDService;
80 RefPtr<CookieService> mCookieService;
81 bool mProcessingCookie;
82 nsTHashMap<CookieKey, bool> mCookieKeysInContent;
85 } // namespace net
86 } // namespace mozilla
88 #endif // mozilla_net_CookieServiceParent_h