BeforeUnloadEvent.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* -*- Mode: C++; tab-width: 8; 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. #ifndef mozilla_dom_BeforeUnloadEvent_h_
  6. #define mozilla_dom_BeforeUnloadEvent_h_
  7. #include "mozilla/dom/BeforeUnloadEventBinding.h"
  8. #include "mozilla/dom/Event.h"
  9. #include "nsIDOMBeforeUnloadEvent.h"
  10. namespace mozilla {
  11. namespace dom {
  12. class BeforeUnloadEvent : public Event,
  13. public nsIDOMBeforeUnloadEvent
  14. {
  15. public:
  16. BeforeUnloadEvent(EventTarget* aOwner,
  17. nsPresContext* aPresContext,
  18. WidgetEvent* aEvent)
  19. : Event(aOwner, aPresContext, aEvent)
  20. {
  21. }
  22. virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
  23. {
  24. return BeforeUnloadEventBinding::Wrap(aCx, this, aGivenProto);
  25. }
  26. NS_DECL_ISUPPORTS_INHERITED
  27. // Forward to Event
  28. NS_FORWARD_TO_EVENT
  29. // nsIDOMBeforeUnloadEvent Interface
  30. NS_DECL_NSIDOMBEFOREUNLOADEVENT
  31. protected:
  32. ~BeforeUnloadEvent() {}
  33. nsString mText;
  34. };
  35. } // namespace dom
  36. } // namespace mozilla
  37. already_AddRefed<mozilla::dom::BeforeUnloadEvent>
  38. NS_NewDOMBeforeUnloadEvent(mozilla::dom::EventTarget* aOwner,
  39. nsPresContext* aPresContext,
  40. mozilla::WidgetEvent* aEvent);
  41. #endif // mozilla_dom_BeforeUnloadEvent_h_