diff options
author | Jonathan Dixon <joth@google.com> | 2012-02-24 00:13:06 +0000 |
---|---|---|
committer | Jonathan Dixon <joth@google.com> | 2012-03-02 11:18:30 +0000 |
commit | 4d2fcaba7fb8eb1723943ac9a10e76d509330bd1 (patch) | |
tree | 19a8905db9aa0aad4a60c1c3ef4fd7506c2089ad /src/com/android/browser/Tab.java | |
parent | f9a4c8405898fa55be50ee4b682f7e97b054a41f (diff) | |
download | packages_apps_Browser-4d2fcaba7fb8eb1723943ac9a10e76d509330bd1.zip packages_apps_Browser-4d2fcaba7fb8eb1723943ac9a10e76d509330bd1.tar.gz packages_apps_Browser-4d2fcaba7fb8eb1723943ac9a10e76d509330bd1.tar.bz2 |
Fixup browser to use WebView proxy
Has to escape out to WebViewClassic whenever it needs a hidden API.
Interdepends on https://android-git.corp.google.com/g/165608
Change-Id: Ic61dd7f57f75381864075605d5901f2688648cbd
Diffstat (limited to 'src/com/android/browser/Tab.java')
-rw-r--r-- | src/com/android/browser/Tab.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index b09e423..837ca47 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -64,6 +64,7 @@ import android.webkit.WebHistoryItem; import android.webkit.WebResourceResponse; import android.webkit.WebStorage; import android.webkit.WebView; +import android.webkit.WebViewClassic; import android.webkit.WebView.PictureListener; import android.webkit.WebViewClient; import android.widget.CheckBox; @@ -1541,7 +1542,7 @@ class Tab implements PictureListener { // does a redirect after a period of time. The user could have // switched to another tab while waiting for the download to start. mMainView.setDownloadListener(mDownloadListener); - mMainView.setWebBackForwardListClient(mWebBackForwardListClient); + getWebViewClassic().setWebBackForwardListClient(mWebBackForwardListClient); TabControl tc = mWebViewController.getTabControl(); if (tc != null && tc.getOnThumbnailUpdatedListener() != null) { mMainView.setPictureListener(this); @@ -1565,7 +1566,7 @@ class Tab implements PictureListener { if (mMainView != null) { dismissSubWindow(); // Make sure the embedded title bar isn't still attached - mMainView.setEmbeddedTitleBar(null); + getWebViewClassic().setEmbeddedTitleBar(null); // save the WebView to call destroy() after detach it from the tab WebView webView = mMainView; setWebView(null); @@ -1778,6 +1779,15 @@ class Tab implements PictureListener { return mMainView; } + /** + * Return the underlying WebViewClassic implementation. As with getWebView, + * this maybe null for background tabs. + * @return The main WebView of this tab. + */ + WebViewClassic getWebViewClassic() { + return WebViewClassic.fromWebView(mMainView); + } + void setViewContainer(View container) { mContainer = container; } @@ -2046,7 +2056,7 @@ class Tab implements PictureListener { SnapshotByteArrayOutputStream bos = new SnapshotByteArrayOutputStream(); try { GZIPOutputStream stream = new GZIPOutputStream(bos); - if (!mMainView.saveViewState(stream)) { + if (!getWebViewClassic().saveViewState(stream)) { return null; } stream.flush(); @@ -2060,7 +2070,7 @@ class Tab implements PictureListener { values.put(Snapshots.TITLE, mCurrentState.mTitle); values.put(Snapshots.URL, mCurrentState.mUrl); values.put(Snapshots.VIEWSTATE, data); - values.put(Snapshots.BACKGROUND, mMainView.getPageBackgroundColor()); + values.put(Snapshots.BACKGROUND, getWebViewClassic().getPageBackgroundColor()); values.put(Snapshots.DATE_CREATED, System.currentTimeMillis()); values.put(Snapshots.FAVICON, compressBitmap(getFavicon())); Bitmap screenshot = Controller.createScreenshot(mMainView, |