Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / shadow / MediaControlElements.h
1 /*
2  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3  * Copyright (C) 2012 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  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifndef MediaControlElements_h
31 #define MediaControlElements_h
32
33 #include "core/html/shadow/MediaControlElementTypes.h"
34
35 namespace WebCore {
36
37 // ----------------------------
38
39 class MediaControlPanelElement FINAL : public MediaControlDivElement {
40 public:
41     static PassRefPtr<MediaControlPanelElement> create(MediaControls&);
42
43     void setIsDisplayed(bool);
44
45     void makeOpaque();
46     void makeTransparent();
47
48 private:
49     explicit MediaControlPanelElement(MediaControls&);
50
51     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
52     virtual void defaultEventHandler(Event*) OVERRIDE;
53
54     void startTimer();
55     void stopTimer();
56     void transitionTimerFired(Timer<MediaControlPanelElement>*);
57
58     bool m_isDisplayed;
59     bool m_opaque;
60
61     Timer<MediaControlPanelElement> m_transitionTimer;
62 };
63
64 // ----------------------------
65
66 class MediaControlPanelEnclosureElement FINAL : public MediaControlDivElement {
67 public:
68     static PassRefPtr<MediaControlPanelEnclosureElement> create(MediaControls&);
69
70 private:
71     explicit MediaControlPanelEnclosureElement(MediaControls&);
72     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
73 };
74
75 // ----------------------------
76
77 class MediaControlOverlayEnclosureElement FINAL : public MediaControlDivElement {
78 public:
79     static PassRefPtr<MediaControlOverlayEnclosureElement> create(MediaControls&);
80
81 private:
82     explicit MediaControlOverlayEnclosureElement(MediaControls&);
83     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
84 };
85
86 // ----------------------------
87
88 class MediaControlMuteButtonElement FINAL : public MediaControlInputElement {
89 public:
90     static PassRefPtr<MediaControlMuteButtonElement> create(MediaControls&);
91
92     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
93     virtual void updateDisplayType() OVERRIDE;
94
95 private:
96     explicit MediaControlMuteButtonElement(MediaControls&);
97
98     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
99     virtual void defaultEventHandler(Event*) OVERRIDE;
100 };
101
102 // ----------------------------
103
104 class MediaControlPlayButtonElement FINAL : public MediaControlInputElement {
105 public:
106     static PassRefPtr<MediaControlPlayButtonElement> create(MediaControls&);
107
108     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
109     virtual void updateDisplayType() OVERRIDE;
110
111 private:
112     explicit MediaControlPlayButtonElement(MediaControls&);
113
114     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
115     virtual void defaultEventHandler(Event*) OVERRIDE;
116 };
117
118 // ----------------------------
119
120 class MediaControlOverlayPlayButtonElement FINAL : public MediaControlInputElement {
121 public:
122     static PassRefPtr<MediaControlOverlayPlayButtonElement> create(MediaControls&);
123
124     virtual void updateDisplayType() OVERRIDE;
125
126 private:
127     explicit MediaControlOverlayPlayButtonElement(MediaControls&);
128
129     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
130     virtual void defaultEventHandler(Event*) OVERRIDE;
131 };
132
133 // ----------------------------
134
135 class MediaControlToggleClosedCaptionsButtonElement FINAL : public MediaControlInputElement {
136 public:
137     static PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> create(MediaControls&);
138
139     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
140
141     virtual void updateDisplayType() OVERRIDE;
142
143 private:
144     explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&);
145
146     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
147     virtual void defaultEventHandler(Event*) OVERRIDE;
148 };
149
150 // ----------------------------
151
152 class MediaControlTimelineElement FINAL : public MediaControlInputElement {
153 public:
154     static PassRefPtr<MediaControlTimelineElement> create(MediaControls&);
155
156     virtual bool willRespondToMouseClickEvents() OVERRIDE;
157
158     void setPosition(double);
159     void setDuration(double);
160
161 private:
162     explicit MediaControlTimelineElement(MediaControls&);
163
164     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
165     virtual void defaultEventHandler(Event*) OVERRIDE;
166 };
167
168 // ----------------------------
169
170 class MediaControlFullscreenButtonElement FINAL : public MediaControlInputElement {
171 public:
172     static PassRefPtr<MediaControlFullscreenButtonElement> create(MediaControls&);
173
174     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
175
176     void setIsFullscreen(bool);
177
178 private:
179     explicit MediaControlFullscreenButtonElement(MediaControls&);
180
181     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
182     virtual void defaultEventHandler(Event*) OVERRIDE;
183 };
184
185 // ----------------------------
186
187 class MediaControlVolumeSliderElement FINAL : public MediaControlInputElement {
188 public:
189     static PassRefPtr<MediaControlVolumeSliderElement> create(MediaControls&);
190
191     virtual bool willRespondToMouseMoveEvents() OVERRIDE;
192     virtual bool willRespondToMouseClickEvents() OVERRIDE;
193     void setVolume(double);
194
195 private:
196     explicit MediaControlVolumeSliderElement(MediaControls&);
197
198     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
199     virtual void defaultEventHandler(Event*) OVERRIDE;
200 };
201
202 // ----------------------------
203
204 class MediaControlTimeRemainingDisplayElement FINAL : public MediaControlTimeDisplayElement {
205 public:
206     static PassRefPtr<MediaControlTimeRemainingDisplayElement> create(MediaControls&);
207
208 private:
209     explicit MediaControlTimeRemainingDisplayElement(MediaControls&);
210     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
211 };
212
213 // ----------------------------
214
215 class MediaControlCurrentTimeDisplayElement FINAL : public MediaControlTimeDisplayElement {
216 public:
217     static PassRefPtr<MediaControlCurrentTimeDisplayElement> create(MediaControls&);
218
219 private:
220     explicit MediaControlCurrentTimeDisplayElement(MediaControls&);
221     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
222 };
223
224 // ----------------------------
225
226 class MediaControlTextTrackContainerElement FINAL : public MediaControlDivElement {
227 public:
228     static PassRefPtr<MediaControlTextTrackContainerElement> create(MediaControls&);
229
230     void updateDisplay();
231     void updateSizes();
232     static const AtomicString& textTrackContainerElementShadowPseudoId();
233
234 private:
235     explicit MediaControlTextTrackContainerElement(MediaControls&);
236     virtual const AtomicString& shadowPseudoId() const OVERRIDE;
237
238     virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
239
240     IntRect m_videoDisplaySize;
241     float m_fontSize;
242 };
243
244
245 } // namespace WebCore
246
247 #endif // MediaControlElements_h