| Index: chrome/browser/spellchecker/spellcheck_service.cc
|
| diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc
|
| index d21e463e7feff492ef69a4e9543c6a7b6cdf4abd..c2646edee9f06eca7aad0167a5bf34da2a920b41 100644
|
| --- a/chrome/browser/spellchecker/spellcheck_service.cc
|
| +++ b/chrome/browser/spellchecker/spellcheck_service.cc
|
| @@ -11,16 +11,17 @@
|
| #include "base/supports_user_data.h"
|
| #include "base/synchronization/waitable_event.h"
|
| #include "build/build_config.h"
|
| -#include "chrome/browser/spellchecker/feedback_sender.h"
|
| +#include "components/spellcheck/browser/feedback_sender.h"
|
| #include "chrome/browser/spellchecker/spellcheck_factory.h"
|
| -#include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
|
| +#include "components/spellcheck/browser/spellcheck_host_metrics.h"
|
| #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h"
|
| -#include "chrome/browser/spellchecker/spellcheck_platform.h"
|
| -#include "chrome/browser/spellchecker/spelling_service_client.h"
|
| +#include "components/spellcheck/browser/spellcheck_platform.h"
|
| +#include "components/spellcheck/browser/spelling_service_client.h"
|
| #include "chrome/common/pref_names.h"
|
| -#include "chrome/common/spellcheck_bdict_language.h"
|
| -#include "chrome/common/spellcheck_common.h"
|
| -#include "chrome/common/spellcheck_messages.h"
|
| +#include "components/spellcheck/browser/pref_names.h"
|
| +#include "components/spellcheck/common/spellcheck_bdict_language.h"
|
| +#include "components/spellcheck/common/spellcheck_common.h"
|
| +#include "components/spellcheck/common/spellcheck_messages.h"
|
| #include "components/prefs/pref_member.h"
|
| #include "components/prefs/pref_service.h"
|
| #include "components/user_prefs/user_prefs.h"
|
| @@ -49,7 +50,7 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context)
|
| PrefService* prefs = user_prefs::UserPrefs::Get(context);
|
| pref_change_registrar_.Init(prefs);
|
| StringListPrefMember dictionaries_pref;
|
| - dictionaries_pref.Init(prefs::kSpellCheckDictionaries, prefs);
|
| + dictionaries_pref.Init(spellcheck::prefs::kSpellCheckDictionaries, prefs);
|
| std::string first_of_dictionaries;
|
|
|
| #if defined(USE_BROWSER_SPELLCHECKER)
|
| @@ -66,7 +67,7 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context)
|
| #else
|
| // Migrate preferences from single-language to multi-language schema.
|
| StringPrefMember single_dictionary_pref;
|
| - single_dictionary_pref.Init(prefs::kSpellCheckDictionary, prefs);
|
| + single_dictionary_pref.Init(spellcheck::prefs::kSpellCheckDictionary, prefs);
|
| std::string single_dictionary = single_dictionary_pref.GetValue();
|
|
|
| if (!dictionaries_pref.GetValue().empty())
|
| @@ -83,7 +84,7 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context)
|
|
|
| std::string language_code;
|
| std::string country_code;
|
| - chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale(
|
| + spellcheck_common::GetISOLanguageCountryCodeFromLocale(
|
| first_of_dictionaries,
|
| &language_code,
|
| &country_code);
|
| @@ -93,11 +94,11 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context)
|
| language_code, country_code));
|
|
|
| pref_change_registrar_.Add(
|
| - prefs::kSpellCheckDictionaries,
|
| + spellcheck::prefs::kSpellCheckDictionaries,
|
| base::Bind(&SpellcheckService::OnSpellCheckDictionariesChanged,
|
| base::Unretained(this)));
|
| pref_change_registrar_.Add(
|
| - prefs::kSpellCheckUseSpellingService,
|
| + spellcheck::prefs::kSpellCheckUseSpellingService,
|
| base::Bind(&SpellcheckService::OnUseSpellingServiceChanged,
|
| base::Unretained(this)));
|
| pref_change_registrar_.Add(
|
| @@ -105,7 +106,7 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context)
|
| base::Bind(&SpellcheckService::OnAcceptLanguagesChanged,
|
| base::Unretained(this)));
|
| pref_change_registrar_.Add(
|
| - prefs::kEnableContinuousSpellcheck,
|
| + spellcheck::prefs::kEnableContinuousSpellcheck,
|
| base::Bind(&SpellcheckService::InitForAllRenderers,
|
| base::Unretained(this)));
|
|
|
| @@ -136,7 +137,7 @@ void SpellcheckService::GetDictionaries(base::SupportsUserData* browser_context,
|
| std::vector<Dictionary>* dictionaries) {
|
| PrefService* prefs = user_prefs::UserPrefs::Get(browser_context);
|
| std::set<std::string> spellcheck_dictionaries;
|
| - for (const auto& value : *prefs->GetList(prefs::kSpellCheckDictionaries)) {
|
| + for (const auto& value : *prefs->GetList(spellcheck::prefs::kSpellCheckDictionaries)) {
|
| std::string dictionary;
|
| if (value->GetAsString(&dictionary))
|
| spellcheck_dictionaries.insert(dictionary);
|
| @@ -149,7 +150,7 @@ void SpellcheckService::GetDictionaries(base::SupportsUserData* browser_context,
|
| for (const auto& accept_language : accept_languages) {
|
| Dictionary dictionary;
|
| dictionary.language =
|
| - chrome::spellcheck_common::GetCorrespondingSpellCheckLanguage(
|
| + spellcheck_common::GetCorrespondingSpellCheckLanguage(
|
| accept_language);
|
| if (dictionary.language.empty())
|
| continue;
|
| @@ -200,7 +201,7 @@ void SpellcheckService::InitForRenderer(content::RenderProcessHost* process) {
|
| : IPC::InvalidPlatformFileForTransit();
|
| }
|
|
|
| - bool enabled = prefs->GetBoolean(prefs::kEnableContinuousSpellcheck) &&
|
| + bool enabled = prefs->GetBoolean(spellcheck::prefs::kEnableContinuousSpellcheck) &&
|
| !bdict_languages.empty();
|
| process->Send(new SpellCheckMsg_Init(
|
| bdict_languages,
|
| @@ -223,7 +224,7 @@ void SpellcheckService::LoadHunspellDictionaries() {
|
| DCHECK(prefs);
|
|
|
| const base::ListValue* dictionary_values =
|
| - prefs->GetList(prefs::kSpellCheckDictionaries);
|
| + prefs->GetList(spellcheck::prefs::kSpellCheckDictionaries);
|
|
|
| for (const auto& dictionary_value : *dictionary_values) {
|
| std::string dictionary;
|
| @@ -336,7 +337,7 @@ void SpellcheckService::OnSpellCheckDictionariesChanged() {
|
|
|
| void SpellcheckService::OnUseSpellingServiceChanged() {
|
| bool enabled = pref_change_registrar_.prefs()->GetBoolean(
|
| - prefs::kSpellCheckUseSpellingService);
|
| + spellcheck::prefs::kSpellCheckUseSpellingService);
|
| if (metrics_)
|
| metrics_->RecordSpellingServiceStats(enabled);
|
| UpdateFeedbackSenderState();
|
| @@ -350,10 +351,10 @@ void SpellcheckService::OnAcceptLanguagesChanged() {
|
| std::transform(
|
| accept_languages.begin(), accept_languages.end(),
|
| accept_languages.begin(),
|
| - &chrome::spellcheck_common::GetCorrespondingSpellCheckLanguage);
|
| + &spellcheck_common::GetCorrespondingSpellCheckLanguage);
|
|
|
| StringListPrefMember dictionaries_pref;
|
| - dictionaries_pref.Init(prefs::kSpellCheckDictionaries, prefs);
|
| + dictionaries_pref.Init(spellcheck::prefs::kSpellCheckDictionaries, prefs);
|
| std::vector<std::string> dictionaries = dictionaries_pref.GetValue();
|
| std::vector<std::string> filtered_dictionaries;
|
|
|
| @@ -373,7 +374,7 @@ void SpellcheckService::UpdateFeedbackSenderState() {
|
| feedback_language = hunspell_dictionaries_.front()->GetLanguage();
|
| std::string language_code;
|
| std::string country_code;
|
| - chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale(
|
| + spellcheck_common::GetISOLanguageCountryCodeFromLocale(
|
| feedback_language, &language_code, &country_code);
|
| feedback_sender_->OnLanguageCountryChange(language_code, country_code);
|
| if (SpellingServiceClient::IsAvailable(
|
|
|