initial import
[vuplus_webkit] / Source / WebCore / html / shadow / MediaControlRootElement.h
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3  * Copyright (C) 2011 Google Inc. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
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.
13  *
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.
25  */
26
27 #ifndef MediaControlRootElement_h
28 #define MediaControlRootElement_h
29
30 #if ENABLE(VIDEO)
31
32 #include "MediaControls.h"
33 #include <wtf/RefPtr.h>
34
35 namespace WebCore {
36
37 class HTMLInputElement;
38 class HTMLMediaElement;
39 class Event;
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;
64 class MediaPlayer;
65
66 class RenderBox;
67 class RenderMedia;
68
69 class MediaControlRootElement : public MediaControls {
70 public:
71     static PassRefPtr<MediaControlRootElement> create(HTMLMediaElement*);
72
73     // MediaControls implementation.
74     void show();
75     void hide();
76     void makeOpaque();
77     void makeTransparent();
78
79     void reset();
80
81     void playbackProgressed();
82     void playbackStarted();
83     void playbackStopped();
84
85     void changedMute();
86     void changedVolume();
87
88     void enteredFullscreen();
89     void exitedFullscreen();
90
91     void reportedError();
92     void loadedMetadata();
93     void changedClosedCaptionsVisibility();
94
95     void showVolumeSlider();
96     void updateTimeDisplay();
97     void updateStatusDisplay();
98
99     virtual bool shouldHideControls();
100
101 private:
102     MediaControlRootElement(HTMLMediaElement*);
103
104     virtual void defaultEventHandler(Event*);
105     void hideFullscreenControlsTimerFired(Timer<MediaControlRootElement>*);
106     void startHideFullscreenControlsTimer();
107     void stopHideFullscreenControlsTimer();
108
109     virtual const AtomicString& shadowPseudoId() const;
110
111     bool containsRelatedTarget(Event*);
112
113     HTMLMediaElement* m_mediaElement;
114
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;
135     bool m_opaque;
136     bool m_isMouseOverControls;
137     Timer<MediaControlRootElement> m_hideFullscreenControlsTimer;
138 };
139
140 }
141
142 #endif
143 #endif