Index: chrome/common/spellcheck_common.cc |
diff --git a/chrome/common/spellcheck_common.cc b/chrome/common/spellcheck_common.cc |
index 372c106b17652d694856978ff1a64df01cba5322..56423426d901a1d130f0a7c0a6cbecf7ac40e950 100644 |
--- a/chrome/common/spellcheck_common.cc |
+++ b/chrome/common/spellcheck_common.cc |
@@ -4,9 +4,14 @@ |
#include "chrome/common/spellcheck_common.h" |
+#include "base/command_line.h" |
#include "base/files/file_path.h" |
#include "base/logging.h" |
#include "base/macros.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" |
#include "third_party/icu/source/common/unicode/urename.h" |
#include "third_party/icu/source/common/unicode/utypes.h" |
@@ -181,5 +186,23 @@ void GetISOLanguageCountryCodeFromLocale(const std::string& locale, |
*country_code = std::string(country); |
} |
+std::vector<std::string> GetDictionaryLanguagesPref(PrefService* prefs) { |
+ std::vector<std::string> dictionary_languages; |
+ if (IsMultilingualSpellcheckEnabled()) { |
+ base::SplitString(prefs->GetString(prefs::kSpellCheckDictionaries), |
+ kDictionaryLanguagesSeparator, &dictionary_languages); |
+ } else { |
+ dictionary_languages.push_back( |
+ prefs->GetString(prefs::kSpellCheckDictionary)); |
+ } |
+ |
+ return dictionary_languages; |
+} |
+ |
+bool IsMultilingualSpellcheckEnabled() { |
+ return base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableMultilingualSpellChecker); |
+} |
+ |
} // namespace spellcheck_common |
} // namespace chrome |