diff options
author | rouslan <rouslan@chromium.org> | 2015-10-08 11:44:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-08 18:45:22 +0000 |
commit | 16fc75c80eda6f80f09c55c0cebe7d62b6585c24 (patch) | |
tree | bcf8abe13d5189948c2283a6dc8e1918da7f6c82 /chrome/common/spellcheck_common.cc | |
parent | cb0b75575e1ebab71e76aaeb8784c18f95c0c145 (diff) | |
download | chromium_src-16fc75c80eda6f80f09c55c0cebe7d62b6585c24.zip chromium_src-16fc75c80eda6f80f09c55c0cebe7d62b6585c24.tar.gz chromium_src-16fc75c80eda6f80f09c55c0cebe7d62b6585c24.tar.bz2 |
Enable multilingual spellcheck by default.
This patch enables multilingual spellcheck by default with an option to
disable it on demand via field trial.
BUG=5102
Review URL: https://codereview.chromium.org/1389153002
Cr-Commit-Position: refs/heads/master@{#353107}
Diffstat (limited to 'chrome/common/spellcheck_common.cc')
-rw-r--r-- | chrome/common/spellcheck_common.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/chrome/common/spellcheck_common.cc b/chrome/common/spellcheck_common.cc index 9aa3a02..cee0883 100644 --- a/chrome/common/spellcheck_common.cc +++ b/chrome/common/spellcheck_common.cc @@ -8,6 +8,8 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/macros.h" +#include "base/metrics/field_trial.h" +#include "base/strings/string_util.h" #include "chrome/common/chrome_switches.h" #include "third_party/icu/source/common/unicode/uloc.h" #include "third_party/icu/source/common/unicode/urename.h" @@ -16,6 +18,8 @@ namespace chrome { namespace spellcheck_common { +const char kMultilingualSpellcheckFieldTrial[] = "MultilingualSpellcheck"; + struct LanguageRegion { const char* language; // The language. const char* language_region; // language & region, used by dictionaries. @@ -184,8 +188,21 @@ void GetISOLanguageCountryCodeFromLocale(const std::string& locale, } bool IsMultilingualSpellcheckEnabled() { - return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableMultilingualSpellChecker); + // TODO(rouslan): Remove field trial and command line flags when M49 is + // stable. + const std::string& group_name = + base::FieldTrialList::FindFullName(kMultilingualSpellcheckFieldTrial); + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableMultilingualSpellChecker)) { + return false; + } + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableMultilingualSpellChecker)) { + return true; + } + // Enabled by default, but can be disabled in field trial. + return !base::StartsWith(group_name, "Disabled", + base::CompareCase::INSENSITIVE_ASCII); } } // namespace spellcheck_common |