author Dorel Luca <>
Sat, 12 Jan 2019 01:28:30 +0200
changeset 453595 c45da646fc6140bd59a36bda18f6cecde6163feb
parent 452430 f0a91d36587266d7454a450c6044d573664fbed5
child 454354 5f4630838d46dd81dadb13220a4af0da9e23a619
permissions -rw-r--r--
Backed out changeset 24243f13c895 (bug 1519308) for build bustage in mozbuild/mozbuild/test/configure/ CLOSED TREE

/* 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 */

#if !defined(BackgroundVideoDecodingPermissionObserver_h_)
#define BackgroundVideoDecodingPermissionObserver_h_

#include "nsIObserver.h"
#include "nsISupportsImpl.h"

class nsISupports;
class nsPIDOMWindowOuter;

namespace mozilla {

namespace dom {
class Document;

class MediaDecoder;

class BackgroundVideoDecodingPermissionObserver final : public nsIObserver {

  explicit BackgroundVideoDecodingPermissionObserver(MediaDecoder* aDecoder);

  NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                     const char16_t* aData) override;
  void RegisterEvent();
  void UnregisterEvent();

  void EnableEvent() const;
  void DisableEvent() const;
  already_AddRefed<nsPIDOMWindowOuter> GetOwnerWindow() 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_