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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp

Issue 2813103006: Media Controls: move last buttons to modules/. (Closed)
Patch Set: Created 3 years, 8 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) 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
(...skipping 28 matching lines...) Expand all
39 #include "core/html/HTMLMediaElement.h" 39 #include "core/html/HTMLMediaElement.h"
40 #include "core/html/HTMLVideoElement.h" 40 #include "core/html/HTMLVideoElement.h"
41 #include "core/html/media/HTMLMediaElementControlsList.h" 41 #include "core/html/media/HTMLMediaElementControlsList.h"
42 #include "core/html/track/TextTrackContainer.h" 42 #include "core/html/track/TextTrackContainer.h"
43 #include "core/html/track/TextTrackList.h" 43 #include "core/html/track/TextTrackList.h"
44 #include "core/layout/LayoutObject.h" 44 #include "core/layout/LayoutObject.h"
45 #include "core/layout/LayoutTheme.h" 45 #include "core/layout/LayoutTheme.h"
46 #include "modules/media_controls/MediaControlsMediaEventListener.h" 46 #include "modules/media_controls/MediaControlsMediaEventListener.h"
47 #include "modules/media_controls/MediaControlsOrientationLockDelegate.h" 47 #include "modules/media_controls/MediaControlsOrientationLockDelegate.h"
48 #include "modules/media_controls/MediaControlsWindowEventListener.h" 48 #include "modules/media_controls/MediaControlsWindowEventListener.h"
49 #include "modules/media_controls/elements/MediaControlCastButtonElement.h"
49 #include "modules/media_controls/elements/MediaControlCurrentTimeDisplayElement. h" 50 #include "modules/media_controls/elements/MediaControlCurrentTimeDisplayElement. h"
51 #include "modules/media_controls/elements/MediaControlDownloadButtonElement.h"
50 #include "modules/media_controls/elements/MediaControlFullscreenButtonElement.h" 52 #include "modules/media_controls/elements/MediaControlFullscreenButtonElement.h"
51 #include "modules/media_controls/elements/MediaControlMuteButtonElement.h" 53 #include "modules/media_controls/elements/MediaControlMuteButtonElement.h"
52 #include "modules/media_controls/elements/MediaControlOverflowMenuButtonElement. h" 54 #include "modules/media_controls/elements/MediaControlOverflowMenuButtonElement. h"
53 #include "modules/media_controls/elements/MediaControlOverflowMenuListElement.h" 55 #include "modules/media_controls/elements/MediaControlOverflowMenuListElement.h"
54 #include "modules/media_controls/elements/MediaControlOverlayEnclosureElement.h" 56 #include "modules/media_controls/elements/MediaControlOverlayEnclosureElement.h"
55 #include "modules/media_controls/elements/MediaControlOverlayPlayButtonElement.h " 57 #include "modules/media_controls/elements/MediaControlOverlayPlayButtonElement.h "
56 #include "modules/media_controls/elements/MediaControlPanelElement.h" 58 #include "modules/media_controls/elements/MediaControlPanelElement.h"
57 #include "modules/media_controls/elements/MediaControlPanelEnclosureElement.h" 59 #include "modules/media_controls/elements/MediaControlPanelEnclosureElement.h"
58 #include "modules/media_controls/elements/MediaControlPlayButtonElement.h" 60 #include "modules/media_controls/elements/MediaControlPlayButtonElement.h"
59 #include "modules/media_controls/elements/MediaControlRemainingTimeDisplayElemen t.h" 61 #include "modules/media_controls/elements/MediaControlRemainingTimeDisplayElemen t.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // +-MediaControlTextTrackListItemSubtitles 309 // +-MediaControlTextTrackListItemSubtitles
308 // (-internal-media-controls-text-track-list-kind-subtitles) 310 // (-internal-media-controls-text-track-list-kind-subtitles)
309 void MediaControlsImpl::InitializeControls() { 311 void MediaControlsImpl::InitializeControls() {
310 overlay_enclosure_ = new MediaControlOverlayEnclosureElement(*this); 312 overlay_enclosure_ = new MediaControlOverlayEnclosureElement(*this);
311 313
312 if (RuntimeEnabledFeatures::mediaControlsOverlayPlayButtonEnabled()) { 314 if (RuntimeEnabledFeatures::mediaControlsOverlayPlayButtonEnabled()) {
313 overlay_play_button_ = new MediaControlOverlayPlayButtonElement(*this); 315 overlay_play_button_ = new MediaControlOverlayPlayButtonElement(*this);
314 overlay_enclosure_->AppendChild(overlay_play_button_); 316 overlay_enclosure_->AppendChild(overlay_play_button_);
315 } 317 }
316 318
317 MediaControlCastButtonElement* overlay_cast_button = 319 overlay_cast_button_ = new MediaControlCastButtonElement(*this, true);
318 MediaControlCastButtonElement::Create(*this, true); 320 overlay_enclosure_->AppendChild(overlay_cast_button_);
319 overlay_cast_button_ = overlay_cast_button;
320 overlay_enclosure_->AppendChild(overlay_cast_button);
321 321
322 AppendChild(overlay_enclosure_); 322 AppendChild(overlay_enclosure_);
323 323
324 // Create an enclosing element for the panel so we can visually offset the 324 // Create an enclosing element for the panel so we can visually offset the
325 // controls correctly. 325 // controls correctly.
326 enclosure_ = new MediaControlPanelEnclosureElement(*this); 326 enclosure_ = new MediaControlPanelEnclosureElement(*this);
327 327
328 panel_ = new MediaControlPanelElement(*this); 328 panel_ = new MediaControlPanelElement(*this);
329 329
330 play_button_ = new MediaControlPlayButtonElement(*this); 330 play_button_ = new MediaControlPlayButtonElement(*this);
(...skipping 17 matching lines...) Expand all
348 MediaControlVolumeSliderElement* slider = 348 MediaControlVolumeSliderElement* slider =
349 MediaControlVolumeSliderElement::Create(*this); 349 MediaControlVolumeSliderElement::Create(*this);
350 volume_slider_ = slider; 350 volume_slider_ = slider;
351 panel_->AppendChild(slider); 351 panel_->AppendChild(slider);
352 if (PreferHiddenVolumeControls(GetDocument())) 352 if (PreferHiddenVolumeControls(GetDocument()))
353 volume_slider_->SetIsWanted(false); 353 volume_slider_->SetIsWanted(false);
354 354
355 fullscreen_button_ = new MediaControlFullscreenButtonElement(*this); 355 fullscreen_button_ = new MediaControlFullscreenButtonElement(*this);
356 panel_->AppendChild(fullscreen_button_); 356 panel_->AppendChild(fullscreen_button_);
357 357
358 MediaControlDownloadButtonElement* download_button = 358 download_button_ = new MediaControlDownloadButtonElement(*this);
359 MediaControlDownloadButtonElement::Create(*this); 359 panel_->AppendChild(download_button_);
360 download_button_ = download_button;
361 panel_->AppendChild(download_button);
362 360
363 MediaControlCastButtonElement* cast_button = 361 cast_button_ = new MediaControlCastButtonElement(*this, false);
364 MediaControlCastButtonElement::Create(*this, false); 362 panel_->AppendChild(cast_button_);
365 cast_button_ = cast_button;
366 panel_->AppendChild(cast_button);
367 363
368 toggle_closed_captions_button_ = 364 toggle_closed_captions_button_ =
369 new MediaControlToggleClosedCaptionsButtonElement(*this); 365 new MediaControlToggleClosedCaptionsButtonElement(*this);
370 panel_->AppendChild(toggle_closed_captions_button_); 366 panel_->AppendChild(toggle_closed_captions_button_);
371 367
372 enclosure_->AppendChild(panel_); 368 enclosure_->AppendChild(panel_);
373 369
374 AppendChild(enclosure_); 370 AppendChild(enclosure_);
375 371
376 text_track_list_ = new MediaControlTextTrackListElement(*this); 372 text_track_list_ = new MediaControlTextTrackListElement(*this);
377 AppendChild(text_track_list_); 373 AppendChild(text_track_list_);
378 374
379 overflow_menu_ = new MediaControlOverflowMenuButtonElement(*this); 375 overflow_menu_ = new MediaControlOverflowMenuButtonElement(*this);
380 panel_->AppendChild(overflow_menu_); 376 panel_->AppendChild(overflow_menu_);
381 377
382 overflow_list_ = new MediaControlOverflowMenuListElement(*this); 378 overflow_list_ = new MediaControlOverflowMenuListElement(*this);
383 AppendChild(overflow_list_); 379 AppendChild(overflow_list_);
384 380
385 // The order in which we append elements to the overflow list is significant 381 // The order in which we append elements to the overflow list is significant
386 // because it determines how the elements show up in the overflow menu 382 // because it determines how the elements show up in the overflow menu
387 // relative to each other. The first item appended appears at the top of the 383 // relative to each other. The first item appended appears at the top of the
388 // overflow menu. 384 // overflow menu.
389 overflow_list_->AppendChild(play_button_->CreateOverflowElement( 385 overflow_list_->AppendChild(play_button_->CreateOverflowElement(
390 *this, new MediaControlPlayButtonElement(*this))); 386 *this, new MediaControlPlayButtonElement(*this)));
391 overflow_list_->AppendChild(fullscreen_button_->CreateOverflowElement( 387 overflow_list_->AppendChild(fullscreen_button_->CreateOverflowElement(
392 *this, new MediaControlFullscreenButtonElement(*this))); 388 *this, new MediaControlFullscreenButtonElement(*this)));
393 overflow_list_->AppendChild(download_button_->CreateOverflowElement( 389 overflow_list_->AppendChild(download_button_->CreateOverflowElement(
394 *this, MediaControlDownloadButtonElement::Create(*this))); 390 *this, new MediaControlDownloadButtonElement(*this)));
395 overflow_list_->AppendChild(mute_button_->CreateOverflowElement( 391 overflow_list_->AppendChild(mute_button_->CreateOverflowElement(
396 *this, new MediaControlMuteButtonElement(*this))); 392 *this, new MediaControlMuteButtonElement(*this)));
397 overflow_list_->AppendChild(cast_button_->CreateOverflowElement( 393 overflow_list_->AppendChild(cast_button_->CreateOverflowElement(
398 *this, MediaControlCastButtonElement::Create(*this, false))); 394 *this, new MediaControlCastButtonElement(*this, false)));
399 overflow_list_->AppendChild( 395 overflow_list_->AppendChild(
400 toggle_closed_captions_button_->CreateOverflowElement( 396 toggle_closed_captions_button_->CreateOverflowElement(
401 *this, new MediaControlToggleClosedCaptionsButtonElement(*this))); 397 *this, new MediaControlToggleClosedCaptionsButtonElement(*this)));
402 } 398 }
403 399
404 Node::InsertionNotificationRequest MediaControlsImpl::InsertedInto( 400 Node::InsertionNotificationRequest MediaControlsImpl::InsertedInto(
405 ContainerNode* root) { 401 ContainerNode* root) {
406 if (!MediaElement().isConnected()) 402 if (!MediaElement().isConnected())
407 return HTMLDivElement::InsertedInto(root); 403 return HTMLDivElement::InsertedInto(root);
408 404
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 visitor->Trace(cast_button_); 1130 visitor->Trace(cast_button_);
1135 visitor->Trace(overlay_cast_button_); 1131 visitor->Trace(overlay_cast_button_);
1136 visitor->Trace(media_event_listener_); 1132 visitor->Trace(media_event_listener_);
1137 visitor->Trace(window_event_listener_); 1133 visitor->Trace(window_event_listener_);
1138 visitor->Trace(orientation_lock_delegate_); 1134 visitor->Trace(orientation_lock_delegate_);
1139 MediaControls::Trace(visitor); 1135 MediaControls::Trace(visitor);
1140 HTMLDivElement::Trace(visitor); 1136 HTMLDivElement::Trace(visitor);
1141 } 1137 }
1142 1138
1143 } // namespace blink 1139 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698