diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-26 10:33:39 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-26 10:33:39 -0700 |
commit | ea2ac40c875b133ef9d88dfbbbb587364eac8e07 (patch) | |
tree | 3767760b0a935ae923b29b4479b6a1b2c805018e | |
parent | 68e3a57b241bfb1f5725f774cbc237d0da369802 (diff) | |
parent | 07d13e783c3a839b3308d50a4b5941223575764d (diff) | |
download | external_webkit-ea2ac40c875b133ef9d88dfbbbb587364eac8e07.zip external_webkit-ea2ac40c875b133ef9d88dfbbbb587364eac8e07.tar.gz external_webkit-ea2ac40c875b133ef9d88dfbbbb587364eac8e07.tar.bz2 |
Merge change 2390
* changes:
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;", |