Bug 1708422: part 16) Rename `mozInlineSpellChecker::SpellCheckerTimeSlice` to `mozIn...
[gecko.git] / dom / media / BackgroundVideoDecodingPermissionObserver.h
blobee8e8164def77c5cedf1aa2363d8c65ab09b47e1
1 /* vim:set ts=2 sw=2 sts=2 et cindent: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #if !defined(BackgroundVideoDecodingPermissionObserver_h_)
7 # define BackgroundVideoDecodingPermissionObserver_h_
9 # include "nsIObserver.h"
10 # include "nsISupportsImpl.h"
12 class nsISupports;
13 class nsPIDOMWindowOuter;
15 namespace mozilla {
17 namespace dom {
18 class Document;
19 class BrowsingContext;
20 } // namespace dom
22 class MediaDecoder;
24 class BackgroundVideoDecodingPermissionObserver final : public nsIObserver {
25 public:
26 NS_DECL_ISUPPORTS
28 explicit BackgroundVideoDecodingPermissionObserver(MediaDecoder* aDecoder);
30 NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
31 const char16_t* aData) override;
32 void RegisterEvent();
33 void UnregisterEvent();
35 private:
36 ~BackgroundVideoDecodingPermissionObserver();
37 void EnableEvent() const;
38 void DisableEvent() const;
39 dom::BrowsingContext* GetOwnerBC() const;
40 dom::Document* GetOwnerDoc() const;
41 bool IsValidEventSender(nsISupports* aSubject) const;
43 // The life cycle of observer would always be shorter than decoder, so we
44 // use raw pointer here.
45 MediaDecoder* mDecoder;
46 bool mIsRegisteredForEvent;
49 } // namespace mozilla
51 #endif // BackgroundVideoDecodingPermissionObserver_h_