2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef MediaControlRootElement_h
28 #define MediaControlRootElement_h
32 #include "MediaControls.h"
33 #include <wtf/RefPtr.h>
37 class HTMLInputElement;
38 class HTMLMediaElement;
40 class MediaControlPanelMuteButtonElement;
41 class MediaControlPlayButtonElement;
42 class MediaControlSeekButtonElement;
43 class MediaControlRewindButtonElement;
44 class MediaControlReturnToRealtimeButtonElement;
45 class MediaControlToggleClosedCaptionsButtonElement;
46 class MediaControlCurrentTimeDisplayElement;
47 class MediaControlTimelineElement;
48 class MediaControlTimeRemainingDisplayElement;
49 class MediaControlVolumeSliderElement;
50 class MediaControlFullscreenButtonElement;
51 class MediaControlTimeDisplayElement;
52 class MediaControlStatusDisplayElement;
53 class MediaControlTimelineContainerElement;
54 class MediaControlSeekBackButtonElement;
55 class MediaControlSeekForwardButtonElement;
56 class MediaControlMuteButtonElement;
57 class MediaControlVolumeSliderElement;
58 class MediaControlVolumeSliderMuteButtonElement;
59 class MediaControlVolumeSliderContainerElement;
60 class MediaControlFullscreenVolumeMinButtonElement;
61 class MediaControlFullscreenVolumeSliderElement;
62 class MediaControlFullscreenVolumeMaxButtonElement;
63 class MediaControlPanelElement;
69 class MediaControlRootElement : public MediaControls {
71 static PassRefPtr<MediaControlRootElement> create(HTMLMediaElement*);
73 // MediaControls implementation.
77 void makeTransparent();
81 void playbackProgressed();
82 void playbackStarted();
83 void playbackStopped();
88 void enteredFullscreen();
89 void exitedFullscreen();
92 void loadedMetadata();
93 void changedClosedCaptionsVisibility();
95 void showVolumeSlider();
96 void updateTimeDisplay();
97 void updateStatusDisplay();
99 virtual bool shouldHideControls();
102 MediaControlRootElement(HTMLMediaElement*);
104 virtual void defaultEventHandler(Event*);
105 void hideFullscreenControlsTimerFired(Timer<MediaControlRootElement>*);
106 void startHideFullscreenControlsTimer();
107 void stopHideFullscreenControlsTimer();
109 virtual const AtomicString& shadowPseudoId() const;
111 bool containsRelatedTarget(Event*);
113 HTMLMediaElement* m_mediaElement;
115 MediaControlRewindButtonElement* m_rewindButton;
116 MediaControlPlayButtonElement* m_playButton;
117 MediaControlReturnToRealtimeButtonElement* m_returnToRealTimeButton;
118 MediaControlStatusDisplayElement* m_statusDisplay;
119 MediaControlCurrentTimeDisplayElement* m_currentTimeDisplay;
120 MediaControlTimelineElement* m_timeline;
121 MediaControlTimeRemainingDisplayElement* m_timeRemainingDisplay;
122 MediaControlTimelineContainerElement* m_timelineContainer;
123 MediaControlSeekBackButtonElement* m_seekBackButton;
124 MediaControlSeekForwardButtonElement* m_seekForwardButton;
125 MediaControlToggleClosedCaptionsButtonElement* m_toggleClosedCaptionsButton;
126 MediaControlPanelMuteButtonElement* m_panelMuteButton;
127 MediaControlVolumeSliderElement* m_volumeSlider;
128 MediaControlVolumeSliderMuteButtonElement* m_volumeSliderMuteButton;
129 MediaControlVolumeSliderContainerElement* m_volumeSliderContainer;
130 MediaControlFullscreenButtonElement* m_fullScreenButton;
131 MediaControlFullscreenVolumeMinButtonElement* m_fullScreenMinVolumeButton;
132 MediaControlFullscreenVolumeSliderElement* m_fullScreenVolumeSlider;
133 MediaControlFullscreenVolumeMaxButtonElement* m_fullScreenMaxVolumeButton;
134 MediaControlPanelElement* m_panel;
136 bool m_isMouseOverControls;
137 Timer<MediaControlRootElement> m_hideFullscreenControlsTimer;