| Index: chrome/common/spellcheck_common.cc
|
| diff --git a/chrome/common/spellcheck_common.cc b/chrome/common/spellcheck_common.cc
|
| index 958ea56f9cf2c216a49f8bdd705474e9a44d83fd..ab669782f872bb3b0bb606a2a264fa6a0999a38b 100644
|
| --- a/chrome/common/spellcheck_common.cc
|
| +++ b/chrome/common/spellcheck_common.cc
|
| @@ -4,8 +4,13 @@
|
|
|
| #include "chrome/common/spellcheck_common.h"
|
|
|
| +#include "base/command_line.h"
|
| #include "base/files/file_path.h"
|
| #include "base/logging.h"
|
| +#include "base/prefs/pref_service.h"
|
| +#include "base/strings/string_split.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| +#include "chrome/common/pref_names.h"
|
| #include "third_party/icu/source/common/unicode/uloc.h"
|
|
|
| namespace chrome {
|
| @@ -176,5 +181,29 @@ void GetISOLanguageCountryCodeFromLocale(const std::string& locale,
|
| *country_code = std::string(country);
|
| }
|
|
|
| +std::vector<std::string> GetDictionaryLanguagesPref(PrefService* prefs) {
|
| + const base::CommandLine* command_line =
|
| + base::CommandLine::ForCurrentProcess();
|
| +
|
| + std::vector<std::string> dictionary_languages;
|
| + if (command_line->HasSwitch(switches::kEnableMultilingualSpellChecker)) {
|
| + base::SplitString(prefs->GetString(prefs::kSpellCheckDictionaries),
|
| + kDictionaryLanguagesSeparator, &dictionary_languages);
|
| + } else {
|
| + dictionary_languages.push_back(
|
| + prefs->GetString(prefs::kSpellCheckDictionary));
|
| + }
|
| +
|
| + auto empty_strings_begin =
|
| + std::partition(dictionary_languages.begin(), dictionary_languages.end(),
|
| + [](const std::string& language) {
|
| + DCHECK(!language.empty());
|
| + return language.length() > 0;
|
| + });
|
| + dictionary_languages.erase(empty_strings_begin, dictionary_languages.end());
|
| +
|
| + return dictionary_languages;
|
| +}
|
| +
|
| } // namespace spellcheck_common
|
| } // namespace chrome
|
|
|