diff options
Diffstat (limited to 'src/com/android/browser/Tab.java')
-rw-r--r-- | src/com/android/browser/Tab.java | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index 6200286..b5000c2 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -46,9 +46,9 @@ import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewStub; +import android.webkit.BrowserDownloadListener; import android.webkit.ClientCertRequestHandler; import android.webkit.ConsoleMessage; -import android.webkit.DownloadListener; import android.webkit.GeolocationPermissions; import android.webkit.HttpAuthHandler; import android.webkit.SslErrorHandler; @@ -64,6 +64,7 @@ import android.webkit.WebView; import android.webkit.WebView.PictureListener; import android.webkit.WebViewClassic; import android.webkit.WebViewClient; +import android.webkit.WebViewClientClassicExt; import android.widget.CheckBox; import android.widget.Toast; @@ -155,6 +156,7 @@ class Tab implements PictureListener { // If true, the tab is in page loading state (after onPageStarted, // before onPageFinsihed) private boolean mInPageLoad; + private boolean mDisableOverrideUrlLoading; // The last reported progress of the current page private int mPageLoadProgress; // The time the load started, used to find load page time @@ -170,7 +172,7 @@ class Tab implements PictureListener { private ErrorConsoleView mErrorConsole; // The listener that gets invoked when a download is started from the // mMainView - private final DownloadListener mDownloadListener; + private final BrowserDownloadListener mDownloadListener; // Listener used to know when we move forward or back in the history list. private final WebBackForwardListClient mWebBackForwardListClient; private DataController mDataController; @@ -322,7 +324,7 @@ class Tab implements PictureListener { // WebViewClient implementation for the main WebView // ------------------------------------------------------------------------- - private final WebViewClient mWebViewClient = new WebViewClient() { + private final WebViewClientClassicExt mWebViewClient = new WebViewClientClassicExt() { private Message mDontResend; private Message mResend; @@ -372,6 +374,7 @@ class Tab implements PictureListener { @Override public void onPageFinished(WebView view, String url) { + mDisableOverrideUrlLoading = false; if (!isPrivateBrowsingEnabled()) { LogTag.logPageFinishedLoading( url, SystemClock.uptimeMillis() - mLoadStartTime); @@ -383,7 +386,7 @@ class Tab implements PictureListener { // return true if want to hijack the url to let another app to handle it @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (mInForeground) { + if (!mDisableOverrideUrlLoading && mInForeground) { return mWebViewController.shouldOverrideUrlLoading(Tab.this, view, url); } else { @@ -1045,12 +1048,12 @@ class Tab implements PictureListener { // Subclass of WebViewClient used in subwindows to notify the main // WebViewClient of certain WebView activities. - private static class SubWindowClient extends WebViewClient { + private static class SubWindowClient extends WebViewClientClassicExt { // The main WebViewClient. - private final WebViewClient mClient; + private final WebViewClientClassicExt mClient; private final WebViewController mController; - SubWindowClient(WebViewClient client, WebViewController controller) { + SubWindowClient(WebViewClientClassicExt client, WebViewController controller) { mClient = client; mController = controller; } @@ -1157,12 +1160,12 @@ class Tab implements PictureListener { mInPageLoad = false; mInForeground = false; - mDownloadListener = new DownloadListener() { + mDownloadListener = new BrowserDownloadListener() { public void onDownloadStart(String url, String userAgent, - String contentDisposition, String mimetype, + String contentDisposition, String mimetype, String referer, long contentLength) { mWebViewController.onDownloadStart(Tab.this, url, userAgent, contentDisposition, - mimetype, contentLength); + mimetype, referer, contentLength); } }; mWebBackForwardListClient = new WebBackForwardListClient() { @@ -1351,12 +1354,12 @@ class Tab implements PictureListener { mWebChromeClient)); // Set a different DownloadListener for the mSubView, since it will // just need to dismiss the mSubView, rather than close the Tab - mSubView.setDownloadListener(new DownloadListener() { + mSubView.setDownloadListener(new BrowserDownloadListener() { public void onDownloadStart(String url, String userAgent, - String contentDisposition, String mimetype, + String contentDisposition, String mimetype, String referer, long contentLength) { mWebViewController.onDownloadStart(Tab.this, url, userAgent, - contentDisposition, mimetype, contentLength); + contentDisposition, mimetype, referer, contentLength); if (mSubView.copyBackForwardList().getSize() == 0) { // This subwindow was opened for the sole purpose of // downloading a file. Remove it. @@ -1894,6 +1897,10 @@ class Tab implements PictureListener { } } + public void disableUrlOverridingForLoad() { + mDisableOverrideUrlLoading = true; + } + protected void capture() { if (mMainView == null || mCapture == null) return; if (mMainView.getContentWidth() <= 0 || mMainView.getContentHeight() <= 0) { |