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 |