CookieNotification.h (1803B)
1 /* -*- Mode: C++; tab-width: 4; 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/. */ 5 6 #ifndef mozilla_net_CookieNotification_h 7 #define mozilla_net_CookieNotification_h 8 9 #include "nsIArray.h" 10 #include "nsICookieNotification.h" 11 #include "nsICookie.h" 12 #include "nsCOMPtr.h" 13 #include "nsTArray.h" 14 #include "nsString.h" 15 16 namespace mozilla::net { 17 18 class CookieNotification final : public nsICookieNotification { 19 public: 20 // nsISupports 21 NS_DECL_ISUPPORTS 22 NS_DECL_NSICOOKIENOTIFICATION 23 24 explicit CookieNotification(nsICookieNotification::Action aAction, 25 nsICookie* aCookie, const nsACString& aBaseDomain, 26 bool aIsThirdParty = false, 27 nsIArray* aBatchDeletedCookies = nullptr, 28 uint64_t aBrowsingContextId = 0, 29 const nsID* aOperationID = nullptr) 30 : mAction(aAction), 31 mCookie(aCookie), 32 mBaseDomain(aBaseDomain), 33 mIsThirdParty(aIsThirdParty), 34 mBatchDeletedCookies(aBatchDeletedCookies), 35 mBrowsingContextId(aBrowsingContextId) { 36 if (aOperationID) { 37 mOperationID = aOperationID->Clone(); 38 } 39 }; 40 41 private: 42 nsICookieNotification::Action mAction; 43 nsCOMPtr<nsICookie> mCookie; 44 nsCString mBaseDomain; 45 bool mIsThirdParty; 46 nsCOMPtr<nsIArray> mBatchDeletedCookies; 47 uint64_t mBrowsingContextId = 0; 48 nsID* mOperationID = nullptr; 49 50 ~CookieNotification() { 51 if (mOperationID) { 52 free(mOperationID); 53 } 54 } 55 }; 56 57 } // namespace mozilla::net 58 59 #endif // mozilla_net_CookieNotification_h