1/* 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 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 * 15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#ifndef MediaControlsBlackBerry_h 29#define MediaControlsBlackBerry_h 30 31#if ENABLE(VIDEO) 32 33#include "MediaControlElementTypes.h" 34#include "MediaControlElements.h" 35#include "MediaControls.h" 36#include <wtf/RefPtr.h> 37 38namespace WebCore { 39 40class HTMLInputElement; 41class HTMLMediaElement; 42class Event; 43class MediaPlayer; 44 45class RenderBox; 46class RenderMedia; 47 48#if ENABLE(VIDEO_TRACK) 49class MediaControlTextTrackContainerElement; 50class MediaControlTextTrackDisplayElement; 51#endif 52 53class MediaControlButtonGroupContainerElement : public MediaControlDivElement { 54public: 55 static PassRefPtr<MediaControlButtonGroupContainerElement> create(Document*); 56 57protected: 58 MediaControlButtonGroupContainerElement(Document*); 59 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 60}; 61 62class MediaControlTimeDisplayContainerElement : public MediaControlDivElement { 63public: 64 static PassRefPtr<MediaControlTimeDisplayContainerElement> create(Document*); 65 66protected: 67 MediaControlTimeDisplayContainerElement(Document*); 68 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 69}; 70 71class MediaControlEmbeddedPanelElement : public MediaControlDivElement { 72public: 73 static PassRefPtr<MediaControlEmbeddedPanelElement> create(Document*); 74 75 void setCanBeDragged(bool); 76 void setIsDisplayed(bool); 77 78 void resetPosition(); 79 void makeOpaque(); 80 void makeTransparent(); 81 82 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; } 83 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 84 85private: 86 explicit MediaControlEmbeddedPanelElement(Document*); 87 88 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 89 virtual void defaultEventHandler(Event*) OVERRIDE; 90 91 void startDrag(const LayoutPoint& eventLocation); 92 void continueDrag(const LayoutPoint& eventLocation); 93 void endDrag(); 94 95 void startTimer(); 96 void stopTimer(); 97 void transitionTimerFired(Timer<MediaControlEmbeddedPanelElement>*); 98 99 void setPosition(const LayoutPoint&); 100 101 bool m_canBeDragged; 102 bool m_isBeingDragged; 103 bool m_isDisplayed; 104 bool m_opaque; 105 LayoutPoint m_lastDragEventLocation; 106 LayoutPoint m_cumulativeDragOffset; 107 108 Timer<MediaControlEmbeddedPanelElement> m_transitionTimer; 109}; 110 111class MediaControlFullscreenTimeDisplayContainerElement : public MediaControlDivElement { 112public: 113 static PassRefPtr<MediaControlFullscreenTimeDisplayContainerElement> create(Document*); 114 115protected: 116 MediaControlFullscreenTimeDisplayContainerElement(Document*); 117 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 118}; 119 120class MediaControlFullscreenButtonContainerElement : public MediaControlDivElement { 121public: 122 static PassRefPtr<MediaControlFullscreenButtonContainerElement> create(Document*); 123 124private: 125 MediaControlFullscreenButtonContainerElement(Document*); 126 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 127}; 128 129class MediaControlFullscreenButtonDividerElement : public MediaControlDivElement { 130public: 131 static PassRefPtr<MediaControlFullscreenButtonDividerElement> create(Document*); 132 133private: 134 MediaControlFullscreenButtonDividerElement(Document*); 135 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 136}; 137 138class MediaControlPlayButtonContainerElement : public MediaControlDivElement { 139public: 140 static PassRefPtr<MediaControlPlayButtonContainerElement> create(Document*); 141 142private: 143 MediaControlPlayButtonContainerElement(Document*); 144 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 145}; 146 147class MediaControlPlaceholderElement : public MediaControlDivElement { 148public: 149 static PassRefPtr<MediaControlPlaceholderElement> create(Document*); 150 151private: 152 MediaControlPlaceholderElement(Document*); 153 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 154}; 155 156class MediaControlFullscreenPlayButtonElement : public MediaControlInputElement { 157public: 158 static PassRefPtr<MediaControlFullscreenPlayButtonElement> create(Document*); 159 160 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 161 virtual void updateDisplayType() OVERRIDE; 162 163private: 164 MediaControlFullscreenPlayButtonElement(Document*); 165 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 166 virtual void defaultEventHandler(Event*) OVERRIDE; 167}; 168 169class MediaControlFullscreenFullscreenButtonElement : public MediaControlInputElement { 170public: 171 static PassRefPtr<MediaControlFullscreenFullscreenButtonElement> create(Document*); 172 173 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 174 void setIsFullscreen(bool); 175 176private: 177 MediaControlFullscreenFullscreenButtonElement(Document*); 178 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 179 virtual void defaultEventHandler(Event*) OVERRIDE; 180}; 181 182class MediaControlFullscreenTimelineContainerElement : public MediaControlDivElement { 183public: 184 static PassRefPtr<MediaControlFullscreenTimelineContainerElement> create(Document*); 185 186private: 187 MediaControlFullscreenTimelineContainerElement(Document*); 188 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 189}; 190 191class MediaControlFullscreenTimelineElement : public MediaControlInputElement { 192public: 193 static PassRefPtr<MediaControlFullscreenTimelineElement> create(Document*, MediaControls*); 194 195 virtual bool willRespondToMouseClickEvents() OVERRIDE; 196 void setPosition(double); 197 void setDuration(double); 198 199private: 200 MediaControlFullscreenTimelineElement(Document*, MediaControls*); 201 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 202 virtual void defaultEventHandler(Event*) OVERRIDE; 203 204 MediaControls* m_controls; 205}; 206 207class MediaControlFullscreenTimeRemainingDisplayElement : public MediaControlTimeDisplayElement { 208public: 209 static PassRefPtr<MediaControlFullscreenTimeRemainingDisplayElement> create(Document*); 210 211private: 212 MediaControlFullscreenTimeRemainingDisplayElement(Document*); 213 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 214}; 215 216class MediaControlFullscreenCurrentTimeDisplayElement : public MediaControlTimeDisplayElement { 217public: 218 static PassRefPtr<MediaControlFullscreenCurrentTimeDisplayElement> create(Document*); 219 220private: 221 MediaControlFullscreenCurrentTimeDisplayElement(Document*); 222 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 223}; 224 225class MediaControlAudioMuteButtonElement : public MediaControlMuteButtonElement { 226public: 227 static PassRefPtr<MediaControlAudioMuteButtonElement> create(Document*, MediaControls*); 228 229 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; } 230 231private: 232 explicit MediaControlAudioMuteButtonElement(Document*, MediaControls*); 233 234 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 235 virtual void defaultEventHandler(Event*) OVERRIDE; 236 237 MediaControls* m_controls; 238}; 239 240class MediaControlsBlackBerry : public MediaControls { 241public: 242 static PassRefPtr<MediaControlsBlackBerry> createControls(Document*); 243 244 // MediaControls implementation. 245 void setMediaController(MediaControllerInterface*) OVERRIDE; 246 247 void show() OVERRIDE; 248 void hide() OVERRIDE; 249 void makeOpaque() OVERRIDE; 250 void makeTransparent() OVERRIDE; 251 252 void reset() OVERRIDE; 253 254 void bufferingProgressed() OVERRIDE; 255 void playbackProgressed() OVERRIDE; 256 void playbackStarted() OVERRIDE; 257 void playbackStopped() OVERRIDE; 258 259 void changedMute() OVERRIDE; 260 261 void enteredFullscreen() OVERRIDE; 262 void exitedFullscreen() OVERRIDE; 263 264 void reportedError() OVERRIDE; 265 266 void showVolumeSlider() OVERRIDE; 267 void toggleVolumeSlider(); 268 void updateCurrentTimeDisplay() OVERRIDE; 269 270 virtual bool shouldHideControls() OVERRIDE; 271 272private: 273 MediaControlsBlackBerry(Document*); 274 275 MediaControlButtonGroupContainerElement* m_buttonContainer; 276 MediaControlTimeDisplayContainerElement* m_timeDisplayContainer; 277 MediaControlFullscreenTimeDisplayContainerElement* m_fullscreenTimeDisplayContainer; 278 MediaControlFullscreenPlayButtonElement* m_fullscreenPlayButton; 279 MediaControlFullscreenCurrentTimeDisplayElement* m_fullscreenCurrentTimeDisplay; 280 MediaControlFullscreenTimelineElement* m_fullscreenTimeline; 281 MediaControlTimeRemainingDisplayElement* m_timeRemainingDisplay; 282 MediaControlFullscreenTimeRemainingDisplayElement* m_fullscreenTimeRemainingDisplay; 283 MediaControlTimelineContainerElement* m_timelineContainer; 284 MediaControlFullscreenTimelineContainerElement* m_fullscreenTimelineContainer; 285 MediaControlFullscreenButtonDividerElement* m_fullScreenDivider; 286 MediaControlFullscreenFullscreenButtonElement* m_fullscreenFullScreenButton; 287 MediaControlAudioMuteButtonElement* m_muteButton; 288 MediaControlVolumeSliderContainerElement* m_volumeSliderContainer; 289 MediaControlEmbeddedPanelElement* m_embeddedPanel; 290 MediaControlFullscreenButtonContainerElement* m_fullScreenButtonContainer; 291 MediaControlPlayButtonContainerElement* m_playButtonContainer; 292 MediaControlPlaceholderElement* m_placeholder; 293}; 294 295} 296 297#endif 298#endif 299