Bug 1472338: part 2) Change `clipboard.readText()` to read from the clipboard asynchr...
[gecko.git] / dom / midi / MIDIPermissionRequest.h
blob0d62abdfb2165e15fb8be3dddc7d5ff7d231d336
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_MIDIPermissionRequest_h
8 #define mozilla_dom_MIDIPermissionRequest_h
10 #include "mozilla/dom/Promise.h"
11 #include "nsContentPermissionHelper.h"
13 namespace mozilla::dom {
15 struct MIDIOptions;
17 /**
18 * Handles permission dialog management when requesting MIDI permissions.
20 class MIDIPermissionRequest final : public ContentPermissionRequestBase,
21 public nsIRunnable {
22 public:
23 MIDIPermissionRequest(nsPIDOMWindowInner* aWindow, Promise* aPromise,
24 const MIDIOptions& aOptions);
26 NS_DECL_ISUPPORTS_INHERITED
27 NS_DECL_NSIRUNNABLE
28 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MIDIPermissionRequest,
29 ContentPermissionRequestBase)
30 // nsIContentPermissionRequest
31 NS_IMETHOD Cancel(void) override;
32 NS_IMETHOD Allow(JS::HandleValue choices) override;
33 NS_IMETHOD GetTypes(nsIArray** aTypes) override;
35 private:
36 ~MIDIPermissionRequest() = default;
38 // Promise for returning MIDIAccess on request success
39 RefPtr<Promise> mPromise;
40 // True if sysex permissions should be requested
41 bool mNeedsSysex;
44 } // namespace mozilla::dom
46 #endif // mozilla_dom_MIDIPermissionRequest_h