| 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 9e4d0e479847980ed87569f7ab03587a9974f2e9..19edbb36d366998bd3a9397fe1db929c54e249a6 100644
|
| --- a/chrome/browser/spellchecker/spellcheck_message_filter.cc
|
| +++ b/chrome/browser/spellchecker/spellcheck_message_filter.cc
|
| @@ -9,13 +9,11 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| -#include "chrome/browser/spellchecker/feedback_sender.h"
|
| #include "chrome/browser/spellchecker/spellcheck_factory.h"
|
| #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
|
| #include "chrome/browser/spellchecker/spellcheck_service.h"
|
| #include "chrome/browser/spellchecker/spelling_service_client.h"
|
| #include "components/prefs/pref_service.h"
|
| -#include "components/spellcheck/common/spellcheck_marker.h"
|
| #include "components/spellcheck/common/spellcheck_messages.h"
|
| #include "content/public/browser/render_process_host.h"
|
| #include "net/url_request/url_fetcher.h"
|
| @@ -34,8 +32,7 @@ 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_RespondDocumentMarkers::ID)
|
| + message.type() == SpellCheckHostMsg_NotifyChecked::ID)
|
| *thread = BrowserThread::UI;
|
| #if !defined(USE_BROWSER_SPELLCHECKER)
|
| if (message.type() == SpellCheckHostMsg_CallSpellingService::ID)
|
| @@ -50,8 +47,6 @@ bool SpellCheckMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
| OnSpellCheckerRequestDictionary)
|
| IPC_MESSAGE_HANDLER(SpellCheckHostMsg_NotifyChecked,
|
| OnNotifyChecked)
|
| - IPC_MESSAGE_HANDLER(SpellCheckHostMsg_RespondDocumentMarkers,
|
| - OnRespondDocumentMarkers)
|
| #if !defined(USE_BROWSER_SPELLCHECKER)
|
| IPC_MESSAGE_HANDLER(SpellCheckHostMsg_CallSpellingService,
|
| OnCallSpellingService)
|
| @@ -95,39 +90,19 @@ void SpellCheckMessageFilter::OnNotifyChecked(const base::string16& word,
|
| spellcheck->GetMetrics()->RecordCheckedWordStats(word, misspelled);
|
| }
|
|
|
| -void SpellCheckMessageFilter::OnRespondDocumentMarkers(
|
| - const std::vector<uint32_t>& 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(USE_BROWSER_SPELLCHECKER)
|
| void SpellCheckMessageFilter::OnCallSpellingService(
|
| int route_id,
|
| int identifier,
|
| - const base::string16& text,
|
| - std::vector<SpellCheckMarker> markers) {
|
| + const base::string16& text) {
|
| DCHECK(!text.empty());
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
| - // Erase invalid markers (with offsets out of boundaries of text length).
|
| - markers.erase(
|
| - std::remove_if(
|
| - markers.begin(),
|
| - markers.end(),
|
| - std::not1(SpellCheckMarker::IsValidPredicate(text.length()))),
|
| - markers.end());
|
| - CallSpellingService(text, route_id, identifier, markers);
|
| + CallSpellingService(text, route_id, identifier);
|
| }
|
|
|
| void SpellCheckMessageFilter::OnTextCheckComplete(
|
| int route_id,
|
| int identifier,
|
| - const std::vector<SpellCheckMarker>& markers,
|
| bool success,
|
| const base::string16& text,
|
| const std::vector<SpellCheckResult>& results) {
|
| @@ -137,21 +112,16 @@ 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 and record
|
| - // in-dictionary feedback.
|
| + // Erase custom dictionary words from the spellcheck results.
|
| 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;
|
| @@ -168,8 +138,7 @@ void SpellCheckMessageFilter::OnTextCheckComplete(
|
| void SpellCheckMessageFilter::CallSpellingService(
|
| const base::string16& text,
|
| int route_id,
|
| - int identifier,
|
| - const std::vector<SpellCheckMarker>& markers) {
|
| + int identifier) {
|
| content::RenderProcessHost* host =
|
| content::RenderProcessHost::FromID(render_process_id_);
|
|
|
| @@ -180,8 +149,7 @@ void SpellCheckMessageFilter::CallSpellingService(
|
| base::Bind(&SpellCheckMessageFilter::OnTextCheckComplete,
|
| base::Unretained(this),
|
| route_id,
|
| - identifier,
|
| - markers));
|
| + identifier));
|
| }
|
| #endif
|
|
|
|
|