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" | |
35 #include <set> | |
mlamouri (slow - plz ping)
2016/09/06 10:25:45
Is this #include a leftover from previous iteratio
kdsilva
2016/09/06 17:32:46
Done. Looks like that rebase unintendedly added in
| |
34 | 36 |
35 namespace blink { | 37 namespace blink { |
36 | 38 |
37 class TextTrack; | 39 class TextTrack; |
38 | 40 |
39 // ---------------------------- | 41 // ---------------------------- |
40 | 42 |
41 class MediaControlPanelElement final : public MediaControlDivElement { | 43 class MediaControlPanelElement final : public MediaControlDivElement { |
42 public: | 44 public: |
43 static MediaControlPanelElement* create(MediaControls&); | 45 static MediaControlPanelElement* create(MediaControls&); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 | 89 |
88 // ---------------------------- | 90 // ---------------------------- |
89 | 91 |
90 class MediaControlMuteButtonElement final : public MediaControlInputElement { | 92 class MediaControlMuteButtonElement final : public MediaControlInputElement { |
91 public: | 93 public: |
92 static MediaControlMuteButtonElement* create(MediaControls&); | 94 static MediaControlMuteButtonElement* create(MediaControls&); |
93 | 95 |
94 bool willRespondToMouseClickEvents() override { return true; } | 96 bool willRespondToMouseClickEvents() override { return true; } |
95 void updateDisplayType() override; | 97 void updateDisplayType() override; |
96 | 98 |
99 WebLocalizedString::Name getOverflowStringName() override; | |
100 | |
101 bool hasOverflowButton() override { return true; } | |
102 | |
97 private: | 103 private: |
98 explicit MediaControlMuteButtonElement(MediaControls&); | 104 explicit MediaControlMuteButtonElement(MediaControls&); |
99 | 105 |
100 void defaultEventHandler(Event*) override; | 106 void defaultEventHandler(Event*) override; |
101 }; | 107 }; |
102 | 108 |
103 // ---------------------------- | 109 // ---------------------------- |
104 | 110 |
105 class MediaControlPlayButtonElement final : public MediaControlInputElement { | 111 class MediaControlPlayButtonElement final : public MediaControlInputElement { |
106 public: | 112 public: |
107 static MediaControlPlayButtonElement* create(MediaControls&); | 113 static MediaControlPlayButtonElement* create(MediaControls&); |
108 | 114 |
109 bool willRespondToMouseClickEvents() override { return true; } | 115 bool willRespondToMouseClickEvents() override { return true; } |
110 void updateDisplayType() override; | 116 void updateDisplayType() override; |
111 | 117 |
118 WebLocalizedString::Name getOverflowStringName() override; | |
119 | |
120 bool hasOverflowButton() override { return true; } | |
121 | |
112 private: | 122 private: |
113 explicit MediaControlPlayButtonElement(MediaControls&); | 123 explicit MediaControlPlayButtonElement(MediaControls&); |
114 | 124 |
115 void defaultEventHandler(Event*) override; | 125 void defaultEventHandler(Event*) override; |
116 }; | 126 }; |
117 | 127 |
118 // ---------------------------- | 128 // ---------------------------- |
119 | 129 |
120 class MediaControlOverlayPlayButtonElement final : public MediaControlInputEleme nt { | 130 class MediaControlOverlayPlayButtonElement final : public MediaControlInputEleme nt { |
121 public: | 131 public: |
(...skipping 11 matching lines...) Expand all Loading... | |
133 // ---------------------------- | 143 // ---------------------------- |
134 | 144 |
135 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI nputElement { | 145 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI nputElement { |
136 public: | 146 public: |
137 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&) ; | 147 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&) ; |
138 | 148 |
139 bool willRespondToMouseClickEvents() override { return true; } | 149 bool willRespondToMouseClickEvents() override { return true; } |
140 | 150 |
141 void updateDisplayType() override; | 151 void updateDisplayType() override; |
142 | 152 |
153 WebLocalizedString::Name getOverflowStringName() override; | |
154 | |
155 bool hasOverflowButton() override { return true; } | |
156 | |
143 private: | 157 private: |
144 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); | 158 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); |
145 | 159 |
146 void defaultEventHandler(Event*) override; | 160 void defaultEventHandler(Event*) override; |
147 }; | 161 }; |
148 | 162 |
149 // ---------------------------- | 163 // ---------------------------- |
150 | 164 |
151 class MediaControlTextTrackListElement final : public MediaControlDivElement { | 165 class MediaControlTextTrackListElement final : public MediaControlDivElement { |
152 public: | 166 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. | 180 // Returns the label for the track when a valid track is passed in and "Off" when the parameter is null. |
167 String getTextTrackLabel(TextTrack*); | 181 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. | 182 // 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*); | 183 Element* createTextTrackListItem(TextTrack*); |
170 | 184 |
171 void showTextTrackAtIndex(unsigned); | 185 void showTextTrackAtIndex(unsigned); |
172 void disableShowingTextTracks(); | 186 void disableShowingTextTracks(); |
173 }; | 187 }; |
174 | 188 |
175 // ---------------------------- | 189 // ---------------------------- |
190 // Represents the overflow menu which is displayed when the width of the media | |
191 // player is small enough that at least two buttons are no longer visible. | |
192 class MediaControlOverflowMenuButtonElement final : public MediaControlInputElem ent { | |
193 public: | |
194 static MediaControlOverflowMenuButtonElement* create(MediaControls&); | |
195 | |
196 // The overflow button should respond to mouse clicks since we want a click | |
197 // to open up the menu. | |
198 bool willRespondToMouseClickEvents() override { return true; } | |
199 | |
200 private: | |
201 explicit MediaControlOverflowMenuButtonElement(MediaControls&); | |
202 | |
203 void defaultEventHandler(Event*) override; | |
204 }; | |
205 | |
206 // ---------------------------- | |
207 // Holds a list of elements within the overflow menu. | |
208 class MediaControlOverflowMenuListElement final : public MediaControlDivElement { | |
209 public: | |
210 static MediaControlOverflowMenuListElement* create(MediaControls&); | |
211 | |
212 // True to display overflow menu, false to hide. | |
213 void showOverflowMenu(bool); | |
214 | |
215 private: | |
216 explicit MediaControlOverflowMenuListElement(MediaControls&); | |
217 | |
218 void defaultEventHandler(Event*) override; | |
219 }; | |
220 | |
221 // ---------------------------- | |
176 | 222 |
177 class MediaControlTimelineElement final : public MediaControlInputElement { | 223 class MediaControlTimelineElement final : public MediaControlInputElement { |
178 public: | 224 public: |
179 static MediaControlTimelineElement* create(MediaControls&); | 225 static MediaControlTimelineElement* create(MediaControls&); |
180 | 226 |
181 bool willRespondToMouseClickEvents() override; | 227 bool willRespondToMouseClickEvents() override; |
182 | 228 |
183 // FIXME: An "earliest possible position" will be needed once that concept | 229 // FIXME: An "earliest possible position" will be needed once that concept |
184 // is supported by HTMLMediaElement, see https://crbug.com/137275 | 230 // is supported by HTMLMediaElement, see https://crbug.com/137275 |
185 void setPosition(double); | 231 void setPosition(double); |
186 void setDuration(double); | 232 void setDuration(double); |
187 | 233 |
188 private: | 234 private: |
189 explicit MediaControlTimelineElement(MediaControls&); | 235 explicit MediaControlTimelineElement(MediaControls&); |
190 | 236 |
191 void defaultEventHandler(Event*) override; | 237 void defaultEventHandler(Event*) override; |
192 bool keepEventInNode(Event*) override; | 238 bool keepEventInNode(Event*) override; |
193 }; | 239 }; |
194 | 240 |
195 // ---------------------------- | 241 // ---------------------------- |
196 | 242 |
197 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t { | 243 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t { |
198 public: | 244 public: |
199 static MediaControlFullscreenButtonElement* create(MediaControls&); | 245 static MediaControlFullscreenButtonElement* create(MediaControls&); |
200 | 246 |
201 bool willRespondToMouseClickEvents() override { return true; } | 247 bool willRespondToMouseClickEvents() override { return true; } |
202 | 248 |
203 void setIsFullscreen(bool); | 249 void setIsFullscreen(bool); |
204 | 250 |
251 WebLocalizedString::Name getOverflowStringName() override; | |
252 | |
253 bool hasOverflowButton() override { return true; } | |
254 | |
205 private: | 255 private: |
206 explicit MediaControlFullscreenButtonElement(MediaControls&); | 256 explicit MediaControlFullscreenButtonElement(MediaControls&); |
207 | 257 |
208 void defaultEventHandler(Event*) override; | 258 void defaultEventHandler(Event*) override; |
209 }; | 259 }; |
210 | 260 |
211 // ---------------------------- | 261 // ---------------------------- |
212 | 262 |
213 class MediaControlCastButtonElement final : public MediaControlInputElement { | 263 class MediaControlCastButtonElement final : public MediaControlInputElement { |
214 public: | 264 public: |
215 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); | 265 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); |
216 | 266 |
217 bool willRespondToMouseClickEvents() override { return true; } | 267 bool willRespondToMouseClickEvents() override { return true; } |
218 | 268 |
219 void setIsPlayingRemotely(bool); | 269 void setIsPlayingRemotely(bool); |
220 | 270 |
271 WebLocalizedString::Name getOverflowStringName() override; | |
272 | |
273 bool hasOverflowButton() override { return true; } | |
274 | |
221 // This will show a cast button if it is not covered by another element. | 275 // 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. | 276 // This MUST be called for cast button elements that are overlay elements. |
223 void tryShowOverlay(); | 277 void tryShowOverlay(); |
224 | 278 |
225 private: | 279 private: |
226 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; | 280 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; |
227 | 281 |
228 const AtomicString& shadowPseudoId() const override; | 282 const AtomicString& shadowPseudoId() const override; |
229 void defaultEventHandler(Event*) override; | 283 void defaultEventHandler(Event*) override; |
230 bool keepEventInNode(Event*) override; | 284 bool keepEventInNode(Event*) override; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 public: | 334 public: |
281 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); | 335 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); |
282 | 336 |
283 private: | 337 private: |
284 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); | 338 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); |
285 }; | 339 }; |
286 | 340 |
287 } // namespace blink | 341 } // namespace blink |
288 | 342 |
289 #endif // MediaControlElements_h | 343 #endif // MediaControlElements_h |
OLD | NEW |