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

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: Fixes Created 7 years, 1 month 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..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();

Powered by Google App Engine
This is Rietveld 408576698