| 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 13 matching lines...) Expand all Loading... |
| 24 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat
e; | 24 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat
e; |
| 25 import org.chromium.chrome.browser.dom_distiller.DomDistillerFeedbackReporter; | 25 import org.chromium.chrome.browser.dom_distiller.DomDistillerFeedbackReporter; |
| 26 import org.chromium.chrome.browser.infobar.AutoLoginProcessor; | 26 import org.chromium.chrome.browser.infobar.AutoLoginProcessor; |
| 27 import org.chromium.chrome.browser.infobar.InfoBarContainer; | 27 import org.chromium.chrome.browser.infobar.InfoBarContainer; |
| 28 import org.chromium.chrome.browser.profiles.Profile; | 28 import org.chromium.chrome.browser.profiles.Profile; |
| 29 import org.chromium.chrome.browser.ui.toolbar.ToolbarModelSecurityLevel; | 29 import org.chromium.chrome.browser.ui.toolbar.ToolbarModelSecurityLevel; |
| 30 import org.chromium.content.browser.ContentView; | 30 import org.chromium.content.browser.ContentView; |
| 31 import org.chromium.content.browser.ContentViewClient; | 31 import org.chromium.content.browser.ContentViewClient; |
| 32 import org.chromium.content.browser.ContentViewCore; | 32 import org.chromium.content.browser.ContentViewCore; |
| 33 import org.chromium.content.browser.NavigationClient; | 33 import org.chromium.content.browser.NavigationClient; |
| 34 import org.chromium.content.browser.WebContentsObserverAndroid; | 34 import org.chromium.content.browser.WebContentsObserver; |
| 35 import org.chromium.content_public.browser.LoadUrlParams; | 35 import org.chromium.content_public.browser.LoadUrlParams; |
| 36 import org.chromium.content_public.browser.NavigationHistory; | 36 import org.chromium.content_public.browser.NavigationHistory; |
| 37 import org.chromium.content_public.browser.WebContents; | 37 import org.chromium.content_public.browser.WebContents; |
| 38 import org.chromium.ui.base.Clipboard; | 38 import org.chromium.ui.base.Clipboard; |
| 39 import org.chromium.ui.base.WindowAndroid; | 39 import org.chromium.ui.base.WindowAndroid; |
| 40 | 40 |
| 41 import java.util.concurrent.atomic.AtomicInteger; | 41 import java.util.concurrent.atomic.AtomicInteger; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * The basic Java representation of a tab. Contains and manages a {@link Conten
tView}. | 44 * The basic Java representation of a tab. Contains and manages a {@link Conten
tView}. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 */ | 114 */ |
| 115 private ContentViewCore mContentViewCore; | 115 private ContentViewCore mContentViewCore; |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * A list of Tab observers. These are used to broadcast Tab events to liste
ners. | 118 * A list of Tab observers. These are used to broadcast Tab events to liste
ners. |
| 119 */ | 119 */ |
| 120 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs
erver>(); | 120 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs
erver>(); |
| 121 | 121 |
| 122 // Content layer Observers and Delegates | 122 // Content layer Observers and Delegates |
| 123 private ContentViewClient mContentViewClient; | 123 private ContentViewClient mContentViewClient; |
| 124 private WebContentsObserverAndroid mWebContentsObserver; | 124 private WebContentsObserver mWebContentsObserver; |
| 125 private VoiceSearchTabHelper mVoiceSearchTabHelper; | 125 private VoiceSearchTabHelper mVoiceSearchTabHelper; |
| 126 private TabChromeWebContentsDelegateAndroid mWebContentsDelegate; | 126 private TabChromeWebContentsDelegateAndroid mWebContentsDelegate; |
| 127 private DomDistillerFeedbackReporter mDomDistillerFeedbackReporter; | 127 private DomDistillerFeedbackReporter mDomDistillerFeedbackReporter; |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * If this tab was opened from another tab, store the id of the tab that | 130 * If this tab was opened from another tab, store the id of the tab that |
| 131 * caused it to be opened so that we can activate it when this tab gets | 131 * caused it to be opened so that we can activate it when this tab gets |
| 132 * closed. | 132 * closed. |
| 133 */ | 133 */ |
| 134 private int mParentId = INVALID_TAB_ID; | 134 private int mParentId = INVALID_TAB_ID; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 super(populator); | 254 super(populator); |
| 255 } | 255 } |
| 256 | 256 |
| 257 @Override | 257 @Override |
| 258 public void buildContextMenu(ContextMenu menu, Context context, ContextM
enuParams params) { | 258 public void buildContextMenu(ContextMenu menu, Context context, ContextM
enuParams params) { |
| 259 super.buildContextMenu(menu, context, params); | 259 super.buildContextMenu(menu, context, params); |
| 260 for (TabObserver observer : mObservers) observer.onContextMenuShown(
Tab.this, menu); | 260 for (TabObserver observer : mObservers) observer.onContextMenuShown(
Tab.this, menu); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 private class TabWebContentsObserverAndroid extends WebContentsObserverAndro
id { | 264 private class TabWebContentsObserver extends WebContentsObserver { |
| 265 public TabWebContentsObserverAndroid(WebContents webContents) { | 265 public TabWebContentsObserver(WebContents webContents) { |
| 266 super(webContents); | 266 super(webContents); |
| 267 } | 267 } |
| 268 | 268 |
| 269 @Override | 269 @Override |
| 270 public void navigationEntryCommitted() { | 270 public void navigationEntryCommitted() { |
| 271 if (getNativePage() != null) { | 271 if (getNativePage() != null) { |
| 272 pushNativePageStateToNavigationEntry(); | 272 pushNativePageStateToNavigationEntry(); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 * @param cvc The content view core that needs to be set as active view for
the tab. | 801 * @param cvc The content view core that needs to be set as active view for
the tab. |
| 802 */ | 802 */ |
| 803 protected void setContentViewCore(ContentViewCore cvc) { | 803 protected void setContentViewCore(ContentViewCore cvc) { |
| 804 NativePage previousNativePage = mNativePage; | 804 NativePage previousNativePage = mNativePage; |
| 805 mNativePage = null; | 805 mNativePage = null; |
| 806 destroyNativePageInternal(previousNativePage); | 806 destroyNativePageInternal(previousNativePage); |
| 807 | 807 |
| 808 mContentViewCore = cvc; | 808 mContentViewCore = cvc; |
| 809 | 809 |
| 810 mWebContentsDelegate = createWebContentsDelegate(); | 810 mWebContentsDelegate = createWebContentsDelegate(); |
| 811 mWebContentsObserver = new TabWebContentsObserverAndroid(mContentViewCor
e.getWebContents()); | 811 mWebContentsObserver = new TabWebContentsObserver(mContentViewCore.getWe
bContents()); |
| 812 mVoiceSearchTabHelper = new VoiceSearchTabHelper(mContentViewCore.getWeb
Contents()); | 812 mVoiceSearchTabHelper = new VoiceSearchTabHelper(mContentViewCore.getWeb
Contents()); |
| 813 | 813 |
| 814 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC
ontentViewClient); | 814 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC
ontentViewClient); |
| 815 | 815 |
| 816 assert mNativeTabAndroid != 0; | 816 assert mNativeTabAndroid != 0; |
| 817 nativeInitWebContents( | 817 nativeInitWebContents( |
| 818 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel
egate, | 818 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel
egate, |
| 819 new TabContextMenuPopulator(createContextMenuPopulator())); | 819 new TabContextMenuPopulator(createContextMenuPopulator())); |
| 820 | 820 |
| 821 // In the case where restoring a Tab or showing a prerendered one we alr
eady have a | 821 // In the case where restoring a Tab or showing a prerendered one we alr
eady have a |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, | 1203 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e
xtraHeaders, |
| 1204 byte[] postData, int transition, String referrerUrl, int referrerPol
icy, | 1204 byte[] postData, int transition, String referrerUrl, int referrerPol
icy, |
| 1205 boolean isRendererInitiated); | 1205 boolean isRendererInitiated); |
| 1206 private native int nativeGetSecurityLevel(long nativeTabAndroid); | 1206 private native int nativeGetSecurityLevel(long nativeTabAndroid); |
| 1207 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, | 1207 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, |
| 1208 String title); | 1208 String title); |
| 1209 private native boolean nativePrint(long nativeTabAndroid); | 1209 private native boolean nativePrint(long nativeTabAndroid); |
| 1210 private native Bitmap nativeGetFavicon(long nativeTabAndroid); | 1210 private native Bitmap nativeGetFavicon(long nativeTabAndroid); |
| 1211 private native boolean nativeIsFaviconValid(long nativeTabAndroid); | 1211 private native boolean nativeIsFaviconValid(long nativeTabAndroid); |
| 1212 } | 1212 } |
| OLD | NEW |