Chromium Code Reviews| Index: chrome/browser/spellchecker_mac.mm |
| diff --git a/chrome/browser/spellchecker_mac.mm b/chrome/browser/spellchecker_mac.mm |
| index ead554fd8292fc67c21834d33ef255643ec79d34..f182513abca84597925d19e303989148a992ccba 100644 |
| --- a/chrome/browser/spellchecker_mac.mm |
| +++ b/chrome/browser/spellchecker_mac.mm |
| @@ -208,7 +208,32 @@ void IgnoreWord(const string16& word) { |
| void CloseDocumentWithTag(int tag) { |
| [[NSSpellChecker sharedSpellChecker] |
| - closeSpellDocumentWithTag:static_cast<NSInteger>(tag)]; |
| + closeSpellDocumentWithTag:static_cast<NSInteger>(tag)]; |
| +} |
| + |
| + |
|
Hironori Bono
2011/02/09 05:43:51
nit: need one line-break between functions.
gmorrita
2011/02/10 02:15:21
Done.
|
| +void RequestTextCheck( |
| + const string16& text, int tag, |
| + Callback1<const TextCheckingResultList&>::Type* callback) { |
|
Hironori Bono
2011/02/09 05:43:51
nit: align parameters if possible.
gmorrita
2011/02/10 02:15:21
Done.
|
| + // TODO(morrita): Use [NSSpellChecker requestCheckingOfString] |
| + // when the build target goes upto 10.6 |
| + TextCheckingResultList check_results; |
| + NSString* text_to_check = base::SysUTF16ToNSString(text); |
| + size_t startingAt = 0; |
|
Hironori Bono
2011/02/09 05:43:51
nit: variable names are all lowercase. <http://goo
gmorrita
2011/02/10 02:15:21
Done.
|
| + while (startingAt < text.size()) { |
| + NSRange range = [[NSSpellChecker sharedSpellChecker] |
| + checkSpellingOfString:text_to_check startingAt:startingAt |
| + language:nil wrap:NO inSpellDocumentWithTag:tag |
| + wordCount:NULL]; |
|
Hironori Bono
2011/02/09 05:43:51
If I understand this change correctly, this code i
gmorrita
2011/02/10 02:15:21
Certainly.
So I extracted the check into a task cl
|
| + if (0 == range.length) |
| + break; |
| + check_results.push_back(TextCheckingResult( |
| + TextCheckingResult::MISSPELLING, range.location, range.length)); |
| + startingAt = range.location + range.length; |
| + } |
| + |
| + callback->Run(check_results); |
| + delete callback; |
| } |
| } // namespace SpellCheckerPlatform |