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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 854833002: Rename HTMLMediaElement::createMediaControls to ensureMediaControls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after
3682 3682
3683 bool HTMLMediaElement::closedCaptionsVisible() const 3683 bool HTMLMediaElement::closedCaptionsVisible() const
3684 { 3684 {
3685 return m_closedCaptionsVisible; 3685 return m_closedCaptionsVisible;
3686 } 3686 }
3687 3687
3688 void HTMLMediaElement::updateTextTrackDisplay() 3688 void HTMLMediaElement::updateTextTrackDisplay()
3689 { 3689 {
3690 WTF_LOG(Media, "HTMLMediaElement::updateTextTrackDisplay(%p)", this); 3690 WTF_LOG(Media, "HTMLMediaElement::updateTextTrackDisplay(%p)", this);
3691 3691
3692 if (!createMediaControls()) 3692 ensureMediaControls();
3693 return;
3694
3695 mediaControls()->updateTextTrackDisplay(); 3693 mediaControls()->updateTextTrackDisplay();
3696 } 3694 }
3697 3695
3698 void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible) 3696 void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible)
3699 { 3697 {
3700 WTF_LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%p, %s)", this, b oolString(closedCaptionVisible)); 3698 WTF_LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%p, %s)", this, b oolString(closedCaptionVisible));
3701 3699
3702 if (!m_player || !hasClosedCaptions()) 3700 if (!m_player || !hasClosedCaptions())
3703 return; 3701 return;
3704 3702
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 { 3753 {
3756 if (ShadowRoot* userAgent = userAgentShadowRoot()) { 3754 if (ShadowRoot* userAgent = userAgentShadowRoot()) {
3757 Node* node = userAgent->firstChild(); 3755 Node* node = userAgent->firstChild();
3758 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); 3756 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls());
3759 return node; 3757 return node;
3760 } 3758 }
3761 3759
3762 return false; 3760 return false;
3763 } 3761 }
3764 3762
3765 bool HTMLMediaElement::createMediaControls() 3763 void HTMLMediaElement::ensureMediaControls()
3766 { 3764 {
3767 if (hasMediaControls()) 3765 if (hasMediaControls())
3768 return true; 3766 return;
3769 3767
3770 RefPtrWillBeRawPtr<MediaControls> mediaControls = MediaControls::create(*thi s); 3768 RefPtrWillBeRawPtr<MediaControls> mediaControls = MediaControls::create(*thi s);
3771 3769
3772 mediaControls->reset(); 3770 mediaControls->reset();
3773 if (isFullscreen()) 3771 if (isFullscreen())
3774 mediaControls->enteredFullscreen(); 3772 mediaControls->enteredFullscreen();
3775 3773
3776 ensureUserAgentShadowRoot().appendChild(mediaControls); 3774 ensureUserAgentShadowRoot().appendChild(mediaControls);
3777 3775
3778 if (!shouldShowControls() || !inDocument()) 3776 if (!shouldShowControls() || !inDocument())
3779 mediaControls->hide(); 3777 mediaControls->hide();
3780
3781 return true;
3782 } 3778 }
3783 3779
3784 void HTMLMediaElement::configureMediaControls() 3780 void HTMLMediaElement::configureMediaControls()
3785 { 3781 {
3786 if (!inDocument()) { 3782 if (!inDocument()) {
3787 if (hasMediaControls()) 3783 if (hasMediaControls())
3788 mediaControls()->hide(); 3784 mediaControls()->hide();
3789 return; 3785 return;
3790 } 3786 }
3791 3787
3792 if (!createMediaControls()) 3788 ensureMediaControls();
3793 return;
3794
3795 mediaControls()->reset(); 3789 mediaControls()->reset();
3796 if (shouldShowControls()) 3790 if (shouldShowControls())
3797 mediaControls()->show(); 3791 mediaControls()->show();
3798 else 3792 else
3799 mediaControls()->hide(); 3793 mediaControls()->hide();
3800 } 3794 }
3801 3795
3802 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption) 3796 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption)
3803 { 3797 {
3804 ASSERT(m_textTracks); 3798 ASSERT(m_textTracks);
(...skipping 13 matching lines...) Expand all
3818 if (assumption == AssumeNoVisibleChange 3812 if (assumption == AssumeNoVisibleChange
3819 && m_haveVisibleTextTrack == haveVisibleTextTrack) { 3813 && m_haveVisibleTextTrack == haveVisibleTextTrack) {
3820 updateActiveTextTrackCues(currentTime()); 3814 updateActiveTextTrackCues(currentTime());
3821 return; 3815 return;
3822 } 3816 }
3823 m_haveVisibleTextTrack = haveVisibleTextTrack; 3817 m_haveVisibleTextTrack = haveVisibleTextTrack;
3824 m_closedCaptionsVisible = m_haveVisibleTextTrack; 3818 m_closedCaptionsVisible = m_haveVisibleTextTrack;
3825 3819
3826 if (!m_haveVisibleTextTrack && !hasMediaControls()) 3820 if (!m_haveVisibleTextTrack && !hasMediaControls())
3827 return; 3821 return;
3828 if (!createMediaControls())
3829 return;
3830 3822
3823 ensureMediaControls();
3831 mediaControls()->changedClosedCaptionsVisibility(); 3824 mediaControls()->changedClosedCaptionsVisibility();
3832 3825
3833 updateActiveTextTrackCues(currentTime()); 3826 updateActiveTextTrackCues(currentTime());
3834 updateTextTrackDisplay(); 3827 updateTextTrackDisplay();
3835 } 3828 }
3836 3829
3837 void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured() 3830 void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
3838 { 3831 {
3839 if (!m_textTracks) 3832 if (!m_textTracks)
3840 return; 3833 return;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
4113 4106
4114 #if ENABLE(WEB_AUDIO) 4107 #if ENABLE(WEB_AUDIO)
4115 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 4108 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
4116 { 4109 {
4117 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 4110 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
4118 audioSourceProvider()->setClient(nullptr); 4111 audioSourceProvider()->setClient(nullptr);
4119 } 4112 }
4120 #endif 4113 #endif
4121 4114
4122 } 4115 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698