Index: content/browser/renderer_host/render_view_host_impl.cc |
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc |
index f62cf8320202c8cecfe3caa4b1504b320f58ca25..c74000446e85fdb1f09b94cb6f3d6963c1e3f32c 100644 |
--- a/content/browser/renderer_host/render_view_host_impl.cc |
+++ b/content/browser/renderer_host/render_view_host_impl.cc |
@@ -79,6 +79,7 @@ |
#include "content/public/common/url_constants.h" |
#include "content/public/common/url_utils.h" |
#include "media/base/media_switches.h" |
+#include "media/base/media_util.h" |
#include "net/base/url_util.h" |
#include "net/url_request/url_request_context_getter.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
@@ -436,23 +437,22 @@ WebPreferences RenderViewHostImpl::ComputeWebkitPrefs() { |
command_line.HasSwitch(switches::kHistoryEntryRequiresUserGesture); |
#if defined(OS_ANDROID) |
- // On Android, user gestures are normally required, unless that requirement |
- // is disabled with a command-line switch or the equivalent field trial is |
- // is set to "Enabled". |
- prefs.user_gesture_required_for_media_playback = |
- !command_line.HasSwitch(switches::kIgnoreAutoplayRestrictionsForTests) && |
- command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) != |
- switches::autoplay::kNoUserGestureRequiredPolicy; |
- |
prefs.progress_bar_completion = GetProgressBarCompletionPolicy(); |
prefs.use_solid_color_scrollbars = true; |
-#else // defined(OS_ANDROID) |
- prefs.cross_origin_media_playback_requires_user_gesture = |
- command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) == |
- switches::autoplay::kCrossOriginUserGestureRequiredPolicy; |
#endif // defined(OS_ANDROID) |
+ std::string autoplay_policy = media::GetEffectiveAutoplayPolicy(command_line); |
+ if (autoplay_policy == switches::autoplay::kNoUserGestureRequiredPolicy) { |
+ prefs.autoplay_policy = AutoplayPolicy::kNoUserGestureRequired; |
+ } else if (autoplay_policy == |
+ switches::autoplay::kCrossOriginUserGestureRequiredPolicy) { |
+ prefs.autoplay_policy = AutoplayPolicy::kCrossOriginUserGestureRequired; |
+ } else if (autoplay_policy == |
+ switches::autoplay::kUserGestureRequiredPolicy) { |
+ prefs.autoplay_policy = AutoplayPolicy::kUserGestureRequired; |
+ } |
+ |
const std::string touch_enabled_switch = |
command_line.HasSwitch(switches::kTouchEventFeatureDetection) |
? command_line.GetSwitchValueASCII( |