diff options
author | Grace Kloba <klobag@google.com> | 2009-05-26 10:28:10 -0700 |
---|---|---|
committer | Grace Kloba <klobag@google.com> | 2009-05-26 10:28:10 -0700 |
commit | 07d13e783c3a839b3308d50a4b5941223575764d (patch) | |
tree | df1aa9413a1efbc598adf2c31e2e26abbb5cc85f | |
parent | d8a47b507e3cf0291362a758983c233217cf5443 (diff) | |
download | external_webkit-07d13e783c3a839b3308d50a4b5941223575764d.zip external_webkit-07d13e783c3a839b3308d50a4b5941223575764d.tar.gz external_webkit-07d13e783c3a839b3308d50a4b5941223575764d.tar.bz2 |
Added postUrl() to WebView so that we can pass lat/lon for the search.
-rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index d61fda4..8c3f69e 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -811,6 +811,29 @@ static void LoadUrl(JNIEnv *env, jobject obj, jstring url) pFrame->loader()->load(request, false); } +static void PostUrl(JNIEnv *env, jobject obj, jstring url, jbyteArray postData) +{ +#ifdef ANDROID_INSTRUMENT + TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); +#endif + WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); + LOG_ASSERT(pFrame, "nativePostUrl must take a valid frame pointer!"); + + WebCore::KURL kurl(WebCore::KURL(), to_string(env, url)); + WebCore::ResourceRequest request(kurl); + request.setHTTPContentType("application/x-www-form-urlencoded"); + + if (postData) { + jsize size = env->GetArrayLength(postData); + jbyte* bytes = env->GetByteArrayElements(postData, NULL); + request.setHTTPBody(WebCore::FormData::create((const void*)bytes, size)); + env->ReleaseByteArrayElements(postData, bytes, 0); + } + + LOGV("PostUrl %s", kurl.string().latin1().data()); + pFrame->loader()->loadPostRequest(request, String(), String(), false, + WebCore::FrameLoadTypeStandard, 0, 0, true); +} static void LoadData(JNIEnv *env, jobject obj, jstring baseUrl, jstring data, jstring mimeType, jstring encoding, jstring failUrl) @@ -1292,6 +1315,8 @@ static JNINativeMethod gBrowserFrameNativeMethods[] = { (void*) StopLoading }, { "nativeLoadUrl", "(Ljava/lang/String;)V", (void*) LoadUrl }, + { "nativePostUrl", "(Ljava/lang/String;[B)V", + (void*) PostUrl }, { "nativeLoadData", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", (void*) LoadData }, { "externalRepresentation", "()Ljava/lang/String;", |