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

Unified Diff: components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java

Issue 2905003003: Store suggestions from Android spellchecker in spelling markers (Closed)
Patch Set: Add a fake dependency so I can stack another CL on top of this Created 3 years, 6 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
« no previous file with comments | « no previous file | components/spellcheck/browser/spellchecker_session_bridge_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
diff --git a/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java b/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
index bcedb75bc3074c77a8b088216014863df548aea7..b2ce3297cc22dd808207b23875910336a55a7a82 100644
--- a/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
+++ b/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
@@ -106,6 +106,7 @@ public class SpellCheckerSessionBridge implements SpellCheckerSessionListener {
ArrayList<Integer> offsets = new ArrayList<Integer>();
ArrayList<Integer> lengths = new ArrayList<Integer>();
+ ArrayList<String[]> suggestions = new ArrayList<String[]>();
for (SentenceSuggestionsInfo result : results) {
if (result == null) {
@@ -121,11 +122,19 @@ public class SpellCheckerSessionBridge implements SpellCheckerSessionListener {
== SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO) {
offsets.add(result.getOffsetAt(i));
lengths.add(result.getLengthAt(i));
+ SuggestionsInfo info = result.getSuggestionsInfoAt(i);
+ ArrayList<String> suggestions_for_word = new ArrayList<String>();
+ for (int j = 0; j < info.getSuggestionsCount(); ++j) {
+ suggestions_for_word.add(info.getSuggestionAt(j));
+ }
+ suggestions.add(
+ suggestions_for_word.toArray(new String[suggestions_for_word.size()]));
}
}
}
nativeProcessSpellCheckResults(mNativeSpellCheckerSessionBridge,
- convertListToArray(offsets), convertListToArray(lengths));
+ convertListToArray(offsets), convertListToArray(lengths),
+ suggestions.toArray(new String[suggestions.size()][]));
RecordHistogram.recordTimesHistogram("SpellCheck.Android.Latency",
mStopMs - mStartMs, TimeUnit.MILLISECONDS);
@@ -147,6 +156,6 @@ public class SpellCheckerSessionBridge implements SpellCheckerSessionListener {
@Override
public void onGetSuggestions(SuggestionsInfo[] results) {}
- private native void nativeProcessSpellCheckResults(
- long nativeSpellCheckerSessionBridge, int[] offsets, int[] lengths);
+ private native void nativeProcessSpellCheckResults(long nativeSpellCheckerSessionBridge,
+ int[] offsets, int[] lengths, String[][] suggestions);
}
« no previous file with comments | « no previous file | components/spellcheck/browser/spellchecker_session_bridge_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698