tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

BeforeUnloadEvent.h (1480B)


      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_BeforeUnloadEvent_h_
      8 #define mozilla_dom_BeforeUnloadEvent_h_
      9 
     10 #include "mozilla/dom/BeforeUnloadEventBinding.h"
     11 #include "mozilla/dom/Event.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 class BeforeUnloadEvent : public Event {
     16 public:
     17  BeforeUnloadEvent(EventTarget* aOwner, nsPresContext* aPresContext,
     18                    WidgetEvent* aEvent)
     19      : Event(aOwner, aPresContext, aEvent) {}
     20 
     21  virtual BeforeUnloadEvent* AsBeforeUnloadEvent() override { return this; }
     22 
     23  virtual JSObject* WrapObjectInternal(
     24      JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
     25    return BeforeUnloadEvent_Binding::Wrap(aCx, this, aGivenProto);
     26  }
     27 
     28  NS_INLINE_DECL_REFCOUNTING_INHERITED(BeforeUnloadEvent, Event)
     29 
     30  void GetReturnValue(nsAString& aReturnValue);
     31  void SetReturnValue(const nsAString& aReturnValue);
     32 
     33 protected:
     34  ~BeforeUnloadEvent() = default;
     35 
     36  nsString mText;
     37 };
     38 
     39 }  // namespace mozilla::dom
     40 
     41 already_AddRefed<mozilla::dom::BeforeUnloadEvent> NS_NewDOMBeforeUnloadEvent(
     42    mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
     43    mozilla::WidgetEvent* aEvent);
     44 
     45 #endif  // mozilla_dom_BeforeUnloadEvent_h_