summaryrefslogtreecommitdiffstats
path: root/dom/media/BackgroundVideoDecodingPermissionObserver.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/media/BackgroundVideoDecodingPermissionObserver.h
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/BackgroundVideoDecodingPermissionObserver.h')
-rw-r--r--dom/media/BackgroundVideoDecodingPermissionObserver.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/media/BackgroundVideoDecodingPermissionObserver.h b/dom/media/BackgroundVideoDecodingPermissionObserver.h
new file mode 100644
index 0000000000..ee8e8164de
--- /dev/null
+++ b/dom/media/BackgroundVideoDecodingPermissionObserver.h
@@ -0,0 +1,51 @@
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#if !defined(BackgroundVideoDecodingPermissionObserver_h_)
+# define BackgroundVideoDecodingPermissionObserver_h_
+
+# include "nsIObserver.h"
+# include "nsISupportsImpl.h"
+
+class nsISupports;
+class nsPIDOMWindowOuter;
+
+namespace mozilla {
+
+namespace dom {
+class Document;
+class BrowsingContext;
+} // namespace dom
+
+class MediaDecoder;
+
+class BackgroundVideoDecodingPermissionObserver final : public nsIObserver {
+ public:
+ NS_DECL_ISUPPORTS
+
+ explicit BackgroundVideoDecodingPermissionObserver(MediaDecoder* aDecoder);
+
+ NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
+ const char16_t* aData) override;
+ void RegisterEvent();
+ void UnregisterEvent();
+
+ private:
+ ~BackgroundVideoDecodingPermissionObserver();
+ void EnableEvent() const;
+ void DisableEvent() const;
+ dom::BrowsingContext* GetOwnerBC() const;
+ dom::Document* GetOwnerDoc() const;
+ bool IsValidEventSender(nsISupports* aSubject) const;
+
+ // The life cycle of observer would always be shorter than decoder, so we
+ // use raw pointer here.
+ MediaDecoder* mDecoder;
+ bool mIsRegisteredForEvent;
+};
+
+} // namespace mozilla
+
+#endif // BackgroundVideoDecodingPermissionObserver_h_