author Emilio Cobos Álvarez <>
Thu, 04 Oct 2018 13:17:02 +0200
changeset 440291 836472045b3b69d18d219f12b7319d53e39f0ddd
parent 395149 dfe90994b1ae223126cde8ceebbd5f97656a3fac
child 446960 0ceae9db9ec0be18daa1a279511ad305723185d4
permissions -rw-r--r--
Bug 1496486 - Bump cbindgen. r=heycam Differential Revision:

/* 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 nsIDocument;
class nsISupports;
class nsPIDOMWindowOuter;

namespace mozilla {

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;
    nsIDocument* 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_