diff options
author | Guang Zhu <guangzhu@google.com> | 2009-05-08 15:54:24 -0700 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2009-05-08 15:54:24 -0700 |
commit | d15fb80564c4e30b088ca87fa21a03d67675c662 (patch) | |
tree | 5f21bd9e0b9baec008da85d4803411245b0866d6 | |
parent | caa864796d441dce5dc8a5373e19767af14ab12c (diff) | |
download | external_webkit-d15fb80564c4e30b088ca87fa21a03d67675c662.zip external_webkit-d15fb80564c4e30b088ca87fa21a03d67675c662.tar.gz external_webkit-d15fb80564c4e30b088ca87fa21a03d67675c662.tar.bz2 |
Added JNI binding for new onJsTimeout callback
-rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 5 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 10 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 714a7d8..7b09975 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -203,7 +203,10 @@ void ChromeClientAndroid::setStatusbarText(const String&) { notImplemented(); } // Javascript. If true is returned, the script is cancelled. // To make a device more responsive, we default to return true to disallow long running script. // This implies that some of scripts will not be completed. -bool ChromeClientAndroid::shouldInterruptJavaScript() { return true; } +bool ChromeClientAndroid::shouldInterruptJavaScript() { + FrameView* frameView = m_webFrame->page()->mainFrame()->view(); + return android::WebViewCore::getWebViewCore(frameView)->jsInterrupt(); +} bool ChromeClientAndroid::tabsToLinks() const { return false; } diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 0746e2f..40dc56d 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -153,6 +153,7 @@ struct WebViewCore::JavaGlue { jmethodID m_jsConfirm; jmethodID m_jsPrompt; jmethodID m_jsUnload; + jmethodID m_jsInterrupt; jmethodID m_didFirstLayout; jmethodID m_sendMarkNodeInvalid; jmethodID m_sendNotifyFocusSet; @@ -218,6 +219,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_jsConfirm = GetJMethod(env, clazz, "jsConfirm", "(Ljava/lang/String;Ljava/lang/String;)Z"); m_javaGlue->m_jsPrompt = GetJMethod(env, clazz, "jsPrompt", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); m_javaGlue->m_jsUnload = GetJMethod(env, clazz, "jsUnload", "(Ljava/lang/String;Ljava/lang/String;)Z"); + m_javaGlue->m_jsInterrupt = GetJMethod(env, clazz, "jsInterrupt", "()Z"); m_javaGlue->m_didFirstLayout = GetJMethod(env, clazz, "didFirstLayout", "()V"); m_javaGlue->m_sendMarkNodeInvalid = GetJMethod(env, clazz, "sendMarkNodeInvalid", "(I)V"); m_javaGlue->m_sendNotifyFocusSet = GetJMethod(env, clazz, "sendNotifyFocusSet", "()V"); @@ -1907,6 +1909,14 @@ bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& me return result; } +bool WebViewCore::jsInterrupt() +{ + JNIEnv* env = JSC::Bindings::getJNIEnv(); + jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsInterrupt); + checkException(env); + return result; +} + AutoJObject WebViewCore::getJavaObject() { diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index a2d7395..8f035f2 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -171,6 +171,7 @@ namespace android { bool jsPrompt(const WebCore::String& url, const WebCore::String& message, const WebCore::String& defaultValue, WebCore::String& result); bool jsUnload(const WebCore::String& url, const WebCore::String& message); + bool jsInterrupt(); // // Followings support calls from Java to native WebCore |