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

Unified Diff: media/base/media_util.cc

Issue 2846623003: Make autoplay policies no longer platform dependant. (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
« media/base/media_util.h ('K') | « media/base/media_util.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_util.cc
diff --git a/media/base/media_util.cc b/media/base/media_util.cc
index a6516cd23058a1795f144fa23b1e57c6cc5c270a..b1a8826028a8f9f80cffbf7708f7dd75bcdef141 100644
--- a/media/base/media_util.cc
+++ b/media/base/media_util.cc
@@ -4,6 +4,9 @@
#include "media/base/media_util.h"
+#include "base/command_line.h"
+#include "media/base/media_switches.h"
+
namespace media {
std::vector<uint8_t> EmptyExtraData() {
@@ -19,4 +22,20 @@ EncryptionScheme AesCtrEncryptionScheme() {
EncryptionScheme::Pattern());
}
+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)) {
+#if defined(OS_ANDROID)
+ return switches::autoplay::kUserGestureRequiredPolicy;
+#else
+ return switches::autoplay::kNoUserGestureRequiredPolicy;
+#endif
+ }
+
+ return command_line.GetSwitchValueASCII(switches::kAutoplayPolicy);
+}
+
} // namespace media
« media/base/media_util.h ('K') | « media/base/media_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698