diff options
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewChromium.java | 8 | ||||
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java index 6cf4238..49c37c7 100644 --- a/chromium/java/com/android/webview/chromium/WebViewChromium.java +++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java @@ -250,9 +250,9 @@ class WebViewChromium implements WebViewProvider, mWebView.getContext(), isAccessFromFileURLsGrantedByDefault, areLegacyQuirksEnabled)); - if (mAppTargetSdkVersion <= Build.VERSION_CODES.KITKAT) { + if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) { + // Prior to Lollipop we always allowed third party cookies and mixed content. mWebSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - // On KK and older versions we always allowed third party cookies. mWebSettings.setAcceptThirdPartyCookies(true); mWebSettings.getAwSettings().setZeroLayoutHeightDisablesViewportQuirk(true); } @@ -321,8 +321,8 @@ class WebViewChromium implements WebViewProvider, AwContentsStatics.setRecordFullDocument(sRecordWholeDocumentEnabledByApi || mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP); - if (mAppTargetSdkVersion <= Build.VERSION_CODES.KITKAT) { - // On KK and older versions, JavaScript objects injected via addJavascriptInterface + if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) { + // Prior to Lollipop, JavaScript objects injected via addJavascriptInterface // were not inspectable. mAwContents.disableJavascriptInterfacesInspection(); } diff --git a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java index 6b4b894..f3351c5 100644 --- a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java +++ b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java @@ -911,14 +911,23 @@ public class WebViewContentsClientAdapter extends AwContentsClient { uploadFileCallback.onReceiveValue(s); } }; + + // Invoke the new callback introduced in Lollipop. If the app handles + // it, we're done here. if (mWebChromeClient.onShowFileChooser(mWebView, callbackAdapter, adapter)) { return; } - if (mWebView.getContext().getApplicationInfo().targetSdkVersion > - Build.VERSION_CODES.KITKAT) { + + // If the app did not handle it and we are running on Lollipop or newer, then + // abort. + if (mWebView.getContext().getApplicationInfo().targetSdkVersion >= + Build.VERSION_CODES.LOLLIPOP) { uploadFileCallback.onReceiveValue(null); return; } + + // Otherwise, for older apps, attempt to invoke the legacy (hidden) API for + // backwards compatibility. ValueCallback<Uri> innerCallback = new ValueCallback<Uri>() { private boolean mCompleted; @Override |