OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef MediaControls_h | 27 #ifndef MediaControls_h |
28 #define MediaControls_h | 28 #define MediaControls_h |
29 | 29 |
30 #include "core/events/MouseEvent.h" | |
31 #include "core/html/HTMLDivElement.h" | 30 #include "core/html/HTMLDivElement.h" |
32 #include "core/html/shadow/MediaControlElements.h" | 31 #include "core/html/shadow/MediaControlElements.h" |
33 #include "core/rendering/RenderTheme.h" | |
34 | 32 |
35 namespace WebCore { | 33 namespace WebCore { |
36 | 34 |
37 class Document; | 35 class Document; |
38 class Event; | 36 class Event; |
39 class MediaPlayer; | |
40 | 37 |
41 class RenderBox; | 38 class MediaControls FINAL : public HTMLDivElement { |
42 class RenderMedia; | |
43 | |
44 class MediaControls : public HTMLDivElement { | |
45 public: | 39 public: |
46 virtual ~MediaControls() {} | |
47 | |
48 static PassRefPtr<MediaControls> create(Document&); | 40 static PassRefPtr<MediaControls> create(Document&); |
49 | 41 |
50 virtual void setMediaController(MediaControllerInterface*); | 42 void setMediaController(MediaControllerInterface*); |
51 | 43 |
52 void reset(); | 44 void reset(); |
53 | 45 |
54 void show(); | 46 void show(); |
55 void hide(); | 47 void hide(); |
56 | 48 |
57 virtual void playbackStarted(); | 49 void playbackStarted(); |
58 void playbackProgressed(); | 50 void playbackProgressed(); |
59 virtual void playbackStopped(); | 51 void playbackStopped(); |
60 | 52 |
61 void updateCurrentTimeDisplay(); | 53 void updateCurrentTimeDisplay(); |
62 | 54 |
63 void changedMute(); | 55 void changedMute(); |
64 void changedVolume(); | 56 void changedVolume(); |
65 | 57 |
66 void changedClosedCaptionsVisibility(); | 58 void changedClosedCaptionsVisibility(); |
67 void refreshClosedCaptionsButtonVisibility(); | 59 void refreshClosedCaptionsButtonVisibility(); |
68 void closedCaptionTracksChanged(); | 60 void closedCaptionTracksChanged(); |
69 | 61 |
70 void enteredFullscreen(); | 62 void enteredFullscreen(); |
71 void exitedFullscreen(); | 63 void exitedFullscreen(); |
72 | 64 |
73 void updateTextTrackDisplay(); | 65 void updateTextTrackDisplay(); |
74 | 66 |
75 protected: | 67 private: |
76 explicit MediaControls(Document&); | 68 explicit MediaControls(Document&); |
77 | 69 |
78 virtual bool initializeControls(Document&); | 70 bool initializeControls(Document&); |
79 | 71 |
80 virtual bool shouldHideControls(); | |
81 | |
82 virtual void insertTextTrackContainer(PassRefPtr<MediaControlTextTrackContai
nerElement>); | |
83 | |
84 private: | |
85 void makeOpaque(); | 72 void makeOpaque(); |
86 void makeTransparent(); | 73 void makeTransparent(); |
87 | 74 |
| 75 bool shouldHideFullscreenControls(); |
88 void hideFullscreenControlsTimerFired(Timer<MediaControls>*); | 76 void hideFullscreenControlsTimerFired(Timer<MediaControls>*); |
89 void startHideFullscreenControlsTimer(); | 77 void startHideFullscreenControlsTimer(); |
90 void stopHideFullscreenControlsTimer(); | 78 void stopHideFullscreenControlsTimer(); |
91 | 79 |
92 void createTextTrackDisplay(); | 80 void createTextTrackDisplay(); |
93 void showTextTrackDisplay(); | 81 void showTextTrackDisplay(); |
94 void hideTextTrackDisplay(); | 82 void hideTextTrackDisplay(); |
95 | 83 |
96 // Node | 84 // Node |
97 virtual bool isMediaControls() const OVERRIDE FINAL { return true; } | 85 virtual bool isMediaControls() const OVERRIDE { return true; } |
98 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; } | 86 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; } |
99 virtual void defaultEventHandler(Event*) OVERRIDE; | 87 virtual void defaultEventHandler(Event*) OVERRIDE; |
100 bool containsRelatedTarget(Event*); | 88 bool containsRelatedTarget(Event*); |
101 | 89 |
102 // Element | 90 // Element |
103 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 91 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
104 | 92 |
105 MediaControllerInterface* m_mediaController; | 93 MediaControllerInterface* m_mediaController; |
106 | 94 |
107 // Container for the media control elements. | 95 // Container for the media control elements. |
108 MediaControlPanelElement* m_panel; | 96 MediaControlPanelElement* m_panel; |
109 | 97 |
110 // Container for the text track cues. | 98 // Container for the text track cues. |
111 MediaControlTextTrackContainerElement* m_textDisplayContainer; | 99 MediaControlTextTrackContainerElement* m_textDisplayContainer; |
112 | 100 |
113 // Media control elements. | 101 // Media control elements. |
| 102 MediaControlOverlayPlayButtonElement* m_overlayPlayButton; |
| 103 MediaControlOverlayEnclosureElement* m_overlayEnclosure; |
114 MediaControlPlayButtonElement* m_playButton; | 104 MediaControlPlayButtonElement* m_playButton; |
115 MediaControlCurrentTimeDisplayElement* m_currentTimeDisplay; | 105 MediaControlCurrentTimeDisplayElement* m_currentTimeDisplay; |
116 MediaControlTimelineElement* m_timeline; | 106 MediaControlTimelineElement* m_timeline; |
117 MediaControlMuteButtonElement* m_muteButton; | 107 MediaControlMuteButtonElement* m_muteButton; |
118 MediaControlVolumeSliderElement* m_volumeSlider; | 108 MediaControlVolumeSliderElement* m_volumeSlider; |
119 MediaControlToggleClosedCaptionsButtonElement* m_toggleClosedCaptionsButton; | 109 MediaControlToggleClosedCaptionsButtonElement* m_toggleClosedCaptionsButton; |
120 MediaControlFullscreenButtonElement* m_fullScreenButton; | 110 MediaControlFullscreenButtonElement* m_fullScreenButton; |
121 MediaControlTimeRemainingDisplayElement* m_durationDisplay; | 111 MediaControlTimeRemainingDisplayElement* m_durationDisplay; |
122 MediaControlPanelEnclosureElement* m_enclosure; | 112 MediaControlPanelEnclosureElement* m_enclosure; |
123 | 113 |
124 Timer<MediaControls> m_hideFullscreenControlsTimer; | 114 Timer<MediaControls> m_hideFullscreenControlsTimer; |
125 bool m_isFullscreen; | 115 bool m_isFullscreen; |
126 bool m_isMouseOverControls; | 116 bool m_isMouseOverControls; |
127 }; | 117 }; |
128 | 118 |
129 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); | 119 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); |
130 | 120 |
131 } | 121 } |
132 | 122 |
133 #endif | 123 #endif |
OLD | NEW |