diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/Tab.java | 23 | ||||
-rw-r--r-- | src/com/android/browser/TabControl.java | 6 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index a3e4a59..9734137 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -52,6 +52,8 @@ import android.webkit.CookieManager; import android.webkit.GeolocationPermissions; import android.webkit.GeolocationPermissions.Callback; import android.webkit.HttpAuthHandler; +import android.webkit.JsPromptResult; +import android.webkit.JsResult; import android.webkit.PermissionRequest; import android.webkit.SslErrorHandler; import android.webkit.URLUtil; @@ -789,6 +791,27 @@ class Tab implements PictureListener { } @Override + public boolean onJsAlert(WebView view, String url, String message, + JsResult result) { + mWebViewController.getTabControl().setActiveTab(Tab.this); + return false; + } + + @Override + public boolean onJsConfirm(WebView view, String url, String message, + JsResult result) { + mWebViewController.getTabControl().setActiveTab(Tab.this); + return false; + } + + @Override + public boolean onJsPrompt(WebView view, String url, String message, + String defaultValue, JsPromptResult result) { + mWebViewController.getTabControl().setActiveTab(Tab.this); + return false; + } + + @Override public void onProgressChanged(WebView view, int newProgress) { mPageLoadProgress = newProgress; if (newProgress == 100) { diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java index 8cb500d..2deb143 100644 --- a/src/com/android/browser/TabControl.java +++ b/src/com/android/browser/TabControl.java @@ -674,6 +674,12 @@ class TabControl { return true; } + // Used by Tab.onJsAlert() and friends + void setActiveTab(Tab tab) { + // Calls TabControl.setCurrentTab() + mController.setActiveTab(tab); + } + public void setOnThumbnailUpdatedListener(OnThumbnailUpdatedListener listener) { mOnThumbnailUpdatedListener = listener; for (Tab t : mTabs) { |