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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 86443002: Changes to enable HTML5 autoplay for voice search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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
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();

Powered by Google App Engine
This is Rietveld 408576698