Bug 1863873 - Block ability to perform audio decoding outside of Utility on release...
[gecko.git] / dom / webauthn / WebAuthnManagerBase.h
blob18806c5d35a1b530d3292896e56f87e9031c1368
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/. */
7 #ifndef mozilla_dom_WebAuthnManagerBase_h
8 #define mozilla_dom_WebAuthnManagerBase_h
10 #include "nsIDOMEventListener.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsCOMPtr.h"
15 * A base class used by WebAuthn and U2F implementations, providing shared
16 * functionality and requiring an interface used by the IPC child actors.
19 class nsPIDOMWindowInner;
21 namespace mozilla::dom {
23 class WebAuthnTransactionChild;
24 class WebAuthnMakeCredentialResult;
25 class WebAuthnGetAssertionResult;
27 class WebAuthnManagerBase : public nsIDOMEventListener {
28 public:
29 NS_DECL_NSIDOMEVENTLISTENER
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_CYCLE_COLLECTION_CLASS(WebAuthnManagerBase)
34 explicit WebAuthnManagerBase(nsPIDOMWindowInner* aParent);
36 MOZ_CAN_RUN_SCRIPT
37 virtual void FinishMakeCredential(
38 const uint64_t& aTransactionId,
39 const WebAuthnMakeCredentialResult& aResult) = 0;
41 MOZ_CAN_RUN_SCRIPT
42 virtual void FinishGetAssertion(
43 const uint64_t& aTransactionId,
44 const WebAuthnGetAssertionResult& aResult) = 0;
46 MOZ_CAN_RUN_SCRIPT
47 virtual void RequestAborted(const uint64_t& aTransactionId,
48 const nsresult& aError) = 0;
50 void ActorDestroyed();
52 protected:
53 MOZ_CAN_RUN_SCRIPT virtual ~WebAuthnManagerBase();
55 // Needed by HandleEvent() to track visibilty changes.
56 MOZ_CAN_RUN_SCRIPT virtual void HandleVisibilityChange() = 0;
58 // Visibility event handling.
59 void ListenForVisibilityEvents();
60 void StopListeningForVisibilityEvents();
62 bool MaybeCreateBackgroundActor();
64 // The parent window.
65 nsCOMPtr<nsPIDOMWindowInner> mParent;
67 // IPC Channel to the parent process.
68 RefPtr<WebAuthnTransactionChild> mChild;
71 } // namespace mozilla::dom
73 #endif // mozilla_dom_WebAuthnManagerBase_h