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

Unified Diff: content/child/runtime_features.cc

Issue 2837023002: Create autoplay policy flag and merge cross-origin autoplay blocking into it. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/child/runtime_features.cc
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc
index ab8970952844ceb7d591792a01e32ebcf13ed779..f22e021185df813815ae2f957a358487fb1e4760 100644
--- a/content/child/runtime_features.cc
+++ b/content/child/runtime_features.cc
@@ -15,6 +15,7 @@
#include "content/common/content_switches_internal.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
+#include "media/base/media_switches.h"
#include "services/device/public/cpp/device_features.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "ui/gl/gl_switches.h"
@@ -49,10 +50,6 @@ static void SetRuntimeFeatureDefaultsForPlatform() {
WebRuntimeFeatures::EnableMediaControlsOverlayPlayButton(true);
#else // defined(OS_ANDROID)
WebRuntimeFeatures::EnableNavigatorContentUtils(true);
- if (base::FeatureList::IsEnabled(
- features::kCrossOriginMediaPlaybackRequiresUserGesture)) {
- WebRuntimeFeatures::EnableAutoplayMutedVideos(true);
- }
#endif // defined(OS_ANDROID)
#if defined(OS_ANDROID) || defined(USE_AURA)
@@ -383,6 +380,13 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
if (base::FeatureList::IsEnabled(features::kIdleTimeSpellChecking))
WebRuntimeFeatures::EnableFeatureFromString("IdleTimeSpellChecking", true);
+#if !defined(OS_ANDROID)
whywhat 2017/04/24 18:06:24 nit: does it have to be #if-ed?
mlamouri (slow - plz ping) 2017/04/24 18:41:24 I want to avoid a super long CL so I'm keeping the
+ if (command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) ==
+ switches::autoplay::kCrossOriginUserGestureRequiredPolicy) {
+ WebRuntimeFeatures::EnableAutoplayMutedVideos(true);
+ }
+#endif
+
// Enable explicitly enabled features, and then disable explicitly disabled
// ones.
if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) {

Powered by Google App Engine
This is Rietveld 408576698