HTMLVideoElementPictureInPicture.h [plain text]
#pragma once
#if ENABLE(PICTURE_IN_PICTURE_API)
#include "PictureInPictureObserver.h"
#include "Supplementable.h"
#include <wtf/IsoMalloc.h>
#include <wtf/LoggerHelper.h>
namespace WebCore {
class DeferredPromise;
class HTMLVideoElement;
class PictureInPictureWindow;
class HTMLVideoElementPictureInPicture
: public Supplement<HTMLVideoElement>
, public PictureInPictureObserver
#if !RELEASE_LOG_DISABLED
, private LoggerHelper
#endif
{
WTF_MAKE_ISO_ALLOCATED(HTMLVideoElementPictureInPicture);
public:
HTMLVideoElementPictureInPicture(HTMLVideoElement&);
static HTMLVideoElementPictureInPicture* from(HTMLVideoElement&);
static void providePictureInPictureTo(HTMLVideoElement&);
virtual ~HTMLVideoElementPictureInPicture();
static void requestPictureInPicture(HTMLVideoElement&, Ref<DeferredPromise>&&);
static bool autoPictureInPicture(HTMLVideoElement&);
static void setAutoPictureInPicture(HTMLVideoElement&, bool);
static bool disablePictureInPicture(HTMLVideoElement&);
static void setDisablePictureInPicture(HTMLVideoElement&, bool);
void exitPictureInPicture(Ref<DeferredPromise>&&);
void didEnterPictureInPicture(const IntSize&);
void didExitPictureInPicture();
void pictureInPictureWindowResized(const IntSize&);
#if !RELEASE_LOG_DISABLED
const Logger& logger() const final { return m_logger.get(); }
const void* logIdentifier() const final { return m_logIdentifier; }
const char* logClassName() const final { return "HTMLVideoElementPictureInPicture"; }
WTFLogChannel& logChannel() const final;
#endif
private:
static const char* supplementName() { return "HTMLVideoElementPictureInPicture"; }
bool m_autoPictureInPicture { false };
bool m_disablePictureInPicture { false };
HTMLVideoElement& m_videoElement;
RefPtr<PictureInPictureWindow> m_pictureInPictureWindow;
RefPtr<DeferredPromise> m_enterPictureInPicturePromise;
RefPtr<DeferredPromise> m_exitPictureInPicturePromise;
#if !RELEASE_LOG_DISABLED
Ref<const Logger> m_logger;
const void* m_logIdentifier;
#endif
};
}
#endif // ENABLE(PICTURE_IN_PICTURE_API)