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

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

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 // When we get a mouse move, show the media controls, and start a timer 599 // When we get a mouse move, show the media controls, and start a timer
600 // that will hide the media controls after a 3 seconds without a mouse m ove. 600 // that will hide the media controls after a 3 seconds without a mouse m ove.
601 makeOpaque(); 601 makeOpaque();
602 refreshCastButtonVisibility(); 602 refreshCastButtonVisibility();
603 if (shouldHideMediaControls(IgnoreVideoHover)) 603 if (shouldHideMediaControls(IgnoreVideoHover))
604 startHideMediaControlsTimer(); 604 startHideMediaControlsTimer();
605 return; 605 return;
606 } 606 }
607 } 607 }
608 608
609 void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) 609 void MediaControls::hideMediaControlsTimerFired(TimerBase*)
610 { 610 {
611 unsigned behaviorFlags = m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVide oHover; 611 unsigned behaviorFlags = m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVide oHover;
612 m_hideTimerBehaviorFlags = IgnoreNone; 612 m_hideTimerBehaviorFlags = IgnoreNone;
613 613
614 if (mediaElement().paused()) 614 if (mediaElement().paused())
615 return; 615 return;
616 616
617 if (!shouldHideMediaControls(behaviorFlags)) 617 if (!shouldHideMediaControls(behaviorFlags))
618 return; 618 return;
619 619
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 m_panelWidth = panelWidth; 665 m_panelWidth = panelWidth;
666 666
667 // Adjust for effective zoom. 667 // Adjust for effective zoom.
668 if (!m_panel->layoutObject() || !m_panel->layoutObject()->style()) 668 if (!m_panel->layoutObject() || !m_panel->layoutObject()->style())
669 return; 669 return;
670 m_panelWidth = ceil(m_panelWidth / m_panel->layoutObject()->style()->effecti veZoom()); 670 m_panelWidth = ceil(m_panelWidth / m_panel->layoutObject()->style()->effecti veZoom());
671 671
672 m_panelWidthChangedTimer.startOneShot(0, BLINK_FROM_HERE); 672 m_panelWidthChangedTimer.startOneShot(0, BLINK_FROM_HERE);
673 } 673 }
674 674
675 void MediaControls::panelWidthChangedTimerFired(Timer<MediaControls>*) 675 void MediaControls::panelWidthChangedTimerFired(TimerBase*)
676 { 676 {
677 computeWhichControlsFit(); 677 computeWhichControlsFit();
678 } 678 }
679 679
680 void MediaControls::computeWhichControlsFit() 680 void MediaControls::computeWhichControlsFit()
681 { 681 {
682 // Hide all controls that don't fit, and show the ones that do. 682 // Hide all controls that don't fit, and show the ones that do.
683 // This might be better suited for a layout, but since JS media controls 683 // This might be better suited for a layout, but since JS media controls
684 // won't benefit from that anwyay, we just do it here like JS will. 684 // won't benefit from that anwyay, we just do it here like JS will.
685 685
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 visitor->trace(m_fullScreenButton); 797 visitor->trace(m_fullScreenButton);
798 visitor->trace(m_durationDisplay); 798 visitor->trace(m_durationDisplay);
799 visitor->trace(m_enclosure); 799 visitor->trace(m_enclosure);
800 visitor->trace(m_textTrackList); 800 visitor->trace(m_textTrackList);
801 visitor->trace(m_castButton); 801 visitor->trace(m_castButton);
802 visitor->trace(m_overlayCastButton); 802 visitor->trace(m_overlayCastButton);
803 HTMLDivElement::trace(visitor); 803 HTMLDivElement::trace(visitor);
804 } 804 }
805 805
806 } // namespace blink 806 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698