#ifndef MediaControls_h
#define MediaControls_h
#include "core/html/HTMLDivElement.h"
#include "core/html/shadow/MediaControlElements.h"
namespace WebCore {
class Document;
class Event;
class MediaControls FINAL : public HTMLDivElement {
public:
static PassRefPtr<MediaControls> create(HTMLMediaElement&);
HTMLMediaElement& mediaElement() const { return m_mediaElement; }
void reset();
void show();
void hide();
void playbackStarted();
void playbackProgressed();
void playbackStopped();
void beginScrubbing();
void endScrubbing();
void updateCurrentTimeDisplay();
void updateVolume();
void changedClosedCaptionsVisibility();
void refreshClosedCaptionsButtonVisibility();
void closedCaptionTracksChanged();
void enteredFullscreen();
void exitedFullscreen();
void updateTextTrackDisplay();
private:
explicit MediaControls(HTMLMediaElement&);
bool initializeControls();
void makeOpaque();
void makeTransparent();
void updatePlayState();
bool shouldHideFullscreenControls();
void hideFullscreenControlsTimerFired(Timer<MediaControls>*);
void startHideFullscreenControlsTimer();
void stopHideFullscreenControlsTimer();
void createTextTrackDisplay();
void showTextTrackDisplay();
void hideTextTrackDisplay();
virtual bool isMediaControls() const OVERRIDE { return true; }
virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; }
virtual void defaultEventHandler(Event*) OVERRIDE;
bool containsRelatedTarget(Event*);
virtual const AtomicString& shadowPseudoId() const OVERRIDE;
HTMLMediaElement& m_mediaElement;
MediaControlPanelElement* m_panel;
MediaControlTextTrackContainerElement* m_textDisplayContainer;
MediaControlOverlayPlayButtonElement* m_overlayPlayButton;
MediaControlOverlayEnclosureElement* m_overlayEnclosure;
MediaControlPlayButtonElement* m_playButton;
MediaControlCurrentTimeDisplayElement* m_currentTimeDisplay;
MediaControlTimelineElement* m_timeline;
MediaControlMuteButtonElement* m_muteButton;
MediaControlVolumeSliderElement* m_volumeSlider;
MediaControlToggleClosedCaptionsButtonElement* m_toggleClosedCaptionsButton;
MediaControlFullscreenButtonElement* m_fullScreenButton;
MediaControlTimeRemainingDisplayElement* m_durationDisplay;
MediaControlPanelEnclosureElement* m_enclosure;
Timer<MediaControls> m_hideFullscreenControlsTimer;
bool m_isFullscreen : 1;
bool m_isMouseOverControls : 1;
bool m_isPausedForScrubbing : 1;
};
DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls());
}
#endif