CookieStoreNotifier.h (1404B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_CookieStoreNotifier_h 8 #define mozilla_dom_CookieStoreNotifier_h 9 10 #include "mozilla/OriginAttributes.h" 11 #include "nsIObserver.h" 12 13 class nsISerialEventTarget; 14 15 namespace mozilla::dom { 16 17 class CookieStore; 18 struct CookieListItem; 19 class Event; 20 21 class CookieStoreNotifier final : public nsIObserver { 22 public: 23 NS_DECL_THREADSAFE_ISUPPORTS 24 NS_DECL_NSIOBSERVER 25 26 static already_AddRefed<CookieStoreNotifier> Create( 27 CookieStore* aCookieStore); 28 29 void Disentangle(); 30 31 void FireDelayedDOMEvents(); 32 33 private: 34 CookieStoreNotifier(CookieStore* aCookieStore, const nsACString& aBaseDomain, 35 const OriginAttributes& aOriginAttributes); 36 ~CookieStoreNotifier(); 37 38 void DispatchEvent(const CookieListItem& aItem, bool aDeletedEvent); 39 40 // Raw pointer because this object is kept alive by this CookieStore object. 41 CookieStore* mCookieStore; 42 43 nsCString mBaseDomain; 44 OriginAttributes mOriginAttributes; 45 46 nsTArray<RefPtr<Event>> mDelayedDOMEvents; 47 }; 48 49 } // namespace mozilla::dom 50 51 #endif /* mozilla_dom_CookieStoreNotifier_h */