summaryrefslogtreecommitdiffstats
path: root/android_webview/glue
diff options
context:
space:
mode:
authorBo Liu <boliu@chromium.org>2016-02-26 16:11:54 -0800
committerBo Liu <boliu@chromium.org>2016-02-27 00:14:33 +0000
commit62e7a7602f336fe1220a3408f1148fa2a12bbbb8 (patch)
treed7d0405337a929c2a5f21bd4dc9b08732431fe03 /android_webview/glue
parent7a6e72378b383474ed95c94aec8aa93ea593bd24 (diff)
downloadchromium_src-62e7a7602f336fe1220a3408f1148fa2a12bbbb8.zip
chromium_src-62e7a7602f336fe1220a3408f1148fa2a12bbbb8.tar.gz
chromium_src-62e7a7602f336fe1220a3408f1148fa2a12bbbb8.tar.bz2
[Merge M49] aw: Fix alert dialog
Need to unwrap Context into Activity because JsDialogHelper implementation in android is broken. BUG=590327 Review URL: https://codereview.chromium.org/1736413002 Cr-Commit-Position: refs/heads/master@{#378028} (cherry picked from commit 20b8e70c4e666e12b016baed56b5522bb3b7d22a) Review URL: https://codereview.chromium.org/1737033006 . Cr-Commit-Position: refs/branch-heads/2623@{#528} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907}
Diffstat (limited to 'android_webview/glue')
-rw-r--r--android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
index a08e755..1d28526 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
@@ -878,14 +878,15 @@ public class WebViewContentsClientAdapter extends AwContentsClient {
*/
private boolean showDefaultJsDialog(JsPromptResult res, int jsDialogType, String defaultValue,
String message, String url) {
- if (AwContents.activityFromContext(mContext) == null) {
+ // Note we must unwrap the Context here due to JsDialogHelper only using instanceof to
+ // check if a Context is an Activity.
+ Context activityContext = AwContents.activityFromContext(mContext);
+ if (activityContext == null) {
+ Log.w(TAG, "Unable to create JsDialog without an Activity");
return false;
}
- // TODO(igsolla): the activity context should be retrieved inside JsDialogHelper.showDialog
- // but for that we need it to return a boolean. Also, doing it here means that we can fix
- // problem 2 in crbug/447607 before M is released.
new JsDialogHelper(res, jsDialogType, defaultValue, message, url)
- .showDialog(mContext);
+ .showDialog(activityContext);
return true;
}