diff options
author | Ben Murdoch <benm@google.com> | 2014-11-18 20:05:29 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-11-18 20:05:29 +0000 |
commit | 70c1e9cf968bf2b99a1249c32335a6ff84b2dd43 (patch) | |
tree | cee52944031f30e15c5893c612fafbaf85c336a7 /chromium/java | |
parent | df1c654aba5a23d37fef47e5376694b8c55b9e30 (diff) | |
parent | ce259207909174ed4c1654964a0f448bc275197d (diff) | |
download | webview-70c1e9cf968bf2b99a1249c32335a6ff84b2dd43.tar.gz |
Merge "Fix reflection for detecting fullscreen API support." into master-chromium
Diffstat (limited to 'chromium/java')
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewChromium.java | 32 |
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 |