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

Unified Diff: chrome/browser/spellchecker/spellcheck_service.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
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service.h ('k') | chrome/browser/spellchecker/word_trimmer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/spellchecker/spellcheck_service.cc
diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc
index f40924e8c18e3ff48c2c981a1514e2ff5b7ce827..a0411012c86d26c1162e74392ba5301dd821b813 100644
--- a/chrome/browser/spellchecker/spellcheck_service.cc
+++ b/chrome/browser/spellchecker/spellcheck_service.cc
@@ -41,6 +41,15 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context)
PrefService* prefs = user_prefs::UserPrefs::Get(context);
pref_change_registrar_.Init(prefs);
+ std::string language_code;
+ std::string country_code;
+ chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale(
+ prefs->GetString(prefs::kSpellCheckDictionary),
+ &language_code,
+ &country_code);
+ feedback_sender_.reset(new spellcheck::FeedbackSender(
+ context->GetRequestContext(), language_code, country_code));
+
pref_change_registrar_.Add(
prefs::kEnableAutoSpellCorrect,
base::Bind(&SpellcheckService::OnEnableAutoSpellCorrectChanged,
@@ -183,6 +192,10 @@ SpellcheckHunspellDictionary* SpellcheckService::GetHunspellDictionary() {
return hunspell_dictionary_.get();
}
+spellcheck::FeedbackSender* SpellcheckService::GetFeedbackSender() {
+ return feedback_sender_.get();
+}
+
bool SpellcheckService::LoadExternalDictionary(std::string language,
std::string locale,
std::string path,
@@ -278,6 +291,12 @@ void SpellcheckService::OnSpellCheckDictionaryChanged() {
dictionary, context_->GetRequestContext(), this));
hunspell_dictionary_->AddObserver(this);
hunspell_dictionary_->Load();
+ std::string language_code;
+ std::string country_code;
+ chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale(
+ dictionary, &language_code, &country_code);
+ feedback_sender_->OnLanguageCountryChange(language_code, country_code);
+ UpdateFeedbackSenderState();
}
void SpellcheckService::OnUseSpellingServiceChanged() {
@@ -285,4 +304,14 @@ void SpellcheckService::OnUseSpellingServiceChanged() {
prefs::kSpellCheckUseSpellingService);
if (metrics_)
metrics_->RecordSpellingServiceStats(enabled);
+ UpdateFeedbackSenderState();
+}
+
+void SpellcheckService::UpdateFeedbackSenderState() {
+ if (SpellingServiceClient::IsAvailable(
+ context_, SpellingServiceClient::SPELLCHECK)) {
+ feedback_sender_->StartFeedbackCollection();
+ } else {
+ feedback_sender_->StopFeedbackCollection();
+ }
}
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service.h ('k') | chrome/browser/spellchecker/word_trimmer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698