Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1422)

Unified Diff: chrome/browser/spellchecker/spellcheck_message_filter_platform.h

Issue 1244443005: Patch 5: Implemented android message filter and platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@4_remove_mac_redundancies
Patch Set: 1:1 SpellingRequest/JavaObject relationship, slow when spammed Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/spellchecker/spellcheck_message_filter_platform.h
diff --git a/chrome/browser/spellchecker/spellcheck_message_filter_platform.h b/chrome/browser/spellchecker/spellcheck_message_filter_platform.h
index a632112734b42457585b725c12f53d7b976d3a3a..f927f8496de19aeb85f42cee01a8c162d6c9a530 100644
--- a/chrome/browser/spellchecker/spellcheck_message_filter_platform.h
+++ b/chrome/browser/spellchecker/spellcheck_message_filter_platform.h
@@ -10,6 +10,10 @@
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
#include "chrome/common/spellcheck_result.h"
#include "content/public/browser/browser_message_filter.h"
+#include "base/android/jni_android.h"
+#include "base/android/jni_array.h"
+#include "base/android/jni_string.h"
+
// A message filter implementation that receives
// the platform-specific spell checker requests from SpellCheckProvider.
@@ -57,4 +61,40 @@ class SpellCheckMessageFilterPlatform : public content::BrowserMessageFilter {
DISALLOW_COPY_AND_ASSIGN(SpellCheckMessageFilterPlatform);
};
+class SpellingRequest {
+ public:
+ SpellingRequest(content::BrowserMessageFilter* destination,
+ int render_process_id);
+
+ void RequestCheck(const base::string16& text,
+ int route_id,
+ int identifier);
+
+ void GetSpellcheckInfo(JNIEnv* env, jobject jobj, jobjectArray suggestionsArray,
+ jintArray offsetArray, jintArray lengthArray);
+ private:
+
+ // Request a check for |text_| from local spell checker.
+ void RequestLocalCheck();
+
+ // Check if all pending requests are done, send reply to render process if so.
+ void OnCheckCompleted();
+
+ bool RegisterSpellingRequest(JNIEnv* env);
+
+ std::vector<SpellCheckResult> local_results_;
+
+ base::android::ScopedJavaGlobalRef<jobject> java_object_;
+
+ // Barrier closure for completion of both remote and local check.
+ base::Closure completion_barrier_;
+
+ content::BrowserMessageFilter* destination_; // ref-counted.
+ int render_process_id_;
+
+ base::string16 text_;
+ int route_id_;
+ int identifier_;
+};
+
#endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_PLATFORM_H_

Powered by Google App Engine
This is Rietveld 408576698