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

Side by Side Diff: chrome/browser/android/voice_search_tab_helper.cc

Issue 86443002: Changes to enable HTML5 autoplay for voice search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Isolated media autoplay enabler from Tab 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/voice_search_tab_helper.h"
6
7 #include "content/public/browser/render_view_host.h"
8 #include "content/public/browser/web_contents.h"
9 #include "jni/VoiceSearchTabHelper_jni.h"
10 #include "webkit/common/webpreferences.h"
11
12 using content::WebContents;
13
14 // Register native methods
15 bool RegisterVoiceSearchTabHelper(JNIEnv* env) {
16 return RegisterNativesImpl(env);
17 }
18
19 static jlong Init(JNIEnv* env, jobject obj, jobject j_web_contents) {
20 WebContents* web_contents = WebContents::FromJavaWebContents(j_web_contents);
21 VoiceSearchTabHelper* helper = new VoiceSearchTabHelper(web_contents);
22 return reinterpret_cast<intptr_t>(helper);
23 }
24
25 VoiceSearchTabHelper::VoiceSearchTabHelper(WebContents* web_contents)
26 : web_contents_(web_contents) {
27 }
28
29 void VoiceSearchTabHelper::SetMediaAutoplayEnabled(JNIEnv* env,
30 jobject obj,
31 jboolean is_enabled) {
32 content::RenderViewHost* host = web_contents_->GetRenderViewHost();
33 WebPreferences prefs = host->GetWebkitPreferences();
34 prefs.user_gesture_required_for_media_playback = true;
35 host->UpdateWebkitPreferences(prefs);
36 }
37
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698