summaryrefslogtreecommitdiff
path: root/chromium
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-10-23 17:36:32 +0100
committerBen Murdoch <benm@google.com>2014-11-18 19:47:32 +0000
commitce259207909174ed4c1654964a0f448bc275197d (patch)
tree653bd676bb030ec715410ff394a846d80ab8fe76 /chromium
parent86972eac40c7eb99bfd7621ba78586ed4d87ba52 (diff)
downloadwebview-ce259207909174ed4c1654964a0f448bc275197d.tar.gz
Fix reflection for detecting fullscreen API support.
We need to check the class hierarchy for the methods, all the way up to the direct child of WebChromeClient. Bug: 18099831 Change-Id: Ib1c647643e601015eb1bc16c613d51aca4cf38c6 (cherry picked from commit 9f3473ac53192eca3e10c9a1dd3614dea48ea8a7)
Diffstat (limited to 'chromium')
-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 6cf4238..b38c40d 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