summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chromium/java/com/android/webview/chromium/WebViewChromium.java32
1 files changed, 20 insertions, 12 deletions
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java
index 49c37c7..6e857db 100644
--- a/chromium/java/com/android/webview/chromium/WebViewChromium.java
+++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java
@@ -1348,19 +1348,27 @@ class WebViewChromium implements WebViewProvider,
if (client == null) {
return false;
}
- // If client is not a subclass of WebChromeClient then the methods have not been
- // implemented because WebChromeClient has empty implementations.
- if (client.getClass().isAssignableFrom(WebChromeClient.class)) {
- return false;
- }
- try {
- client.getClass().getDeclaredMethod("onShowCustomView", View.class,
- CustomViewCallback.class);
- client.getClass().getDeclaredMethod("onHideCustomView");
- return true;
- } catch (NoSuchMethodException e) {
- return false;
+ Class<?> clientClass = client.getClass();
+ boolean foundShowMethod = false;
+ boolean foundHideMethod = false;
+ while (clientClass != WebChromeClient.class && (!foundShowMethod || !foundHideMethod)) {
+ if (!foundShowMethod) {
+ try {
+ clientClass.getDeclaredMethod("onShowCustomView", View.class,
+ CustomViewCallback.class);
+ foundShowMethod = true;
+ } catch (NoSuchMethodException e) { }
+ }
+
+ if (!foundHideMethod) {
+ try {
+ clientClass.getDeclaredMethod("onHideCustomView");
+ foundHideMethod = true;
+ } catch (NoSuchMethodException e) { }
+ }
+ clientClass = clientClass.getSuperclass();
}
+ return foundShowMethod && foundHideMethod;
}
@Override