| 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();
|
| + }
|
| }
|
|
|