VideoFullscreenInterfaceMac.h [plain text]
#pragma once
#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
#include "HTMLMediaElementEnums.h"
#include "PlaybackSessionInterfaceMac.h"
#include "PlaybackSessionModel.h"
#include "VideoFullscreenModel.h"
#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
OBJC_CLASS NSWindow;
OBJC_CLASS WebVideoFullscreenInterfaceMacObjC;
namespace WebCore {
class IntRect;
class FloatSize;
class PlaybackSessionInterfaceMac;
class VideoFullscreenChangeObserver;
class VideoFullscreenInterfaceMac
: public VideoFullscreenModelClient
, private PlaybackSessionModelClient
, public RefCounted<VideoFullscreenInterfaceMac> {
public:
static Ref<VideoFullscreenInterfaceMac> create(PlaybackSessionInterfaceMac& playbackSessionInterface)
{
return adoptRef(*new VideoFullscreenInterfaceMac(playbackSessionInterface));
}
virtual ~VideoFullscreenInterfaceMac();
PlaybackSessionInterfaceMac& playbackSessionInterface() const { return m_playbackSessionInterface.get(); }
VideoFullscreenModel* videoFullscreenModel() const { return m_videoFullscreenModel.get(); }
PlaybackSessionModel* playbackSessionModel() const { return m_playbackSessionInterface->playbackSessionModel(); }
WEBCORE_EXPORT void setVideoFullscreenModel(VideoFullscreenModel*);
VideoFullscreenChangeObserver* videoFullscreenChangeObserver() const { return m_fullscreenChangeObserver.get(); }
WEBCORE_EXPORT void setVideoFullscreenChangeObserver(VideoFullscreenChangeObserver*);
WEBCORE_EXPORT void rateChanged(bool isPlaying, float playbackRate) override;
WEBCORE_EXPORT void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override;
WEBCORE_EXPORT void ensureControlsManager() override;
WEBCORE_EXPORT void hasVideoChanged(bool) final;
WEBCORE_EXPORT void videoDimensionsChanged(const FloatSize&) final;
WEBCORE_EXPORT void setupFullscreen(NSView& layerHostedView, const IntRect& initialRect, NSWindow *parentWindow, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback);
WEBCORE_EXPORT void enterFullscreen();
WEBCORE_EXPORT void exitFullscreen(const IntRect& finalRect, NSWindow *parentWindow);
WEBCORE_EXPORT void exitFullscreenWithoutAnimationToMode(HTMLMediaElementEnums::VideoFullscreenMode);
WEBCORE_EXPORT void cleanupFullscreen();
WEBCORE_EXPORT void invalidate();
void requestHideAndExitFullscreen() { }
WEBCORE_EXPORT void preparedToReturnToInline(bool visible, const IntRect& inlineRect, NSWindow *parentWindow);
void preparedToExitFullscreen() { }
HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
bool hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode & mode; }
bool isMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode == mode; }
WEBCORE_EXPORT void setMode(HTMLMediaElementEnums::VideoFullscreenMode);
void clearMode(HTMLMediaElementEnums::VideoFullscreenMode);
WEBCORE_EXPORT bool isPlayingVideoInEnhancedFullscreen() const;
bool mayAutomaticallyShowVideoPictureInPicture() const { return false; }
void applicationDidBecomeActive() { }
WEBCORE_EXPORT WebVideoFullscreenInterfaceMacObjC *videoFullscreenInterfaceObjC();
WEBCORE_EXPORT void requestHideAndExitPiP();
private:
WEBCORE_EXPORT VideoFullscreenInterfaceMac(PlaybackSessionInterfaceMac&);
Ref<PlaybackSessionInterfaceMac> m_playbackSessionInterface;
WeakPtr<VideoFullscreenModel> m_videoFullscreenModel;
WeakPtr<VideoFullscreenChangeObserver> m_fullscreenChangeObserver;
HTMLMediaElementEnums::VideoFullscreenMode m_mode { HTMLMediaElementEnums::VideoFullscreenModeNone };
RetainPtr<WebVideoFullscreenInterfaceMacObjC> m_webVideoFullscreenInterfaceObjC;
};
}
#endif