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

Unified Diff: media/base/media_switches.cc

Issue 2846623003: Make autoplay policies no longer platform dependant. (Closed)
Patch Set: fix webview Created 3 years, 7 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
« content/public/common/web_preferences.h ('K') | « media/base/media_switches.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_switches.cc
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc
index b6de64a285451dbb1d39eb7584665a534616af51..5b12fc346fbeed2125bba68d729deba7eb71cb3f 100644
--- a/media/base/media_switches.cc
+++ b/media/base/media_switches.cc
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "build/build_config.h"
#include "media/base/media_switches.h"
+#include "base/command_line.h"
+#include "build/build_config.h"
#include "ppapi/features/features.h"
namespace switches {
@@ -250,4 +251,20 @@ const base::Feature kMediaFoundationH264Encoding{
"MediaFoundationH264Encoding", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // defined(OS_WIN)
+std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) {
+ if (command_line.HasSwitch(switches::kIgnoreAutoplayRestrictionsForTests))
+ return switches::autoplay::kNoUserGestureRequiredPolicy;
+
+ // Return the default policy if none is specified in the command line.
+ if (!command_line.HasSwitch(switches::kAutoplayPolicy)) {
Bernhard Bauer 2017/05/09 12:47:17 Nit: I would probably flip this condition around,
mlamouri (slow - plz ping) 2017/05/09 17:24:35 Done.
+#if defined(OS_ANDROID)
+ return switches::autoplay::kUserGestureRequiredPolicy;
+#else
+ return switches::autoplay::kNoUserGestureRequiredPolicy;
+#endif
+ }
+
+ return command_line.GetSwitchValueASCII(switches::kAutoplayPolicy);
+}
+
} // namespace media
« content/public/common/web_preferences.h ('K') | « media/base/media_switches.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698