Chromium Code Reviews| Index: chrome/common/spellcheck_common.cc |
| diff --git a/chrome/common/spellcheck_common.cc b/chrome/common/spellcheck_common.cc |
| index 58c334674b9ab331584d0b08c86eaa3d560d0e25..a539a117eb37b0f076d00c3fc823ee9fdd8a781f 100644 |
| --- a/chrome/common/spellcheck_common.cc |
| +++ b/chrome/common/spellcheck_common.cc |
| @@ -140,6 +140,7 @@ base::FilePath GetVersionedFileName(const std::string& input_language, |
| } |
| std::string GetCorrespondingSpellCheckLanguage(const std::string& language) { |
| + std::string best_match; |
| // Look for exact match in the Spell Check language list. |
| for (size_t i = 0; i < arraysize(g_supported_spellchecker_languages); |
| ++i) { |
| @@ -152,12 +153,14 @@ std::string GetCorrespondingSpellCheckLanguage(const std::string& language) { |
| // Next, look for exact match in the language_region part of the list. |
| std::string spellcheck_language_region( |
| g_supported_spellchecker_languages[i].language_region); |
| - if (spellcheck_language_region == language) |
| - return g_supported_spellchecker_languages[i].language; |
| + if (spellcheck_language_region == language) { |
|
groby-ooo-7-16
2016/05/02 19:07:48
What specific behavior does this fix? Is this _jus
|
| + if (best_match.empty()) |
| + best_match = g_supported_spellchecker_languages[i].language; |
| + } |
| } |
| - // No match found - return blank. |
| - return std::string(); |
| + // No match found - return best match, if any. |
| + return best_match; |
| } |
| void SpellCheckLanguages(std::vector<std::string>* languages) { |