Index: chrome/browser/spellchecker/spellcheck_platform_android.cc |
diff --git a/chrome/browser/spellchecker/spellcheck_platform_android.cc b/chrome/browser/spellchecker/spellcheck_platform_android.cc |
index a0c338f66d0d6960372ae83adc6df73a78de22ab..aa496752c62ac51fefbc7dbbb726e583fd89fd7f 100644 |
--- a/chrome/browser/spellchecker/spellcheck_platform_android.cc |
+++ b/chrome/browser/spellchecker/spellcheck_platform_android.cc |
@@ -4,9 +4,21 @@ |
#include "chrome/browser/spellchecker/spellcheck_platform.h" |
+//#include "base/android/jni_android.h" |
+//#include "base/android/jni_array.h" |
+//#include "base/android/jni_string.h" |
#include "base/callback.h" |
#include "base/command_line.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/common/spellcheck_result.h" |
+//#include "jni/SpellCheckerSessionBridge_jni.h" |
+ |
+namespace { |
+ //std::vector<int> offsets; |
+ //std::vector<int> lengths; |
+ //base::android::ScopedJavaGlobalRef<jobject> java_object_; |
+ //base::Callback<void(const std::vector<SpellCheckResult>&)> callback_; |
+} // namespace |
namespace spellcheck_platform { |
@@ -15,7 +27,7 @@ void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages) { |
bool SpellCheckerAvailable() { |
return base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableAndroidSpellChecker); |
+ switches::kEnableAndroidSpellChecker); |
} |
bool SpellCheckerProvidesPanel() { |
@@ -40,7 +52,7 @@ void SetLanguage(const std::string& lang_to_set) { |
} |
bool CheckSpelling(const base::string16& word_to_check, int tag) { |
- return true; |
+ return true; |
} |
void FillSuggestionList(const base::string16& wrong_word, |
@@ -66,7 +78,48 @@ void CloseDocumentWithTag(int tag) { |
void RequestTextCheck(int document_tag, |
const base::string16& text, |
TextCheckCompleteCallback callback) { |
+ //JNIEnv* env = base::android::AttachCurrentThread(); |
+ //callback_ = callback; |
+ LOG(ERROR) << "DYLANKING RequestTextCheck on " << text; |
+ //Java_SpellCheckerSessionBridge_checkSpelling(env, java_object_.obj(), |
+ //base::android::ConvertUTF16ToJavaString(env, text).obj()); |
+} |
+ |
+/* |
+void InitializeJNIBridge() { |
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ java_object_.Reset( |
+ Java_SpellCheckerSessionBridge_create(env)); |
+} |
+ |
+//static |
+bool RegisterSpellcheckPlatformAndroid(JNIEnv* env) { |
+ return RegisterNativesImpl(env); |
+} |
+ |
+//static |
+void GetSpellcheckInfo(JNIEnv* env, jobject jobj, jobjectArray suggestionsArray, |
+ jintArray offsetArray, jintArray lengthArray){ |
+ |
+ LOG(ERROR) << "DYLANKING In Native GetSpellcheckInfo"; |
+ std::vector<SpellCheckResult> check_results; |
+ std::vector<base::string16> optional_suggestions; |
+ base::android::AppendJavaStringArrayToStringVector(env, suggestionsArray, &optional_suggestions); |
+ |
+ for(unsigned int i = 0; i < optional_suggestions.size(); i++){ |
+ LOG(ERROR) << "DYLANKING " << optional_suggestions[i]; |
+ } |
+ |
+ base::android::JavaIntArrayToIntVector(env, offsetArray, &offsets); |
+ base::android::JavaIntArrayToIntVector(env, lengthArray, &lengths); |
+ |
+ for(unsigned int j = 0; j < offsets.size(); j++){ |
+ LOG(ERROR) << "DYLANKING offset: " << offsets[j] << " length: " << lengths[j]; |
+ check_results.push_back(SpellCheckResult(SpellCheckResult::SPELLING,offsets[j],lengths[j])); |
+ } |
+ callback_.Run(check_results); |
} |
+*/ |
} // namespace spellcheck_platform |