| Index: chrome/browser/spellchecker/spellcheck_message_filter.cc
|
| diff --git a/chrome/browser/spellchecker/spellcheck_message_filter.cc b/chrome/browser/spellchecker/spellcheck_message_filter.cc
|
| index cc5f68e4403a7acb43e1468e27fa753c3e73f4bd..30f7d5b2337bfeb25e0e24c2ad102767d5224403 100644
|
| --- a/chrome/browser/spellchecker/spellcheck_message_filter.cc
|
| +++ b/chrome/browser/spellchecker/spellcheck_message_filter.cc
|
| @@ -33,7 +33,8 @@ void SpellCheckMessageFilter::OverrideThreadForMessage(
|
| // The message filter overrides the thread for these messages because they
|
| // access spellcheck data.
|
| if (message.type() == SpellCheckHostMsg_RequestDictionary::ID ||
|
| - message.type() == SpellCheckHostMsg_NotifyChecked::ID)
|
| + message.type() == SpellCheckHostMsg_NotifyChecked::ID ||
|
| + message.type() == SpellCheckHostMsg_RespondDocumentMarkers::ID)
|
| *thread = BrowserThread::UI;
|
| #if !defined(OS_MACOSX)
|
| if (message.type() == SpellCheckHostMsg_CallSpellingService::ID)
|
| @@ -48,6 +49,8 @@ bool SpellCheckMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
| OnSpellCheckerRequestDictionary)
|
| IPC_MESSAGE_HANDLER(SpellCheckHostMsg_NotifyChecked,
|
| OnNotifyChecked)
|
| + IPC_MESSAGE_HANDLER(SpellCheckHostMsg_RespondDocumentMarkers,
|
| + OnRespondDocumentMarkers)
|
| #if !defined(OS_MACOSX)
|
| IPC_MESSAGE_HANDLER(SpellCheckHostMsg_CallSpellingService,
|
| OnCallSpellingService)
|
| @@ -91,6 +94,17 @@ void SpellCheckMessageFilter::OnNotifyChecked(const base::string16& word,
|
| spellcheck->GetMetrics()->RecordCheckedWordStats(word, misspelled);
|
| }
|
|
|
| +void SpellCheckMessageFilter::OnRespondDocumentMarkers(
|
| + const std::vector<uint32>& markers) {
|
| + SpellcheckService* spellcheck = GetSpellcheckService();
|
| + // Spellcheck service may not be available for a renderer process that is
|
| + // shutting down.
|
| + if (!spellcheck)
|
| + return;
|
| + spellcheck->GetFeedbackSender()->OnReceiveDocumentMarkers(
|
| + render_process_id_, markers);
|
| +}
|
| +
|
| #if !defined(OS_MACOSX)
|
| void SpellCheckMessageFilter::OnCallSpellingService(
|
| int route_id,
|
| @@ -122,16 +136,21 @@ void SpellCheckMessageFilter::OnTextCheckComplete(
|
| if (!spellcheck)
|
| return;
|
| std::vector<SpellCheckResult> results_copy = results;
|
| + spellcheck->GetFeedbackSender()->OnSpellcheckResults(
|
| + render_process_id_, text, markers, &results_copy);
|
|
|
| - // Erase custom dictionary words from the spellcheck results.
|
| + // Erase custom dictionary words from the spellcheck results and record
|
| + // in-dictionary feedback.
|
| std::vector<SpellCheckResult>::iterator write_iter;
|
| std::vector<SpellCheckResult>::iterator iter;
|
| std::string text_copy = base::UTF16ToUTF8(text);
|
| for (iter = write_iter = results_copy.begin();
|
| iter != results_copy.end();
|
| ++iter) {
|
| - if (!spellcheck->GetCustomDictionary()->HasWord(
|
| + if (spellcheck->GetCustomDictionary()->HasWord(
|
| text_copy.substr(iter->location, iter->length))) {
|
| + spellcheck->GetFeedbackSender()->RecordInDictionary(iter->hash);
|
| + } else {
|
| if (write_iter != iter)
|
| *write_iter = *iter;
|
| ++write_iter;
|
|
|