Bug 1688354 [wpt PR 27298] - Treat 'rem' as an absolute unit for font size, a=testonly
[gecko.git] / dom / midi / MIDIInput.h
blobdf4247ffa8f6f7b067ac01aea6607294d00e0eb6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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/. */
7 #ifndef mozilla_dom_MIDIInput_h
8 #define mozilla_dom_MIDIInput_h
10 #include "mozilla/dom/MIDIPort.h"
12 struct JSContext;
14 namespace mozilla {
15 namespace dom {
17 class MIDIPortInfo;
19 /**
20 * Represents a MIDI Input Port, handles generating incoming message events.
23 class MIDIInput final : public MIDIPort {
24 public:
25 static MIDIInput* Create(nsPIDOMWindowInner* aWindow,
26 MIDIAccess* aMIDIAccessParent,
27 const MIDIPortInfo& aPortInfo,
28 const bool aSysexEnabled);
29 ~MIDIInput() = default;
31 JSObject* WrapObject(JSContext* aCx,
32 JS::Handle<JSObject*> aGivenProto) override;
34 // Since we need to be able to open the port on event handler assignment, we
35 // can't use IMPL_EVENT_HANDLER. We have to implement the event handler
36 // functions ourselves.
38 // Getter for the event handler callback
39 EventHandlerNonNull* GetOnmidimessage();
40 // Setter for the event handler callback
41 void SetOnmidimessage(EventHandlerNonNull* aCallback);
43 private:
44 MIDIInput(nsPIDOMWindowInner* aWindow, MIDIAccess* aMIDIAccessParent);
45 // Takes an array of IPC MIDIMessage objects and turns them into
46 // MIDIMessageEvents, which it then fires.
47 void Receive(const nsTArray<MIDIMessage>& aMsgs) override;
50 } // namespace dom
51 } // namespace mozilla
53 #endif // mozilla_dom_MIDIInput_h