| 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.tab; | 5 package org.chromium.chrome.browser.tab; |
| 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.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); | 1839 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); |
| 1840 | 1840 |
| 1841 mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(th
is); | 1841 mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(th
is); |
| 1842 mWebContentsObserver = | 1842 mWebContentsObserver = |
| 1843 new TabWebContentsObserver(mContentViewCore.getWebContents()
, this); | 1843 new TabWebContentsObserver(mContentViewCore.getWebContents()
, this); |
| 1844 | 1844 |
| 1845 if (mContentViewClient != null) { | 1845 if (mContentViewClient != null) { |
| 1846 mContentViewCore.setContentViewClient(mContentViewClient); | 1846 mContentViewCore.setContentViewClient(mContentViewClient); |
| 1847 } | 1847 } |
| 1848 | 1848 |
| 1849 mDownloadDelegate = new ChromeDownloadDelegate(mThemedApplicationCon
text, this); |
| 1850 |
| 1849 assert mNativeTabAndroid != 0; | 1851 assert mNativeTabAndroid != 0; |
| 1850 nativeInitWebContents( | 1852 nativeInitWebContents( |
| 1851 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContent
sDelegate, | 1853 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContent
sDelegate, |
| 1852 new TabContextMenuPopulator(mDelegateFactory.createContextMe
nuPopulator(this), | 1854 new TabContextMenuPopulator(mDelegateFactory.createContextMe
nuPopulator(this), |
| 1853 this)); | 1855 this)); |
| 1854 | 1856 |
| 1855 // In the case where restoring a Tab or showing a prerendered one we
already have a | 1857 // In the case where restoring a Tab or showing a prerendered one we
already have a |
| 1856 // valid infobar container, no need to recreate one. | 1858 // valid infobar container, no need to recreate one. |
| 1857 if (mInfoBarContainer == null) { | 1859 if (mInfoBarContainer == null) { |
| 1858 // The InfoBarContainer needs to be created after the ContentVie
w has been natively | 1860 // The InfoBarContainer needs to be created after the ContentVie
w has been natively |
| 1859 // initialized. | 1861 // initialized. |
| 1860 mInfoBarContainer = new InfoBarContainer( | 1862 mInfoBarContainer = new InfoBarContainer( |
| 1861 mThemedApplicationContext, getId(), mContentViewParent,
this); | 1863 mThemedApplicationContext, getId(), mContentViewParent,
this); |
| 1862 } else { | 1864 } else { |
| 1863 mInfoBarContainer.onParentViewChanged(getId(), mContentViewParen
t); | 1865 mInfoBarContainer.onParentViewChanged(getId(), mContentViewParen
t); |
| 1864 } | 1866 } |
| 1865 mInfoBarContainer.setContentViewCore(mContentViewCore); | 1867 mInfoBarContainer.setContentViewCore(mContentViewCore); |
| 1866 | 1868 |
| 1867 mSwipeRefreshHandler = new SwipeRefreshHandler(mThemedApplicationCon
text); | 1869 mSwipeRefreshHandler = new SwipeRefreshHandler(mThemedApplicationCon
text); |
| 1868 mSwipeRefreshHandler.setContentViewCore(mContentViewCore); | 1870 mSwipeRefreshHandler.setContentViewCore(mContentViewCore); |
| 1869 | 1871 |
| 1870 updateThemeColorIfNeeded(false); | 1872 updateThemeColorIfNeeded(false); |
| 1871 notifyContentChanged(); | 1873 notifyContentChanged(); |
| 1872 | 1874 |
| 1873 // For browser tabs, we want to set accessibility focus to the page | 1875 // For browser tabs, we want to set accessibility focus to the page |
| 1874 // when it loads. This is not the default behavior for embedded | 1876 // when it loads. This is not the default behavior for embedded |
| 1875 // web views. | 1877 // web views. |
| 1876 mContentViewCore.setShouldSetAccessibilityFocusOnPageLoad(true); | 1878 mContentViewCore.setShouldSetAccessibilityFocusOnPageLoad(true); |
| 1877 | 1879 |
| 1878 mDownloadDelegate = new ChromeDownloadDelegate( | |
| 1879 mThemedApplicationContext, this); | |
| 1880 cvc.setDownloadDelegate(mDownloadDelegate); | |
| 1881 | |
| 1882 setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavig
ationDelegate( | 1880 setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavig
ationDelegate( |
| 1883 this)); | 1881 this)); |
| 1884 | 1882 |
| 1885 if (mGestureStateListener == null) { | 1883 if (mGestureStateListener == null) { |
| 1886 mGestureStateListener = createGestureStateListener(); | 1884 mGestureStateListener = createGestureStateListener(); |
| 1887 } | 1885 } |
| 1888 cvc.addGestureStateListener(mGestureStateListener); | 1886 cvc.addGestureStateListener(mGestureStateListener); |
| 1889 } finally { | 1887 } finally { |
| 1890 TraceEvent.end("ChromeTab.setContentViewCore"); | 1888 TraceEvent.end("ChromeTab.setContentViewCore"); |
| 1891 } | 1889 } |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3271 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro
id, | 3269 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro
id, |
| 3272 InterceptNavigationDelegate delegate); | 3270 InterceptNavigationDelegate delegate); |
| 3273 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 3271 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
| 3274 TabContentManager tabContentManager); | 3272 TabContentManager tabContentManager); |
| 3275 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid
, | 3273 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid
, |
| 3276 ContentViewCore content, boolean visible); | 3274 ContentViewCore content, boolean visible); |
| 3277 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid
, | 3275 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid
, |
| 3278 ContentViewCore content); | 3276 ContentViewCore content); |
| 3279 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); | 3277 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); |
| 3280 } | 3278 } |
| OLD | NEW |