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 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 }; 86 87 // ---------------------------- 88 89 class MediaControlMuteButtonElement FINAL : public MediaControlInputElement { 90 public: 91 static PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> create(MediaControls&); 92 93 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 94 virtual void updateDisplayType() OVERRIDE; 95 96 private: 97 explicit MediaControlMuteButtonElement(MediaControls&); 98 99 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 100 virtual void defaultEventHandler(Event*) OVERRIDE; 101 }; 102 103 // ---------------------------- 104 105 class MediaControlPlayButtonElement FINAL : public MediaControlInputElement { 106 public: 107 static PassRefPtrWillBeRawPtr<MediaControlPlayButtonElement> create(MediaControls&); 108 109 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 110 virtual void updateDisplayType() OVERRIDE; 111 112 private: 113 explicit MediaControlPlayButtonElement(MediaControls&); 114 115 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 116 virtual void defaultEventHandler(Event*) OVERRIDE; 117 }; 118 119 // ---------------------------- 120 121 class MediaControlOverlayPlayButtonElement FINAL : public MediaControlInputElement { 122 public: 123 static PassRefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> create(MediaControls&); 124 125 virtual void updateDisplayType() OVERRIDE; 126 127 private: 128 explicit MediaControlOverlayPlayButtonElement(MediaControls&); 129 130 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 131 virtual void defaultEventHandler(Event*) OVERRIDE; 132 virtual bool keepEventInNode(Event*) OVERRIDE; 133 }; 134 135 // ---------------------------- 136 137 class MediaControlToggleClosedCaptionsButtonElement FINAL : public MediaControlInputElement { 138 public: 139 static PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> create(MediaControls&); 140 141 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 142 143 virtual void updateDisplayType() OVERRIDE; 144 145 private: 146 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); 147 148 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 149 virtual void defaultEventHandler(Event*) OVERRIDE; 150 }; 151 152 // ---------------------------- 153 154 class MediaControlTimelineElement FINAL : public MediaControlInputElement { 155 public: 156 static PassRefPtrWillBeRawPtr<MediaControlTimelineElement> create(MediaControls&); 157 158 virtual bool willRespondToMouseClickEvents() OVERRIDE; 159 160 // FIXME: An "earliest possible position" will be needed once that concept 161 // is supported by HTMLMediaElement, see https://crbug.com/137275 162 void setPosition(double); 163 void setDuration(double); 164 165 private: 166 explicit MediaControlTimelineElement(MediaControls&); 167 168 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 169 virtual void defaultEventHandler(Event*) OVERRIDE; 170 virtual bool keepEventInNode(Event*) OVERRIDE; 171 }; 172 173 // ---------------------------- 174 175 class MediaControlFullscreenButtonElement FINAL : public MediaControlInputElement { 176 public: 177 static PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> create(MediaControls&); 178 179 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 180 181 void setIsFullscreen(bool); 182 183 private: 184 explicit MediaControlFullscreenButtonElement(MediaControls&); 185 186 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 187 virtual void defaultEventHandler(Event*) OVERRIDE; 188 }; 189 190 // ---------------------------- 191 192 class MediaControlVolumeSliderElement FINAL : public MediaControlInputElement { 193 public: 194 static PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> create(MediaControls&); 195 196 virtual bool willRespondToMouseMoveEvents() OVERRIDE; 197 virtual bool willRespondToMouseClickEvents() OVERRIDE; 198 void setVolume(double); 199 200 private: 201 explicit MediaControlVolumeSliderElement(MediaControls&); 202 203 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 204 virtual void defaultEventHandler(Event*) OVERRIDE; 205 virtual bool keepEventInNode(Event*) OVERRIDE; 206 }; 207 208 // ---------------------------- 209 210 class MediaControlTimeRemainingDisplayElement FINAL : public MediaControlTimeDisplayElement { 211 public: 212 static PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> create(MediaControls&); 213 214 private: 215 explicit MediaControlTimeRemainingDisplayElement(MediaControls&); 216 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 217 }; 218 219 // ---------------------------- 220 221 class MediaControlCurrentTimeDisplayElement FINAL : public MediaControlTimeDisplayElement { 222 public: 223 static PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> create(MediaControls&); 224 225 private: 226 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); 227 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 228 }; 229 230 // ---------------------------- 231 232 class MediaControlTextTrackContainerElement FINAL : public MediaControlDivElement { 233 public: 234 static PassRefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> create(MediaControls&); 235 236 void updateDisplay(); 237 void updateSizes(); 238 static const AtomicString& textTrackContainerElementShadowPseudoId(); 239 240 private: 241 explicit MediaControlTextTrackContainerElement(MediaControls&); 242 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 243 244 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; 245 246 IntRect m_videoDisplaySize; 247 float m_fontSize; 248 }; 249 250 251 } // namespace WebCore 252 253 #endif // MediaControlElements_h 254