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");
m_scrollOffsetY = 0;
m_screenWidth = 0;
m_screenHeight = 0;
+ m_groupForVisitedLinks = NULL;
}
static bool layoutIfNeededRecursive(WebCore::Frame* f)
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();
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
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);
+}
+
// ----------------------------------------------------------------------------
/*
{ "nativeUpdatePluginState", "(III)V", (void*) UpdatePluginState },
{ "nativeUpdateFrameCacheIfLoading", "()V",
(void*) UpdateFrameCacheIfLoading },
+ { "nativeProvideVisitedHistory", "([Ljava/lang/String;)V",
+ (void*) ProvideVisitedHistory },
};
int register_webviewcore(JNIEnv* env)
*/
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
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();
float m_screenWidthScale;
unsigned m_domtree_version;
bool m_check_domtree_version;
+ PageGroup* m_groupForVisitedLinks;
SkTDArray<PluginWidgetAndroid*> m_plugins;
WebCore::Timer<WebViewCore> m_pluginInvalTimer;