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

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: 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 Element* initOverflowButton(MediaControls&) override;
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 Element* initOverflowButton(MediaControls&) override;
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
whywhat 2016/08/26 20:57:26 nit: unintended delete?
kdsilva 2016/08/27 14:20:49 Done.
188 private: 233 private:
189 explicit MediaControlTimelineElement(MediaControls&); 234 explicit MediaControlTimelineElement(MediaControls&);
190 235
191 void defaultEventHandler(Event*) override; 236 void defaultEventHandler(Event*) override;
192 bool keepEventInNode(Event*) override; 237 bool keepEventInNode(Event*) override;
193 }; 238 };
194 239
195 // ---------------------------- 240 // ----------------------------
196 241
197 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t { 242 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t {
198 public: 243 public:
199 static MediaControlFullscreenButtonElement* create(MediaControls&); 244 static MediaControlFullscreenButtonElement* create(MediaControls&);
200 245
201 bool willRespondToMouseClickEvents() override { return true; } 246 bool willRespondToMouseClickEvents() override { return true; }
202 247
203 void setIsFullscreen(bool); 248 void setIsFullscreen(bool);
204 249
250 WebLocalizedString::Name getOverflowStringName() override;
251
252 bool hasOverflowButton() override { return true; }
253
254 Element* initOverflowButton(MediaControls&) override;
255
205 private: 256 private:
206 explicit MediaControlFullscreenButtonElement(MediaControls&); 257 explicit MediaControlFullscreenButtonElement(MediaControls&);
207 258
208 void defaultEventHandler(Event*) override; 259 void defaultEventHandler(Event*) override;
209 }; 260 };
210 261
211 // ---------------------------- 262 // ----------------------------
212 263
213 class MediaControlCastButtonElement final : public MediaControlInputElement { 264 class MediaControlCastButtonElement final : public MediaControlInputElement {
214 public: 265 public:
215 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); 266 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton);
216 267
217 bool willRespondToMouseClickEvents() override { return true; } 268 bool willRespondToMouseClickEvents() override { return true; }
218 269
219 void setIsPlayingRemotely(bool); 270 void setIsPlayingRemotely(bool);
220 271
272 WebLocalizedString::Name getOverflowStringName() override;
273
274 bool hasOverflowButton() override { return true; }
275
276 Element* initOverflowButton(MediaControls&) override;
277
221 // This will show a cast button if it is not covered by another element. 278 // 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. 279 // This MUST be called for cast button elements that are overlay elements.
223 void tryShowOverlay(); 280 void tryShowOverlay();
224 281
225 private: 282 private:
226 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; 283 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ;
227 284
228 const AtomicString& shadowPseudoId() const override; 285 const AtomicString& shadowPseudoId() const override;
229 void defaultEventHandler(Event*) override; 286 void defaultEventHandler(Event*) override;
230 bool keepEventInNode(Event*) override; 287 bool keepEventInNode(Event*) override;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 public: 337 public:
281 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); 338 static MediaControlCurrentTimeDisplayElement* create(MediaControls&);
282 339
283 private: 340 private:
284 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); 341 explicit MediaControlCurrentTimeDisplayElement(MediaControls&);
285 }; 342 };
286 343
287 } // namespace blink 344 } // namespace blink
288 345
289 #endif // MediaControlElements_h 346 #endif // MediaControlElements_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698