summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebKit/android/jni/WebViewCore.cpp47
-rw-r--r--WebKit/android/jni/WebViewCore.h14
2 files changed, 41 insertions, 20 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index d41b3a8..ac47cbf 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -257,7 +257,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_requestKeyboard = GetJMethod(env, clazz, "requestKeyboard", "(Z)V");
m_javaGlue->m_exceededDatabaseQuota = GetJMethod(env, clazz, "exceededDatabaseQuota", "(Ljava/lang/String;Ljava/lang/String;JJ)V");
m_javaGlue->m_reachedMaxAppCacheSize = GetJMethod(env, clazz, "reachedMaxAppCacheSize", "(J)V");
- m_javaGlue->m_populateVisitedLinks = GetJMethod(env, clazz, "populateVisitedLinks", "()[Ljava/lang/String;");
+ m_javaGlue->m_populateVisitedLinks = GetJMethod(env, clazz, "populateVisitedLinks", "()V");
m_javaGlue->m_geolocationPermissionsShowPrompt = GetJMethod(env, clazz, "geolocationPermissionsShowPrompt", "(Ljava/lang/String;)V");
m_javaGlue->m_geolocationPermissionsHidePrompt = GetJMethod(env, clazz, "geolocationPermissionsHidePrompt", "()V");
m_javaGlue->m_addMessageToConsole = GetJMethod(env, clazz, "addMessageToConsole", "(Ljava/lang/String;ILjava/lang/String;)V");
@@ -336,6 +336,7 @@ void WebViewCore::reset(bool fromConstructor)
m_scrollOffsetY = 0;
m_screenWidth = 0;
m_screenHeight = 0;
+ m_groupForVisitedLinks = NULL;
}
static bool layoutIfNeededRecursive(WebCore::Frame* f)
@@ -2090,23 +2091,12 @@ void WebViewCore::reachedMaxAppCacheSize(const unsigned long long spaceNeeded)
void WebViewCore::populateVisitedLinks(WebCore::PageGroup* group)
{
+ m_groupForVisitedLinks = group;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- jobjectArray array = static_cast<jobjectArray>(env->CallObjectMethod(m_javaGlue->object(env).get(), m_javaGlue->m_populateVisitedLinks));
- if (!array)
- return;
- jsize len = env->GetArrayLength(array);
- for (jsize i = 0; i < len; i++) {
- jstring item = static_cast<jstring>(env->GetObjectArrayElement(array, i));
- const UChar* str = static_cast<const UChar*>(env->GetStringChars(item, NULL));
- jsize len = env->GetStringLength(item);
- group->addVisitedLink(str, len);
- env->ReleaseStringChars(item, str);
- env->DeleteLocalRef(item);
- }
- env->DeleteLocalRef(array);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_populateVisitedLinks);
+ checkException(env);
}
-
void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
@@ -2434,6 +2424,12 @@ static void SaveDocumentState(JNIEnv *env, jobject obj, jint frame)
viewImpl->saveDocumentState((WebCore::Frame*) frame);
}
+void WebViewCore::addVisitedLink(const UChar* string, int length)
+{
+ if (m_groupForVisitedLinks)
+ m_groupForVisitedLinks->addVisitedLink(string, length);
+}
+
static bool RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt)
{
#ifdef ANDROID_INSTRUMENT
@@ -2790,6 +2786,25 @@ static void FreeMemory(JNIEnv* env, jobject obj)
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
}
+static void ProvideVisitedHistory(JNIEnv *env, jobject obj, jobject hist)
+{
+ WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
+ LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__);
+
+ jobjectArray array = static_cast<jobjectArray>(hist);
+
+ jsize len = env->GetArrayLength(array);
+ for (jsize i = 0; i < len; i++) {
+ jstring item = static_cast<jstring>(env->GetObjectArrayElement(array, i));
+ const UChar* str = static_cast<const UChar*>(env->GetStringChars(item, NULL));
+ jsize len = env->GetStringLength(item);
+ viewImpl->addVisitedLink(str, len);
+ env->ReleaseStringChars(item, str);
+ env->DeleteLocalRef(item);
+ }
+ env->DeleteLocalRef(array);
+}
+
// ----------------------------------------------------------------------------
/*
@@ -2877,6 +2892,8 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
{ "nativeUpdatePluginState", "(III)V", (void*) UpdatePluginState },
{ "nativeUpdateFrameCacheIfLoading", "()V",
(void*) UpdateFrameCacheIfLoading },
+ { "nativeProvideVisitedHistory", "([Ljava/lang/String;)V",
+ (void*) ProvideVisitedHistory },
};
int register_webviewcore(JNIEnv* env)
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index ff5e175..5d12158 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -217,11 +217,12 @@ namespace android {
*/
void reachedMaxAppCacheSize(const unsigned long long spaceNeeded);
- /**
- * Set up the PageGroup's idea of which links have been visited, with the browser history.
- * @param group the object to deliver the links to.
- */
- void populateVisitedLinks(WebCore::PageGroup*);
+ /**
+ * Set up the PageGroup's idea of which links have been visited,
+ * with the browser history.
+ * @param group the object to deliver the links to.
+ */
+ void populateVisitedLinks(WebCore::PageGroup*);
/**
* Instruct the browser to show a Geolocation permission prompt for the
@@ -324,6 +325,8 @@ namespace android {
void saveDocumentState(WebCore::Frame* frame);
+ void addVisitedLink(const UChar*, int);
+
// TODO: I don't like this hack but I need to access the java object in
// order to send it as a parameter to java
AutoJObject getJavaObject();
@@ -483,6 +486,7 @@ namespace android {
float m_screenWidthScale;
unsigned m_domtree_version;
bool m_check_domtree_version;
+ PageGroup* m_groupForVisitedLinks;
SkTDArray<PluginWidgetAndroid*> m_plugins;
WebCore::Timer<WebViewCore> m_pluginInvalTimer;