From bb3f7ba2f6d10abde885904eea8bca9bee8554d6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Jun 2017 15:29:10 +0200 Subject: Fix preferences references We were using the wrong spellcheck preferences, they have moved to the spellcheck component. It mostly worked because their internal names had stayed the same. Change-Id: I485b11d88ee9c6e13d9c2b769c271d27bee4ba30 Reviewed-by: Michal Klocek Reviewed-by: Alexandru Croitor --- src/core/browser_context_qt.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp index 133006d70..ffee001ff 100644 --- a/src/core/browser_context_qt.cpp +++ b/src/core/browser_context_qt.cpp @@ -63,8 +63,9 @@ #include "components/prefs/pref_registry_simple.h" #include "components/user_prefs/user_prefs.h" #if BUILDFLAG(ENABLE_SPELLCHECK) -#include "chrome/common/pref_names.h" #include "chrome/browser/spellchecker/spellcheck_service.h" +#include "chrome/common/pref_names.h" +#include "components/spellcheck/browser/pref_names.h" #endif namespace QtWebEngineCore { @@ -80,12 +81,11 @@ BrowserContextQt::BrowserContextQt(BrowserContextAdapter *adapter) #if BUILDFLAG(ENABLE_SPELLCHECK) // Initial spellcheck settings - registry->RegisterListPref(prefs::kSpellCheckDictionaries, new base::ListValue()); registry->RegisterStringPref(prefs::kAcceptLanguages, std::string()); - registry->RegisterStringPref(prefs::kSpellCheckDictionary, std::string()); - registry->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false); - registry->RegisterBooleanPref(prefs::kEnableContinuousSpellcheck, false); - registry->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, false); + registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries, new base::ListValue()); + registry->RegisterStringPref(spellcheck::prefs::kSpellCheckDictionary, std::string()); + registry->RegisterBooleanPref(spellcheck::prefs::kEnableSpellcheck, false); + registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckUseSpellingService, false); #endif //ENABLE_SPELLCHECK m_prefService = factory.Create(std::move(registry.get())); user_prefs::UserPrefs::Set(this, m_prefService.get()); @@ -216,7 +216,7 @@ void BrowserContextQt::failedToLoadDictionary(const std::string &language) void BrowserContextQt::setSpellCheckLanguages(const QStringList &languages) { StringListPrefMember dictionaries_pref; - dictionaries_pref.Init(prefs::kSpellCheckDictionaries, m_prefService.get()); + dictionaries_pref.Init(spellcheck::prefs::kSpellCheckDictionaries, m_prefService.get()); std::vector dictionaries; dictionaries.reserve(languages.size()); for (const auto &language : languages) @@ -227,7 +227,7 @@ void BrowserContextQt::setSpellCheckLanguages(const QStringList &languages) QStringList BrowserContextQt::spellCheckLanguages() const { QStringList spellcheck_dictionaries; - for (const auto &value : *m_prefService->GetList(prefs::kSpellCheckDictionaries)) { + for (const auto &value : *m_prefService->GetList(spellcheck::prefs::kSpellCheckDictionaries)) { std::string dictionary; if (value->GetAsString(&dictionary)) spellcheck_dictionaries.append(QString::fromStdString(dictionary)); @@ -238,12 +238,12 @@ QStringList BrowserContextQt::spellCheckLanguages() const void BrowserContextQt::setSpellCheckEnabled(bool enabled) { - m_prefService->SetBoolean(prefs::kEnableContinuousSpellcheck, enabled); + m_prefService->SetBoolean(spellcheck::prefs::kEnableSpellcheck, enabled); } bool BrowserContextQt::isSpellCheckEnabled() const { - return m_prefService->GetBoolean(prefs::kEnableContinuousSpellcheck); + return m_prefService->GetBoolean(spellcheck::prefs::kEnableSpellcheck); } #endif //ENABLE_SPELLCHECK } // namespace QtWebEngineCore -- cgit v1.2.3