• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
willRespondToMouseClickEvents()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 
willRespondToMouseClickEvents()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 
willRespondToMouseClickEvents()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 
willRespondToMouseClickEvents()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 
willRespondToMouseClickEvents()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
275