summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/android/jni')
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.cpp12
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
index c1c8d96..f243b09 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -839,22 +839,24 @@ WebFrame::canHandleRequest(const WebCore::ResourceRequest& request)
if (!javaFrame.get())
return true;
- // always handle "POST" in place
+ // Always handle "POST" in place
if (equalIgnoringCase(request.httpMethod(), "POST"))
return true;
const WebCore::KURL& requestUrl = request.url();
const WTF::String& url = requestUrl.string();
- // Empty urls should not be sent to java
+ // Empty URLs should not be sent to Java
if (url.isEmpty())
return true;
jstring jUrlStr = wtfStringToJstring(env, url);
- // check to see whether browser app wants to hijack url loading.
- // if browser app handles the url, we will return false to bail out WebCore loading
+ // Delegate to the Java side to make the decision. Note that the sense of
+ // the return value of the Java method is reversed. It will return true if
+ // the embedding application wishes to hijack the load and hence the WebView
+ // should _not_ proceed with the load.
jboolean ret = env->CallBooleanMethod(javaFrame.get(), mJavaFrame->mHandleUrl, jUrlStr);
checkException(env);
env->DeleteLocalRef(jUrlStr);
- return (ret == 0);
+ return ret == JNI_FALSE;
}
bool
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.h b/Source/WebKit/android/jni/WebCoreFrameBridge.h
index 99ca459..e49bf35 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.h
@@ -99,6 +99,8 @@ class WebFrame : public WebCoreRefObject {
void updateVisitedHistory(const WebCore::KURL& url, bool reload);
+ // Used to determine whether the WebView should handle the given request.
+ // Returns true if it should handle it, otherwise false.
virtual bool canHandleRequest(const WebCore::ResourceRequest& request);
WebCore::Frame* createWindow(bool dialog, bool userGesture);