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

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 2592443002: Media Controls: use events to enter/exit fullscreen. (Closed)
Patch Set: rebase Created 3 years, 12 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 updateCurrentTimeDisplay(); 348 updateCurrentTimeDisplay();
349 349
350 m_timeline->setDuration(duration); 350 m_timeline->setDuration(duration);
351 m_timeline->setPosition(mediaElement().currentTime()); 351 m_timeline->setPosition(mediaElement().currentTime());
352 352
353 onVolumeChange(); 353 onVolumeChange();
354 onTextTracksAddedOrRemoved(); 354 onTextTracksAddedOrRemoved();
355 355
356 m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); 356 m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement()));
357 m_fullscreenButton->setIsFullscreen(mediaElement().isFullscreen());
357 358
358 refreshCastButtonVisibilityWithoutUpdate(); 359 refreshCastButtonVisibilityWithoutUpdate();
359 360
360 m_downloadButton->setIsWanted( 361 m_downloadButton->setIsWanted(
361 m_downloadButton->shouldDisplayDownloadButton()); 362 m_downloadButton->shouldDisplayDownloadButton());
362 } 363 }
363 364
364 LayoutObject* MediaControls::layoutObjectForTextTrackLayout() { 365 LayoutObject* MediaControls::layoutObjectForTextTrackLayout() {
365 return m_panel->layoutObject(); 366 return m_panel->layoutObject();
366 } 367 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } 543 }
543 544
544 void MediaControls::enterFullscreen() { 545 void MediaControls::enterFullscreen() {
545 Fullscreen::requestFullscreen(mediaElement()); 546 Fullscreen::requestFullscreen(mediaElement());
546 } 547 }
547 548
548 void MediaControls::exitFullscreen() { 549 void MediaControls::exitFullscreen() {
549 Fullscreen::exitFullscreen(document()); 550 Fullscreen::exitFullscreen(document());
550 } 551 }
551 552
552 void MediaControls::enteredFullscreen() {
553 m_fullscreenButton->setIsFullscreen(true);
554 stopHideMediaControlsTimer();
555 startHideMediaControlsTimer();
556 }
557
558 void MediaControls::exitedFullscreen() {
559 m_fullscreenButton->setIsFullscreen(false);
560 stopHideMediaControlsTimer();
561 startHideMediaControlsTimer();
562 }
563
564 void MediaControls::startedCasting() { 553 void MediaControls::startedCasting() {
565 m_castButton->setIsPlayingRemotely(true); 554 m_castButton->setIsPlayingRemotely(true);
566 m_overlayCastButton->setIsPlayingRemotely(true); 555 m_overlayCastButton->setIsPlayingRemotely(true);
567 } 556 }
568 557
569 void MediaControls::stoppedCasting() { 558 void MediaControls::stoppedCasting() {
570 m_castButton->setIsPlayingRemotely(false); 559 m_castButton->setIsPlayingRemotely(false);
571 m_overlayCastButton->setIsPlayingRemotely(false); 560 m_overlayCastButton->setIsPlayingRemotely(false);
572 } 561 }
573 562
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 // to be changed. 742 // to be changed.
754 reset(); 743 reset();
755 } 744 }
756 745
757 void MediaControls::onLoadedMetadata() { 746 void MediaControls::onLoadedMetadata() {
758 // TODO(mlamouri): we should only change the aspects of the control that need 747 // TODO(mlamouri): we should only change the aspects of the control that need
759 // to be changed. 748 // to be changed.
760 reset(); 749 reset();
761 } 750 }
762 751
752 void MediaControls::onEnteredFullscreen() {
753 m_fullscreenButton->setIsFullscreen(true);
754 stopHideMediaControlsTimer();
755 startHideMediaControlsTimer();
756 }
757
758 void MediaControls::onExitedFullscreen() {
759 m_fullscreenButton->setIsFullscreen(false);
760 stopHideMediaControlsTimer();
761 startHideMediaControlsTimer();
762 }
763
763 void MediaControls::notifyPanelWidthChanged(const LayoutUnit& newWidth) { 764 void MediaControls::notifyPanelWidthChanged(const LayoutUnit& newWidth) {
764 // Don't bother to do any work if this matches the most recent panel 765 // Don't bother to do any work if this matches the most recent panel
765 // width, since we're called after layout. 766 // width, since we're called after layout.
766 // Note that this code permits a bad frame on resize, since it is 767 // Note that this code permits a bad frame on resize, since it is
767 // run after the relayout / paint happens. It would be great to improve 768 // run after the relayout / paint happens. It would be great to improve
768 // this, but it would be even greater to move this code entirely to 769 // this, but it would be even greater to move this code entirely to
769 // JS and fix it there. 770 // JS and fix it there.
770 m_panelWidth = newWidth.toInt(); 771 m_panelWidth = newWidth.toInt();
771 772
772 // Adjust for effective zoom. 773 // Adjust for effective zoom.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 visitor->trace(m_overflowList); 952 visitor->trace(m_overflowList);
952 visitor->trace(m_castButton); 953 visitor->trace(m_castButton);
953 visitor->trace(m_overlayCastButton); 954 visitor->trace(m_overlayCastButton);
954 visitor->trace(m_mediaEventListener); 955 visitor->trace(m_mediaEventListener);
955 visitor->trace(m_windowEventListener); 956 visitor->trace(m_windowEventListener);
956 visitor->trace(m_orientationLockDelegate); 957 visitor->trace(m_orientationLockDelegate);
957 HTMLDivElement::trace(visitor); 958 HTMLDivElement::trace(visitor);
958 } 959 }
959 960
960 } // namespace blink 961 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698