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

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

Issue 2046403002: Autoplay: disable muted video autoplay if data saver is on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video-as-images-flag
Patch Set: review comments 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
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-on.html ('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 3668 matching lines...) Expand 10 before | Expand all | Expand 10 after
3679 void HTMLMediaElement::unlockUserGesture() 3679 void HTMLMediaElement::unlockUserGesture()
3680 { 3680 {
3681 m_lockedPendingUserGesture = false; 3681 m_lockedPendingUserGesture = false;
3682 } 3682 }
3683 3683
3684 bool HTMLMediaElement::isGestureNeededForPlayback() const 3684 bool HTMLMediaElement::isGestureNeededForPlayback() const
3685 { 3685 {
3686 if (!m_lockedPendingUserGesture) 3686 if (!m_lockedPendingUserGesture)
3687 return false; 3687 return false;
3688 3688
3689 if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) 3689 // We want to allow muted video to autoplay if:
3690 // - the flag is enabled;
3691 // - Data Saver is not enabled;
3692 if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()
3693 && !(document().settings() && document().settings()->dataSaverEnabled()) ) {
3690 return false; 3694 return false;
3695 }
3691 3696
3692 if (m_autoplayHelper->isGestureRequirementOverridden()) 3697 if (m_autoplayHelper->isGestureRequirementOverridden())
3693 return false; 3698 return false;
3694 3699
3695 return true; 3700 return true;
3696 } 3701 }
3697 3702
3698 void HTMLMediaElement::setNetworkState(NetworkState state) 3703 void HTMLMediaElement::setNetworkState(NetworkState state)
3699 { 3704 {
3700 if (m_networkState != state) { 3705 if (m_networkState != state) {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
3936 3941
3937 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3942 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3938 { 3943 {
3939 IntRect result; 3944 IntRect result;
3940 if (LayoutObject* object = m_element->layoutObject()) 3945 if (LayoutObject* object = m_element->layoutObject())
3941 result = object->absoluteBoundingBoxRect(); 3946 result = object->absoluteBoundingBoxRect();
3942 return result; 3947 return result;
3943 } 3948 }
3944 3949
3945 } // namespace blink 3950 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-muted-datasaver-on.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698