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

Unified Diff: media/base/media_switches.cc

Issue 2846623003: Make autoplay policies no longer platform dependant. (Closed)
Patch Set: bauerb review comments 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
« no previous file with comments | « 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..47936f684e499b1f07b1e99ce2554c6943da2816 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 {
@@ -146,17 +147,17 @@ const char kIgnoreAutoplayRestrictionsForTests[] =
namespace autoplay {
-// Autoplay policy to require a user gesture in ordor to play for cross origin
-// iframes.
-const char kCrossOriginUserGestureRequiredPolicy[] =
- "cross-origin-user-gesture-required";
-
// Autoplay policy that does not require any user gesture.
const char kNoUserGestureRequiredPolicy[] = "no-user-gesture-required";
// Autoplay policy to require a user gesture in order to play.
const char kUserGestureRequiredPolicy[] = "user-gesture-required";
+// Autoplay policy to require a user gesture in ordor to play for cross origin
+// iframes.
+const char kUserGestureRequiredForCrossOriginPolicy[] =
+ "user-gesture-required-for-cross-origin";
+
} // namespace autoplay
} // namespace switches
@@ -250,4 +251,21 @@ const base::Feature kMediaFoundationH264Encoding{
"MediaFoundationH264Encoding", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // defined(OS_WIN)
+std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) {
+ // |kIgnoreAutoplayRestrictionsForTests| overrides all other settings.
+ if (command_line.HasSwitch(switches::kIgnoreAutoplayRestrictionsForTests))
+ return switches::autoplay::kNoUserGestureRequiredPolicy;
+
+ // Return the autoplay policy set in teh command line, if any.
+ if (command_line.HasSwitch(switches::kAutoplayPolicy))
+ return command_line.GetSwitchValueASCII(switches::kAutoplayPolicy);
+
+ // The default value is platform dependant.
+#if defined(OS_ANDROID)
+ return switches::autoplay::kUserGestureRequiredPolicy;
+#else
+ return switches::autoplay::kNoUserGestureRequiredPolicy;
+#endif
+}
+
} // namespace media
« no previous file with comments | « media/base/media_switches.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698