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