OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 private ContentViewCore mContentViewCore; | 114 private ContentViewCore mContentViewCore; |
115 | 115 |
116 /** | 116 /** |
117 * A list of Tab observers. These are used to broadcast Tab events to liste
ners. | 117 * A list of Tab observers. These are used to broadcast Tab events to liste
ners. |
118 */ | 118 */ |
119 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs
erver>(); | 119 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs
erver>(); |
120 | 120 |
121 // Content layer Observers and Delegates | 121 // Content layer Observers and Delegates |
122 private ContentViewClient mContentViewClient; | 122 private ContentViewClient mContentViewClient; |
123 private WebContentsObserverAndroid mWebContentsObserver; | 123 private WebContentsObserverAndroid mWebContentsObserver; |
| 124 private VoiceSearchTabHelper mVoiceSearchTabHelper; |
124 private TabChromeWebContentsDelegateAndroid mWebContentsDelegate; | 125 private TabChromeWebContentsDelegateAndroid mWebContentsDelegate; |
125 private DomDistillerFeedbackReporter mDomDistillerFeedbackReporter; | 126 private DomDistillerFeedbackReporter mDomDistillerFeedbackReporter; |
126 | 127 |
127 /** | 128 /** |
128 * If this tab was opened from another tab, store the id of the tab that | 129 * If this tab was opened from another tab, store the id of the tab that |
129 * caused it to be opened so that we can activate it when this tab gets | 130 * caused it to be opened so that we can activate it when this tab gets |
130 * closed. | 131 * closed. |
131 */ | 132 */ |
132 private int mParentId = INVALID_TAB_ID; | 133 private int mParentId = INVALID_TAB_ID; |
133 | 134 |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 */ | 788 */ |
788 protected void setContentViewCore(ContentViewCore cvc) { | 789 protected void setContentViewCore(ContentViewCore cvc) { |
789 NativePage previousNativePage = mNativePage; | 790 NativePage previousNativePage = mNativePage; |
790 mNativePage = null; | 791 mNativePage = null; |
791 destroyNativePageInternal(previousNativePage); | 792 destroyNativePageInternal(previousNativePage); |
792 | 793 |
793 mContentViewCore = cvc; | 794 mContentViewCore = cvc; |
794 | 795 |
795 mWebContentsDelegate = createWebContentsDelegate(); | 796 mWebContentsDelegate = createWebContentsDelegate(); |
796 mWebContentsObserver = new TabWebContentsObserverAndroid(mContentViewCor
e.getWebContents()); | 797 mWebContentsObserver = new TabWebContentsObserverAndroid(mContentViewCor
e.getWebContents()); |
| 798 mVoiceSearchTabHelper = new VoiceSearchTabHelper(mContentViewCore.getWeb
Contents()); |
797 | 799 |
798 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC
ontentViewClient); | 800 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC
ontentViewClient); |
799 | 801 |
800 assert mNativeTabAndroid != 0; | 802 assert mNativeTabAndroid != 0; |
801 nativeInitWebContents( | 803 nativeInitWebContents( |
802 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel
egate, | 804 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel
egate, |
803 new TabContextMenuPopulator(createContextMenuPopulator())); | 805 new TabContextMenuPopulator(createContextMenuPopulator())); |
804 | 806 |
805 // In the case where restoring a Tab or showing a prerendered one we alr
eady have a | 807 // In the case where restoring a Tab or showing a prerendered one we alr
eady have a |
806 // valid infobar container, no need to recreate one. | 808 // valid infobar container, no need to recreate one. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 destroyContentViewCoreInternal(mContentViewCore); | 955 destroyContentViewCoreInternal(mContentViewCore); |
954 | 956 |
955 if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null)
{ | 957 if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null)
{ |
956 mInfoBarContainer.removeFromParentView(); | 958 mInfoBarContainer.removeFromParentView(); |
957 } | 959 } |
958 mContentViewCore.destroy(); | 960 mContentViewCore.destroy(); |
959 | 961 |
960 mContentViewCore = null; | 962 mContentViewCore = null; |
961 mWebContentsDelegate = null; | 963 mWebContentsDelegate = null; |
962 mWebContentsObserver = null; | 964 mWebContentsObserver = null; |
| 965 mVoiceSearchTabHelper = null; |
963 | 966 |
964 assert mNativeTabAndroid != 0; | 967 assert mNativeTabAndroid != 0; |
965 nativeDestroyWebContents(mNativeTabAndroid, deleteNativeWebContents); | 968 nativeDestroyWebContents(mNativeTabAndroid, deleteNativeWebContents); |
966 } | 969 } |
967 | 970 |
968 /** | 971 /** |
969 * Gives subclasses the chance to clean up some state associated with this | 972 * Gives subclasses the chance to clean up some state associated with this |
970 * {@link ContentViewCore}. This is because {@link #getContentViewCore()} | 973 * {@link ContentViewCore}. This is because {@link #getContentViewCore()} |
971 * can return {@code null} if a {@link NativePage} is showing. | 974 * can return {@code null} if a {@link NativePage} is showing. |
972 * | 975 * |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 private native WebContents nativeGetWebContents(long nativeTabAndroid); | 1150 private native WebContents nativeGetWebContents(long nativeTabAndroid); |
1148 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); | 1151 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); |
1149 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, | 1152 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, |
1150 byte[] postData, int transition, String referrerUrl, int referrerPol
icy, | 1153 byte[] postData, int transition, String referrerUrl, int referrerPol
icy, |
1151 boolean isRendererInitiated); | 1154 boolean isRendererInitiated); |
1152 private native int nativeGetSecurityLevel(long nativeTabAndroid); | 1155 private native int nativeGetSecurityLevel(long nativeTabAndroid); |
1153 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, | 1156 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, |
1154 String title); | 1157 String title); |
1155 private native boolean nativePrint(long nativeTabAndroid); | 1158 private native boolean nativePrint(long nativeTabAndroid); |
1156 } | 1159 } |
OLD | NEW |