tor-browser

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

CommandEvent.h (1766B)


      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_CommandEvent_h_
      8 #define mozilla_dom_CommandEvent_h_
      9 
     10 #include "mozilla/EventForwards.h"
     11 #include "mozilla/dom/CommandEventBinding.h"
     12 #include "mozilla/dom/Event.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class CommandEvent : public Event {
     17 public:
     18  CommandEvent(EventTarget* aOwner, nsPresContext* aPresContext,
     19               WidgetCommandEvent* aEvent);
     20 
     21  NS_DECL_ISUPPORTS_INHERITED
     22  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CommandEvent, Event)
     23 
     24  virtual JSObject* WrapObjectInternal(
     25      JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
     26    return CommandEvent_Binding::Wrap(aCx, this, aGivenProto);
     27  }
     28 
     29  static already_AddRefed<CommandEvent> Constructor(
     30      EventTarget* aOwner, const nsAString& aType,
     31      const CommandEventInit& aEventInitDict);
     32 
     33  static already_AddRefed<CommandEvent> Constructor(
     34      const GlobalObject& aGlobal, const nsAString& aType,
     35      const CommandEventInit& aEventInitDict);
     36 
     37  void GetCommand(nsAString& aCommand) const;
     38 
     39  Element* GetSource();
     40 
     41  static bool IsCallerChromeOrCommandForEnabled(JSContext*, JSObject*);
     42 
     43 protected:
     44  ~CommandEvent() = default;
     45 
     46 private:
     47  RefPtr<Element> mSource;
     48 };
     49 
     50 }  // namespace mozilla::dom
     51 
     52 already_AddRefed<mozilla::dom::CommandEvent> NS_NewDOMCommandEvent(
     53    mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
     54    mozilla::WidgetCommandEvent* aEvent);
     55 
     56 #endif  // mozilla_dom_CommandEvent_h_