| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/spellcheck_common.h" | 5 #include "chrome/common/spellcheck_common.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 | 8 |
| 9 namespace chrome { | 9 namespace chrome { |
| 10 namespace spellcheck_common { | 10 namespace spellcheck_common { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 FilePath GetVersionedFileName(const std::string& input_language, | 91 FilePath GetVersionedFileName(const std::string& input_language, |
| 92 const FilePath& dict_dir) { | 92 const FilePath& dict_dir) { |
| 93 // The default dictionary version is 3-0. This version indicates that the bdic | 93 // The default dictionary version is 3-0. This version indicates that the bdic |
| 94 // file contains a checksum. | 94 // file contains a checksum. |
| 95 static const char kDefaultVersionString[] = "-3-0"; | 95 static const char kDefaultVersionString[] = "-3-0"; |
| 96 | 96 |
| 97 // Add non-default version strings here. Use the same version for all the | 97 // Add non-default version strings here. Use the same version for all the |
| 98 // dictionaries that you add at the same time. Increment the major version | 98 // dictionaries that you add at the same time. Increment the major version |
| 99 // number if you're updating either dic or aff files. Increment the minor | 99 // number if you're updating either dic or aff files. Increment the minor |
| 100 // version number if you're updating only dic_delta files. | 100 // version number if you're updating only dic_delta files. |
| 101 std::vector<LanguageVersion> special_version_string; | 101 static LanguageVersion special_version_string[] = { |
| 102 {"et-EE", "-1-1"}, // No dic/aff files |
| 103 {"tr-TR", "-1-1"}, // No dic/aff files |
| 104 }; |
| 102 | 105 |
| 103 // Generate the bdict file name using default version string or special | 106 // Generate the bdict file name using default version string or special |
| 104 // version string, depending on the language. | 107 // version string, depending on the language. |
| 105 std::string language = GetSpellCheckLanguageRegion(input_language); | 108 std::string language = GetSpellCheckLanguageRegion(input_language); |
| 106 std::string versioned_bdict_file_name(language + kDefaultVersionString + | 109 std::string versioned_bdict_file_name(language + kDefaultVersionString + |
| 107 ".bdic"); | 110 ".bdic"); |
| 108 for (size_t i = 0; i < special_version_string.size(); ++i) { | 111 for (size_t i = 0; i < arraysize(special_version_string); ++i) { |
| 109 if (language == special_version_string[i].language) { | 112 if (language == special_version_string[i].language) { |
| 110 versioned_bdict_file_name = | 113 versioned_bdict_file_name = |
| 111 language + special_version_string[i].version + ".bdic"; | 114 language + special_version_string[i].version + ".bdic"; |
| 112 break; | 115 break; |
| 113 } | 116 } |
| 114 } | 117 } |
| 115 | 118 |
| 116 return dict_dir.AppendASCII(versioned_bdict_file_name); | 119 return dict_dir.AppendASCII(versioned_bdict_file_name); |
| 117 } | 120 } |
| 118 | 121 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 139 | 142 |
| 140 void SpellCheckLanguages(std::vector<std::string>* languages) { | 143 void SpellCheckLanguages(std::vector<std::string>* languages) { |
| 141 for (size_t i = 0; i < arraysize(g_supported_spellchecker_languages); | 144 for (size_t i = 0; i < arraysize(g_supported_spellchecker_languages); |
| 142 ++i) { | 145 ++i) { |
| 143 languages->push_back(g_supported_spellchecker_languages[i].language); | 146 languages->push_back(g_supported_spellchecker_languages[i].language); |
| 144 } | 147 } |
| 145 } | 148 } |
| 146 | 149 |
| 147 } // namespace spellcheck_common | 150 } // namespace spellcheck_common |
| 148 } // namespace chrome | 151 } // namespace chrome |
| OLD | NEW |