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