jobject NewJNIStringVector(JNIEnv* env, const std::vector<CefString>& vals) { jobject jvector = NewJNIObject(env, "java/util/Vector"); if (!jvector) return NULL; std::vector<CefString>::const_iterator iter; for (iter = vals.begin(); iter != vals.end(); ++iter) { AddJNIStringToVector(env, jvector, *iter); } return jvector; }
JNIEXPORT jboolean JNICALL Java_org_cef_callback_CefContextMenuParams_1N_N_1GetDictionarySuggestions (JNIEnv *env, jobject obj, jobject jsuggestions) { CefRefPtr<CefContextMenuParams> menuParams = GetCefFromJNIObject<CefContextMenuParams>(env, obj, "CefContextMenuParams"); if (!menuParams.get()) return false; std::vector<CefString> suggestions; bool result = menuParams->GetDictionarySuggestions(suggestions); if (!result) return JNI_FALSE; for (std::vector<CefString>::size_type i=0; i<suggestions.size(); ++i) { AddJNIStringToVector(env, jsuggestions, suggestions.at(i)); } return JNI_TRUE; }