Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/VoiceSearchTabHelper.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/VoiceSearchTabHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/VoiceSearchTabHelper.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1204fbbf786299ba058946aea9f7b1bcdf7a85ab |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/VoiceSearchTabHelper.java |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser; |
| + |
| +import org.chromium.content.browser.ContentViewCore; |
| +import org.chromium.content.browser.WebContents; |
| +import org.chromium.content.browser.WebContentsObserverAndroid; |
| + |
| +/** |
| + * Tab helper to toggle autoplay for media autoplay. Autoplay is enabled from native in |
| + * ChromeContentBrowserClient for voice search URLs. |
| + */ |
| +public class VoiceSearchTabHelper extends WebContentsObserverAndroid { |
| + private static final String TAG = "VoiceSearchTabHelper"; |
| + private long mNativeVoiceSearchTabHelper; |
| + |
| + /** |
| + * Create an instance of VoiceSearchTabHelper. |
| + * |
| + * @param contentViewCore ContentViewCore to update media autoplay status. |
| + */ |
| + public VoiceSearchTabHelper(ContentViewCore contentViewCore) { |
| + super(contentViewCore); |
| + mNativeVoiceSearchTabHelper = nativeInit(contentViewCore.getWebContents()); |
|
Ted C
2013/12/17 00:59:00
If you wanted, you could also store a pointer to t
apiccion
2013/12/17 21:17:11
Done.
|
| + } |
| + |
| + @Override |
| + public void navigationEntryCommitted() { |
|
Ted C
2013/12/17 00:59:00
Hmm...what happens if the navigation entry being c
apiccion
2013/12/17 21:17:11
Done.
|
| + nativeSetMediaAutoplayEnabled(mNativeVoiceSearchTabHelper, false); |
| + } |
| + |
| + private native long nativeInit(WebContents webContents); |
| + private native void nativeSetMediaAutoplayEnabled(long nativeVoiceSearchTabHelper, |
| + boolean isEnabled); |
| +} |