ExtendableCookieChangeEvent.h (1820B)
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_ExtendableCookieChangeEvent_h 8 #define mozilla_dom_ExtendableCookieChangeEvent_h 9 10 #include "mozilla/dom/BindingUtils.h" 11 #include "mozilla/dom/ExtendableCookieChangeEventBinding.h" 12 #include "mozilla/dom/ServiceWorkerEvents.h" 13 14 namespace mozilla::dom { 15 16 class ExtendableCookieChangeEvent final : public ExtendableEvent { 17 public: 18 NS_DECL_ISUPPORTS_INHERITED 19 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ExtendableCookieChangeEvent, 20 ExtendableEvent) 21 22 JSObject* WrapObjectInternal(JSContext* aCx, 23 JS::Handle<JSObject*> aGivenProto) override; 24 25 static already_AddRefed<ExtendableCookieChangeEvent> Constructor( 26 const GlobalObject& aGlobal, const nsAString& aType, 27 const ExtendableCookieChangeEventInit& aEventInit); 28 29 void GetChanged(nsTArray<CookieListItem>& aList) const; 30 31 void GetDeleted(nsTArray<CookieListItem>& aList) const; 32 33 static already_AddRefed<ExtendableCookieChangeEvent> CreateForChangedCookie( 34 EventTarget* aEventTarget, const CookieListItem& aItem); 35 36 static already_AddRefed<ExtendableCookieChangeEvent> CreateForDeletedCookie( 37 EventTarget* aEventTarget, const CookieListItem& aItem); 38 39 private: 40 explicit ExtendableCookieChangeEvent(EventTarget* aOwner); 41 ~ExtendableCookieChangeEvent(); 42 43 nsTArray<CookieListItem> mChanged; 44 nsTArray<CookieListItem> mDeleted; 45 }; 46 47 } // namespace mozilla::dom 48 49 #endif /* mozilla_dom_ExtendableCookieChangeEvent_h */