Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index 2a53563c4f309e698c4ece2b021b230e0d2537cd..b0a2dc6673e5d76dcaaad207df53cb4a7fc84a78 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -329,6 +329,24 @@ void ContentViewCoreImpl::Show() { |
GetWebContents()->WasShown(); |
} |
+void ContentViewCoreImpl::DisableMediaAutoplay(JNIEnv* env, jobject obj) { |
+ SetMediaAutoplayEnabled(false); |
+} |
+ |
+void ContentViewCoreImpl::EnableMediaAutoplay() { |
+ SetMediaAutoplayEnabled(true); |
+} |
+ |
+void ContentViewCoreImpl::SetMediaAutoplayEnabled(bool isEnabled) { |
Ted C
2013/11/26 19:24:29
c++ naming for variables doesn't use camel casing.
apiccion
2013/12/03 02:29:19
Done.
|
+ if (isEnabled == is_media_autoplay_enabled_) return; |
Ted C
2013/11/26 19:24:29
return needs to be on the next line.
Also, why do
apiccion
2013/12/03 02:29:19
GetWebkitPreferences() would be better understood
|
+ is_media_autoplay_enabled_ = isEnabled; |
+ RenderViewHost* host = web_contents_->GetRenderViewHost(); |
+ WebPreferences prefs = host->GetWebkitPreferences(); |
+ prefs.user_gesture_required_for_media_playback = !isEnabled; |
+ host->UpdateWebkitPreferences(prefs); |
+} |
+ |
+ |
Ted C
2013/11/26 19:24:29
remove extra blank line
apiccion
2013/12/03 02:29:19
Done.
|
void ContentViewCoreImpl::Hide() { |
GetWebContents()->WasHidden(); |
PauseVideo(); |