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..8b1ff2c0d9c2e0dff40601929bf96ef01e26ef2c 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -329,6 +329,20 @@ void ContentViewCoreImpl::Show() { |
GetWebContents()->WasShown(); |
} |
+void ContentViewCoreImpl::SetMediaAutoplayEnabled(JNIEnv* env, jobject obj, |
+ jboolean is_enabled) { |
Ted C
2013/12/10 22:58:20
if they don't all fit on the first line in C++, ea
apiccion
2013/12/13 06:09:12
Done. Thank you!
|
+ SetMediaAutoplayEnabled(is_enabled); |
+} |
+ |
+void ContentViewCoreImpl::SetMediaAutoplayEnabled(bool is_enabled) { |
Ted C
2013/12/10 22:58:20
do you need this to be callable from native?
If n
apiccion
2013/12/13 06:09:12
Done.
|
+ if (is_enabled == is_media_autoplay_enabled_) return; |
Ted C
2013/12/10 22:58:20
The "return;" needs to go on the following line w/
apiccion
2013/12/13 06:09:12
Done.
|
+ is_media_autoplay_enabled_ = is_enabled; |
+ RenderViewHost* host = web_contents_->GetRenderViewHost(); |
+ WebPreferences prefs = host->GetWebkitPreferences(); |
+ prefs.user_gesture_required_for_media_playback = !is_enabled; |
+ host->UpdateWebkitPreferences(prefs); |
Ted C
2013/12/10 22:58:20
Actually, I just checked out RenderViewHostImpl::G
apiccion
2013/12/13 06:09:12
It only triggers on browser context navigation. So
|
+} |
+ |
void ContentViewCoreImpl::Hide() { |
GetWebContents()->WasHidden(); |
PauseVideo(); |