diff options
author | Paul Miller <paulmiller@google.com> | 2015-02-12 22:41:47 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-12 22:41:47 +0000 |
commit | 28994826925a627992d3140328e607ae85194edb (patch) | |
tree | 97dc99bad5c84596431318763cd82ebd45742aef /src/com/android | |
parent | f463f0438f98bae6c8d5d909f09a7807162e9ae9 (diff) | |
parent | f88fc2863c2b42e254729fd1fab2808dcaa16b39 (diff) | |
download | packages_apps_Browser-28994826925a627992d3140328e607ae85194edb.zip packages_apps_Browser-28994826925a627992d3140328e607ae85194edb.tar.gz packages_apps_Browser-28994826925a627992d3140328e607ae85194edb.tar.bz2 |
am f88fc286: Merge "Show JS alerts over their origin tab"
* commit 'f88fc2863c2b42e254729fd1fab2808dcaa16b39':
Show JS alerts over their origin tab
Diffstat (limited to 'src/com/android')
-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) { |