OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 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 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 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 | 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 | 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. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #ifndef MediaControlElements_h | 30 #ifndef MediaControlElements_h |
31 #define MediaControlElements_h | 31 #define MediaControlElements_h |
32 | 32 |
33 #include "core/html/shadow/MediaControlElementTypes.h" | 33 #include "core/html/shadow/MediaControlElementTypes.h" |
| 34 #include "public/platform/WebLocalizedString.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class TextTrack; | 38 class TextTrack; |
38 | 39 |
39 // ---------------------------- | 40 // ---------------------------- |
40 | 41 |
41 class MediaControlPanelElement final : public MediaControlDivElement { | 42 class MediaControlPanelElement final : public MediaControlDivElement { |
42 public: | 43 public: |
43 static MediaControlPanelElement* create(MediaControls&); | 44 static MediaControlPanelElement* create(MediaControls&); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 88 |
88 // ---------------------------- | 89 // ---------------------------- |
89 | 90 |
90 class MediaControlMuteButtonElement final : public MediaControlInputElement { | 91 class MediaControlMuteButtonElement final : public MediaControlInputElement { |
91 public: | 92 public: |
92 static MediaControlMuteButtonElement* create(MediaControls&); | 93 static MediaControlMuteButtonElement* create(MediaControls&); |
93 | 94 |
94 bool willRespondToMouseClickEvents() override { return true; } | 95 bool willRespondToMouseClickEvents() override { return true; } |
95 void updateDisplayType() override; | 96 void updateDisplayType() override; |
96 | 97 |
| 98 WebLocalizedString::Name getOverflowStringName() override; |
| 99 |
| 100 bool hasOverflowButton() override { return true; } |
| 101 |
97 private: | 102 private: |
98 explicit MediaControlMuteButtonElement(MediaControls&); | 103 explicit MediaControlMuteButtonElement(MediaControls&); |
99 | 104 |
100 void defaultEventHandler(Event*) override; | 105 void defaultEventHandler(Event*) override; |
101 }; | 106 }; |
102 | 107 |
103 // ---------------------------- | 108 // ---------------------------- |
104 | 109 |
105 class MediaControlPlayButtonElement final : public MediaControlInputElement { | 110 class MediaControlPlayButtonElement final : public MediaControlInputElement { |
106 public: | 111 public: |
107 static MediaControlPlayButtonElement* create(MediaControls&); | 112 static MediaControlPlayButtonElement* create(MediaControls&); |
108 | 113 |
109 bool willRespondToMouseClickEvents() override { return true; } | 114 bool willRespondToMouseClickEvents() override { return true; } |
110 void updateDisplayType() override; | 115 void updateDisplayType() override; |
111 | 116 |
| 117 WebLocalizedString::Name getOverflowStringName() override; |
| 118 |
| 119 bool hasOverflowButton() override { return true; } |
| 120 |
112 private: | 121 private: |
113 explicit MediaControlPlayButtonElement(MediaControls&); | 122 explicit MediaControlPlayButtonElement(MediaControls&); |
114 | 123 |
115 void defaultEventHandler(Event*) override; | 124 void defaultEventHandler(Event*) override; |
116 }; | 125 }; |
117 | 126 |
118 // ---------------------------- | 127 // ---------------------------- |
119 | 128 |
120 class MediaControlOverlayPlayButtonElement final : public MediaControlInputEleme
nt { | 129 class MediaControlOverlayPlayButtonElement final : public MediaControlInputEleme
nt { |
121 public: | 130 public: |
(...skipping 11 matching lines...) Expand all Loading... |
133 // ---------------------------- | 142 // ---------------------------- |
134 | 143 |
135 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI
nputElement { | 144 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI
nputElement { |
136 public: | 145 public: |
137 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&)
; | 146 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&)
; |
138 | 147 |
139 bool willRespondToMouseClickEvents() override { return true; } | 148 bool willRespondToMouseClickEvents() override { return true; } |
140 | 149 |
141 void updateDisplayType() override; | 150 void updateDisplayType() override; |
142 | 151 |
| 152 WebLocalizedString::Name getOverflowStringName() override; |
| 153 |
| 154 bool hasOverflowButton() override { return true; } |
| 155 |
143 private: | 156 private: |
144 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); | 157 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); |
145 | 158 |
146 void defaultEventHandler(Event*) override; | 159 void defaultEventHandler(Event*) override; |
147 }; | 160 }; |
148 | 161 |
149 // ---------------------------- | 162 // ---------------------------- |
150 | 163 |
151 class MediaControlTextTrackListElement final : public MediaControlDivElement { | 164 class MediaControlTextTrackListElement final : public MediaControlDivElement { |
152 public: | 165 public: |
(...skipping 13 matching lines...) Expand all Loading... |
166 // Returns the label for the track when a valid track is passed in and "Off"
when the parameter is null. | 179 // Returns the label for the track when a valid track is passed in and "Off"
when the parameter is null. |
167 String getTextTrackLabel(TextTrack*); | 180 String getTextTrackLabel(TextTrack*); |
168 // Creates the track element in the list when a valid track is passed in and
the "Off" item when the parameter is null. | 181 // Creates the track element in the list when a valid track is passed in and
the "Off" item when the parameter is null. |
169 Element* createTextTrackListItem(TextTrack*); | 182 Element* createTextTrackListItem(TextTrack*); |
170 | 183 |
171 void showTextTrackAtIndex(unsigned); | 184 void showTextTrackAtIndex(unsigned); |
172 void disableShowingTextTracks(); | 185 void disableShowingTextTracks(); |
173 }; | 186 }; |
174 | 187 |
175 // ---------------------------- | 188 // ---------------------------- |
| 189 // Represents the overflow menu which is displayed when the width of the media |
| 190 // player is small enough that at least two buttons are no longer visible. |
| 191 class MediaControlOverflowMenuButtonElement final : public MediaControlInputElem
ent { |
| 192 public: |
| 193 static MediaControlOverflowMenuButtonElement* create(MediaControls&); |
| 194 |
| 195 // The overflow button should respond to mouse clicks since we want a click |
| 196 // to open up the menu. |
| 197 bool willRespondToMouseClickEvents() override { return true; } |
| 198 |
| 199 private: |
| 200 explicit MediaControlOverflowMenuButtonElement(MediaControls&); |
| 201 |
| 202 void defaultEventHandler(Event*) override; |
| 203 }; |
| 204 |
| 205 // ---------------------------- |
| 206 // Holds a list of elements within the overflow menu. |
| 207 class MediaControlOverflowMenuListElement final : public MediaControlDivElement
{ |
| 208 public: |
| 209 static MediaControlOverflowMenuListElement* create(MediaControls&); |
| 210 |
| 211 private: |
| 212 explicit MediaControlOverflowMenuListElement(MediaControls&); |
| 213 |
| 214 void defaultEventHandler(Event*) override; |
| 215 }; |
| 216 |
| 217 // ---------------------------- |
176 | 218 |
177 class MediaControlTimelineElement final : public MediaControlInputElement { | 219 class MediaControlTimelineElement final : public MediaControlInputElement { |
178 public: | 220 public: |
179 static MediaControlTimelineElement* create(MediaControls&); | 221 static MediaControlTimelineElement* create(MediaControls&); |
180 | 222 |
181 bool willRespondToMouseClickEvents() override; | 223 bool willRespondToMouseClickEvents() override; |
182 | 224 |
183 // FIXME: An "earliest possible position" will be needed once that concept | 225 // FIXME: An "earliest possible position" will be needed once that concept |
184 // is supported by HTMLMediaElement, see https://crbug.com/137275 | 226 // is supported by HTMLMediaElement, see https://crbug.com/137275 |
185 void setPosition(double); | 227 void setPosition(double); |
186 void setDuration(double); | 228 void setDuration(double); |
187 | 229 |
188 private: | 230 private: |
189 explicit MediaControlTimelineElement(MediaControls&); | 231 explicit MediaControlTimelineElement(MediaControls&); |
190 | 232 |
191 void defaultEventHandler(Event*) override; | 233 void defaultEventHandler(Event*) override; |
192 bool keepEventInNode(Event*) override; | 234 bool keepEventInNode(Event*) override; |
193 }; | 235 }; |
194 | 236 |
195 // ---------------------------- | 237 // ---------------------------- |
196 | 238 |
197 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen
t { | 239 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen
t { |
198 public: | 240 public: |
199 static MediaControlFullscreenButtonElement* create(MediaControls&); | 241 static MediaControlFullscreenButtonElement* create(MediaControls&); |
200 | 242 |
201 bool willRespondToMouseClickEvents() override { return true; } | 243 bool willRespondToMouseClickEvents() override { return true; } |
202 | 244 |
203 void setIsFullscreen(bool); | 245 void setIsFullscreen(bool); |
204 | 246 |
| 247 WebLocalizedString::Name getOverflowStringName() override; |
| 248 |
| 249 bool hasOverflowButton() override { return true; } |
| 250 |
205 private: | 251 private: |
206 explicit MediaControlFullscreenButtonElement(MediaControls&); | 252 explicit MediaControlFullscreenButtonElement(MediaControls&); |
207 | 253 |
208 void defaultEventHandler(Event*) override; | 254 void defaultEventHandler(Event*) override; |
209 }; | 255 }; |
210 | 256 |
211 // ---------------------------- | 257 // ---------------------------- |
212 | 258 |
213 class MediaControlCastButtonElement final : public MediaControlInputElement { | 259 class MediaControlCastButtonElement final : public MediaControlInputElement { |
214 public: | 260 public: |
215 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB
utton); | 261 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB
utton); |
216 | 262 |
217 bool willRespondToMouseClickEvents() override { return true; } | 263 bool willRespondToMouseClickEvents() override { return true; } |
218 | 264 |
219 void setIsPlayingRemotely(bool); | 265 void setIsPlayingRemotely(bool); |
220 | 266 |
| 267 WebLocalizedString::Name getOverflowStringName() override; |
| 268 |
| 269 bool hasOverflowButton() override { return true; } |
| 270 |
221 // This will show a cast button if it is not covered by another element. | 271 // This will show a cast button if it is not covered by another element. |
222 // This MUST be called for cast button elements that are overlay elements. | 272 // This MUST be called for cast button elements that are overlay elements. |
223 void tryShowOverlay(); | 273 void tryShowOverlay(); |
224 | 274 |
225 private: | 275 private: |
226 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton)
; | 276 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton)
; |
227 | 277 |
228 const AtomicString& shadowPseudoId() const override; | 278 const AtomicString& shadowPseudoId() const override; |
229 void defaultEventHandler(Event*) override; | 279 void defaultEventHandler(Event*) override; |
230 bool keepEventInNode(Event*) override; | 280 bool keepEventInNode(Event*) override; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 public: | 330 public: |
281 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); | 331 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); |
282 | 332 |
283 private: | 333 private: |
284 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); | 334 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); |
285 }; | 335 }; |
286 | 336 |
287 } // namespace blink | 337 } // namespace blink |
288 | 338 |
289 #endif // MediaControlElements_h | 339 #endif // MediaControlElements_h |
OLD | NEW |