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"
13 class nsPIDOMWindowOuter
;
19 class BrowsingContext
;
24 class BackgroundVideoDecodingPermissionObserver final
: public nsIObserver
{
28 explicit BackgroundVideoDecodingPermissionObserver(MediaDecoder
* aDecoder
);
30 NS_IMETHOD
Observe(nsISupports
* aSubject
, const char* aTopic
,
31 const char16_t
* aData
) override
;
33 void UnregisterEvent();
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_