Update To 11.40.268.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 blink {
36
37 // ----------------------------
38
39 class MediaControlPanelElement final : public MediaControlDivElement {
40 public:
41     static PassRefPtrWillBeRawPtr<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     virtual bool keepEventInNode(Event*) override;
58
59     bool m_isDisplayed;
60     bool m_opaque;
61
62     Timer<MediaControlPanelElement> m_transitionTimer;
63 };
64
65 // ----------------------------
66
67 class MediaControlPanelEnclosureElement final : public MediaControlDivElement {
68 public:
69     static PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> create(MediaControls&);
70
71 private:
72     explicit MediaControlPanelEnclosureElement(MediaControls&);
73     virtual const AtomicString& shadowPseudoId() const override;
74 };
75
76 // ----------------------------
77
78 class MediaControlOverlayEnclosureElement final : public MediaControlDivElement {
79 public:
80     static PassRefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> create(MediaControls&);
81
82 private:
83     explicit MediaControlOverlayEnclosureElement(MediaControls&);
84     virtual const AtomicString& shadowPseudoId() const override;
85     virtual void* preDispatchEventHandler(Event*) override;
86 };
87
88 // ----------------------------
89
90 class MediaControlMuteButtonElement final : public MediaControlInputElement {
91 public:
92     static PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> create(MediaControls&);
93
94     virtual bool willRespondToMouseClickEvents() override { return true; }
95     virtual void updateDisplayType() override;
96
97 private:
98     explicit MediaControlMuteButtonElement(MediaControls&);
99
100     virtual const AtomicString& shadowPseudoId() const override;
101     virtual void defaultEventHandler(Event*) override;
102 };
103
104 // ----------------------------
105
106 class MediaControlPlayButtonElement final : public MediaControlInputElement {
107 public:
108     static PassRefPtrWillBeRawPtr<MediaControlPlayButtonElement> create(MediaControls&);
109
110     virtual bool willRespondToMouseClickEvents() override { return true; }
111     virtual void updateDisplayType() override;
112
113 private:
114     explicit MediaControlPlayButtonElement(MediaControls&);
115
116     virtual const AtomicString& shadowPseudoId() const override;
117     virtual void defaultEventHandler(Event*) override;
118 };
119
120 // ----------------------------
121
122 class MediaControlOverlayPlayButtonElement final : public MediaControlInputElement {
123 public:
124     static PassRefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> create(MediaControls&);
125
126     virtual void updateDisplayType() override;
127
128 private:
129     explicit MediaControlOverlayPlayButtonElement(MediaControls&);
130
131     virtual const AtomicString& shadowPseudoId() const override;
132     virtual void defaultEventHandler(Event*) override;
133     virtual bool keepEventInNode(Event*) override;
134 };
135
136 // ----------------------------
137
138 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlInputElement {
139 public:
140     static PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> create(MediaControls&);
141
142     virtual bool willRespondToMouseClickEvents() override { return true; }
143
144     virtual void updateDisplayType() override;
145
146 private:
147     explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&);
148
149     virtual const AtomicString& shadowPseudoId() const override;
150     virtual void defaultEventHandler(Event*) override;
151 };
152
153 // ----------------------------
154
155 class MediaControlTimelineElement final : public MediaControlInputElement {
156 public:
157     static PassRefPtrWillBeRawPtr<MediaControlTimelineElement> create(MediaControls&);
158
159     virtual bool willRespondToMouseClickEvents() override;
160
161     // FIXME: An "earliest possible position" will be needed once that concept
162     // is supported by HTMLMediaElement, see https://crbug.com/137275
163     void setPosition(double);
164     void setDuration(double);
165
166 private:
167     explicit MediaControlTimelineElement(MediaControls&);
168
169     virtual const AtomicString& shadowPseudoId() const override;
170     virtual void defaultEventHandler(Event*) override;
171     virtual bool keepEventInNode(Event*) override;
172 };
173
174 // ----------------------------
175
176 class MediaControlFullscreenButtonElement final : public MediaControlInputElement {
177 public:
178     static PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> create(MediaControls&);
179
180     virtual bool willRespondToMouseClickEvents() override { return true; }
181
182     void setIsFullscreen(bool);
183
184 private:
185     explicit MediaControlFullscreenButtonElement(MediaControls&);
186
187     virtual const AtomicString& shadowPseudoId() const override;
188     virtual void defaultEventHandler(Event*) override;
189 };
190
191 // ----------------------------
192
193 class MediaControlCastButtonElement final : public MediaControlInputElement {
194 public:
195     static PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> create(MediaControls&, bool isOverlayButton);
196
197     virtual bool willRespondToMouseClickEvents() override { return true; }
198
199     void setIsPlayingRemotely(bool);
200
201 private:
202     explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton);
203
204     virtual const AtomicString& shadowPseudoId() const override;
205     virtual void defaultEventHandler(Event*) override;
206     virtual bool keepEventInNode(Event*) override;
207
208     bool m_isOverlayButton;
209 };
210
211 // ----------------------------
212
213 class MediaControlVolumeSliderElement final : public MediaControlInputElement {
214 public:
215     static PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> create(MediaControls&);
216
217     virtual bool willRespondToMouseMoveEvents() override;
218     virtual bool willRespondToMouseClickEvents() override;
219     void setVolume(double);
220
221 private:
222     explicit MediaControlVolumeSliderElement(MediaControls&);
223
224     virtual const AtomicString& shadowPseudoId() const override;
225     virtual void defaultEventHandler(Event*) override;
226     virtual bool keepEventInNode(Event*) override;
227 };
228
229 // ----------------------------
230
231 class MediaControlTimeRemainingDisplayElement final : public MediaControlTimeDisplayElement {
232 public:
233     static PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> create(MediaControls&);
234
235 private:
236     explicit MediaControlTimeRemainingDisplayElement(MediaControls&);
237     virtual const AtomicString& shadowPseudoId() const override;
238 };
239
240 // ----------------------------
241
242 class MediaControlCurrentTimeDisplayElement final : public MediaControlTimeDisplayElement {
243 public:
244     static PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> create(MediaControls&);
245
246 private:
247     explicit MediaControlCurrentTimeDisplayElement(MediaControls&);
248     virtual const AtomicString& shadowPseudoId() const override;
249 };
250
251 // ----------------------------
252
253 class MediaControlTextTrackContainerElement final : public MediaControlDivElement {
254 public:
255     static PassRefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> create(MediaControls&);
256
257     void updateDisplay();
258     void updateSizes();
259     static const AtomicString& textTrackContainerElementShadowPseudoId();
260
261 private:
262     explicit MediaControlTextTrackContainerElement(MediaControls&);
263     virtual const AtomicString& shadowPseudoId() const override;
264
265     virtual RenderObject* createRenderer(RenderStyle*) override;
266
267     IntRect m_videoDisplaySize;
268     float m_fontSize;
269 };
270
271
272 } // namespace blink
273
274 #endif // MediaControlElements_h