diff options
author | Paul Miller <paulmiller@google.com> | 2015-02-12 22:46:31 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-12 22:46:31 +0000 |
commit | b011709b1cf4cfe511019fe9f5adc3d8a6281fd1 (patch) | |
tree | a43b27cfd241831431caeea8f7b5bf2579d41820 /src/com/android | |
parent | 76ec5b74168a34316a16987ee9a77a833bc3edbe (diff) | |
parent | 28994826925a627992d3140328e607ae85194edb (diff) | |
download | packages_apps_Browser-b011709b1cf4cfe511019fe9f5adc3d8a6281fd1.zip packages_apps_Browser-b011709b1cf4cfe511019fe9f5adc3d8a6281fd1.tar.gz packages_apps_Browser-b011709b1cf4cfe511019fe9f5adc3d8a6281fd1.tar.bz2 |
am 28994826: am f88fc286: Merge "Show JS alerts over their origin tab"
* commit '28994826925a627992d3140328e607ae85194edb':
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) { |