Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControlElements.h

Issue 2243473002: Adding overflow menu to media player (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added more tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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>
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
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
103 MediaControlInputElement* createOverflowButton(MediaControls&);
mlamouri (slow - plz ping) 2016/09/01 18:29:15 Do you actually need this? I can't find where it i
kdsilva 2016/09/05 14:39:35 Done.
104
97 private: 105 private:
98 explicit MediaControlMuteButtonElement(MediaControls&); 106 explicit MediaControlMuteButtonElement(MediaControls&);
99 107
100 void defaultEventHandler(Event*) override; 108 void defaultEventHandler(Event*) override;
101 }; 109 };
102 110
103 // ---------------------------- 111 // ----------------------------
104 112
105 class MediaControlPlayButtonElement final : public MediaControlInputElement { 113 class MediaControlPlayButtonElement final : public MediaControlInputElement {
106 public: 114 public:
(...skipping 26 matching lines...) Expand all
133 // ---------------------------- 141 // ----------------------------
134 142
135 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI nputElement { 143 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI nputElement {
136 public: 144 public:
137 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&) ; 145 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&) ;
138 146
139 bool willRespondToMouseClickEvents() override { return true; } 147 bool willRespondToMouseClickEvents() override { return true; }
140 148
141 void updateDisplayType() override; 149 void updateDisplayType() override;
142 150
151 WebLocalizedString::Name getOverflowStringName() override;
152
153 bool hasOverflowButton() override { return true; }
154
155 MediaControlInputElement* createOverflowButton(MediaControls&);
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
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
255 MediaControlInputElement* createOverflowButton(MediaControls&);
256
205 private: 257 private:
206 explicit MediaControlFullscreenButtonElement(MediaControls&); 258 explicit MediaControlFullscreenButtonElement(MediaControls&);
207 259
208 void defaultEventHandler(Event*) override; 260 void defaultEventHandler(Event*) override;
209 }; 261 };
210 262
211 // ---------------------------- 263 // ----------------------------
212 264
213 class MediaControlCastButtonElement final : public MediaControlInputElement { 265 class MediaControlCastButtonElement final : public MediaControlInputElement {
214 public: 266 public:
215 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); 267 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton);
216 268
217 bool willRespondToMouseClickEvents() override { return true; } 269 bool willRespondToMouseClickEvents() override { return true; }
218 270
219 void setIsPlayingRemotely(bool); 271 void setIsPlayingRemotely(bool);
220 272
273 WebLocalizedString::Name getOverflowStringName() override;
274
275 bool hasOverflowButton() override { return true; }
276
277 MediaControlInputElement* createOverflowButton(MediaControls&);
278
221 // This will show a cast button if it is not covered by another element. 279 // 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. 280 // This MUST be called for cast button elements that are overlay elements.
223 void tryShowOverlay(); 281 void tryShowOverlay();
224 282
225 private: 283 private:
226 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; 284 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ;
227 285
228 const AtomicString& shadowPseudoId() const override; 286 const AtomicString& shadowPseudoId() const override;
229 void defaultEventHandler(Event*) override; 287 void defaultEventHandler(Event*) override;
230 bool keepEventInNode(Event*) override; 288 bool keepEventInNode(Event*) override;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 public: 338 public:
281 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); 339 static MediaControlCurrentTimeDisplayElement* create(MediaControls&);
282 340
283 private: 341 private:
284 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); 342 explicit MediaControlCurrentTimeDisplayElement(MediaControls&);
285 }; 343 };
286 344
287 } // namespace blink 345 } // namespace blink
288 346
289 #endif // MediaControlElements_h 347 #endif // MediaControlElements_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698