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

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

Issue 2039773003: [Android] Added a runtime flag to enable autoplay of muted videos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed the flag to autoplay-muted-videos Created 4 years, 6 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) 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 3655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3666 return m_lockedPendingUserGesture; 3666 return m_lockedPendingUserGesture;
3667 } 3667 }
3668 3668
3669 void HTMLMediaElement::unlockUserGesture() 3669 void HTMLMediaElement::unlockUserGesture()
3670 { 3670 {
3671 m_lockedPendingUserGesture = false; 3671 m_lockedPendingUserGesture = false;
3672 } 3672 }
3673 3673
3674 bool HTMLMediaElement::isGestureNeededForPlayback() const 3674 bool HTMLMediaElement::isGestureNeededForPlayback() const
3675 { 3675 {
3676 return m_lockedPendingUserGesture 3676 if (!m_lockedPendingUserGesture)
3677 && !m_autoplayHelper->isGestureRequirementOverridden(); 3677 return false;
3678
3679 if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled())
3680 return false;
3681
3682 if (m_autoplayHelper->isGestureRequirementOverridden())
3683 return false;
3684
3685 return true;
3678 } 3686 }
3679 3687
3680 void HTMLMediaElement::setNetworkState(NetworkState state) 3688 void HTMLMediaElement::setNetworkState(NetworkState state)
3681 { 3689 {
3682 if (m_networkState != state) { 3690 if (m_networkState != state) {
3683 m_networkState = state; 3691 m_networkState = state;
3684 if (MediaControls* controls = mediaControls()) 3692 if (MediaControls* controls = mediaControls())
3685 controls->networkStateChanged(); 3693 controls->networkStateChanged();
3686 } 3694 }
3687 } 3695 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 3926
3919 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3927 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3920 { 3928 {
3921 IntRect result; 3929 IntRect result;
3922 if (LayoutObject* object = m_element->layoutObject()) 3930 if (LayoutObject* object = m_element->layoutObject())
3923 result = object->absoluteBoundingBoxRect(); 3931 result = object->absoluteBoundingBoxRect();
3924 return result; 3932 return result;
3925 } 3933 }
3926 3934
3927 } // namespace blink 3935 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-muted.html ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698