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

Unified Diff: chrome/browser/spellchecker/spellcheck_message_filter.cc

Issue 1006953003: Revert "Remove spellcheck feedback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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.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;
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_message_filter.h ('k') | chrome/browser/spellchecker/spellcheck_message_filter_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698