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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/TabBase.java

Issue 114183006: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.graphics.Color; 10 import android.graphics.Color;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 private ContentViewCore mContentViewCore; 92 private ContentViewCore mContentViewCore;
93 93
94 /** 94 /**
95 * A list of TabBase observers. These are used to broadcast TabBase events to listeners. 95 * A list of TabBase observers. These are used to broadcast TabBase events to listeners.
96 */ 96 */
97 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs erver>(); 97 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs erver>();
98 98
99 // Content layer Observers and Delegates 99 // Content layer Observers and Delegates
100 private ContentViewClient mContentViewClient; 100 private ContentViewClient mContentViewClient;
101 private WebContentsObserverAndroid mWebContentsObserver; 101 private WebContentsObserverAndroid mWebContentsObserver;
102 private VoiceSearchTabHelper mVoiceSearchTabHelper;
102 private TabBaseChromeWebContentsDelegateAndroid mWebContentsDelegate; 103 private TabBaseChromeWebContentsDelegateAndroid mWebContentsDelegate;
103 104
104 /** 105 /**
105 * A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu 106 * A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu
106 * functionality. 107 * functionality.
107 */ 108 */
108 protected class TabBaseChromeContextMenuItemDelegate 109 protected class TabBaseChromeContextMenuItemDelegate
109 extends EmptyChromeContextMenuItemDelegate { 110 extends EmptyChromeContextMenuItemDelegate {
110 private final Clipboard mClipboard; 111 private final Clipboard mClipboard;
111 112
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 protected void initContentView(long nativeWebContents) { 618 protected void initContentView(long nativeWebContents) {
618 NativePage previousNativePage = mNativePage; 619 NativePage previousNativePage = mNativePage;
619 mNativePage = null; 620 mNativePage = null;
620 destroyNativePageInternal(previousNativePage); 621 destroyNativePageInternal(previousNativePage);
621 622
622 mContentView = ContentView.newInstance(mContext, nativeWebContents, getW indowAndroid()); 623 mContentView = ContentView.newInstance(mContext, nativeWebContents, getW indowAndroid());
623 624
624 mContentViewCore = mContentView.getContentViewCore(); 625 mContentViewCore = mContentView.getContentViewCore();
625 mWebContentsDelegate = createWebContentsDelegate(); 626 mWebContentsDelegate = createWebContentsDelegate();
626 mWebContentsObserver = new TabBaseWebContentsObserverAndroid(mContentVie wCore); 627 mWebContentsObserver = new TabBaseWebContentsObserverAndroid(mContentVie wCore);
628 mVoiceSearchTabHelper = new VoiceSearchTabHelper(mContentViewCore);
627 629
628 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC ontentViewClient); 630 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC ontentViewClient);
629 631
630 assert mNativeTabAndroid != 0; 632 assert mNativeTabAndroid != 0;
631 nativeInitWebContents( 633 nativeInitWebContents(
632 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel egate, 634 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel egate,
633 new TabBaseContextMenuPopulator(createContextMenuPopulator())); 635 new TabBaseContextMenuPopulator(createContextMenuPopulator()));
634 636
635 // In the case where restoring a Tab or showing a prerendered one we alr eady have a 637 // In the case where restoring a Tab or showing a prerendered one we alr eady have a
636 // valid infobar container, no need to recreate one. 638 // valid infobar container, no need to recreate one.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 724
723 if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null) { 725 if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null) {
724 mInfoBarContainer.removeFromParentView(); 726 mInfoBarContainer.removeFromParentView();
725 } 727 }
726 if (mContentViewCore != null) mContentViewCore.destroy(); 728 if (mContentViewCore != null) mContentViewCore.destroy();
727 729
728 mContentView = null; 730 mContentView = null;
729 mContentViewCore = null; 731 mContentViewCore = null;
730 mWebContentsDelegate = null; 732 mWebContentsDelegate = null;
731 mWebContentsObserver = null; 733 mWebContentsObserver = null;
734 mVoiceSearchTabHelper = null;
732 735
733 assert mNativeTabAndroid != 0; 736 assert mNativeTabAndroid != 0;
734 nativeDestroyWebContents(mNativeTabAndroid, deleteNativeWebContents); 737 nativeDestroyWebContents(mNativeTabAndroid, deleteNativeWebContents);
735 } 738 }
736 739
737 /** 740 /**
738 * Gives subclasses the chance to clean up some state associated with this { @link ContentView}. 741 * Gives subclasses the chance to clean up some state associated with this { @link ContentView}.
739 * This is because {@link #getContentView()} can return {@code null} if a {@ link NativePage} 742 * This is because {@link #getContentView()} can return {@code null} if a {@ link NativePage}
740 * is showing. 743 * is showing.
741 * @param contentView The {@link ContentView} that should have associated st ate cleaned up. 744 * @param contentView The {@link ContentView} that should have associated st ate cleaned up.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 private native void nativeInitWebContents(long nativeTabAndroid, boolean inc ognito, 869 private native void nativeInitWebContents(long nativeTabAndroid, boolean inc ognito,
867 ContentViewCore contentViewCore, ChromeWebContentsDelegateAndroid de legate, 870 ContentViewCore contentViewCore, ChromeWebContentsDelegateAndroid de legate,
868 ContextMenuPopulator contextMenuPopulator); 871 ContextMenuPopulator contextMenuPopulator);
869 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean deleteNative); 872 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean deleteNative);
870 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); 873 private native Profile nativeGetProfileAndroid(long nativeTabAndroid);
871 private native int nativeGetSecurityLevel(long nativeTabAndroid); 874 private native int nativeGetSecurityLevel(long nativeTabAndroid);
872 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url, 875 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url,
873 String title); 876 String title);
874 private native boolean nativePrint(long nativeTabAndroid); 877 private native boolean nativePrint(long nativeTabAndroid);
875 } 878 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698