Chromium Code Reviews| 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 #ifndef CHROME_COMMON_SPELLCHECK_COMMON_H_ | 5 #ifndef CHROME_COMMON_SPELLCHECK_COMMON_H_ |
| 6 #define CHROME_COMMON_SPELLCHECK_COMMON_H_ | 6 #define CHROME_COMMON_SPELLCHECK_COMMON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 class FilePath; | 12 class FilePath; |
| 13 } | 13 } |
| 14 | 14 |
| 15 class PrefService; | |
| 16 | |
| 15 namespace chrome { | 17 namespace chrome { |
| 16 namespace spellcheck_common { | 18 namespace spellcheck_common { |
| 17 | 19 |
| 18 // The number of hours that a session of feedback for spelling service lasts. | 20 // The number of hours that a session of feedback for spelling service lasts. |
| 19 // After this number of hours passes, all feedback. | 21 // After this number of hours passes, all feedback. |
| 20 static const int kSessionHours = 6; | 22 static const int kSessionHours = 6; |
| 21 | 23 |
| 22 // The number of context words to keep on either side of a misspelling for | 24 // The number of context words to keep on either side of a misspelling for |
| 23 // spelling service feedback. | 25 // spelling service feedback. |
| 24 static const int kContextWordCount = 2; | 26 static const int kContextWordCount = 2; |
| 25 | 27 |
| 26 // The number of seconds between sending feedback to spelling service. | 28 // The number of seconds between sending feedback to spelling service. |
| 27 static const int kFeedbackIntervalSeconds = 1800; // 30 minutes | 29 static const int kFeedbackIntervalSeconds = 1800; // 30 minutes |
| 28 | 30 |
| 29 // Max number of dictionary suggestions. | 31 // Max number of dictionary suggestions. |
| 30 static const int kMaxSuggestions = 5; | 32 static const int kMaxSuggestions = 5; |
| 31 | 33 |
| 32 static const int kMaxAutoCorrectWordSize = 8; | 34 static const int kMaxAutoCorrectWordSize = 8; |
| 33 | 35 |
| 34 // Maximum number of words in the custom spellcheck dictionary that can be | 36 // Maximum number of words in the custom spellcheck dictionary that can be |
| 35 // synced. | 37 // synced. |
| 36 static const size_t MAX_SYNCABLE_DICTIONARY_WORDS = 1300; | 38 static const size_t MAX_SYNCABLE_DICTIONARY_WORDS = 1300; |
| 37 | 39 |
| 38 // Maximum number of bytes in a word that can be added to the custom spellcheck | 40 // Maximum number of bytes in a word that can be added to the custom spellcheck |
| 39 // dictionary. | 41 // dictionary. |
| 40 static const size_t MAX_CUSTOM_DICTIONARY_WORD_BYTES = 99; | 42 static const size_t MAX_CUSTOM_DICTIONARY_WORD_BYTES = 99; |
| 41 | 43 |
| 44 // Character that separates language codes saved in preferences. | |
| 45 static const char kDictionaryLanguagesSeparator = ','; | |
| 46 | |
| 42 base::FilePath GetVersionedFileName(const std::string& input_language, | 47 base::FilePath GetVersionedFileName(const std::string& input_language, |
| 43 const base::FilePath& dict_dir); | 48 const base::FilePath& dict_dir); |
| 44 | 49 |
| 45 std::string GetCorrespondingSpellCheckLanguage(const std::string& language); | 50 std::string GetCorrespondingSpellCheckLanguage(const std::string& language); |
| 46 | 51 |
| 47 // Get SpellChecker supported languages. | 52 // Get SpellChecker supported languages. |
| 48 void SpellCheckLanguages(std::vector<std::string>* languages); | 53 void SpellCheckLanguages(std::vector<std::string>* languages); |
| 49 | 54 |
| 50 // Gets the ISO codes for the language and country of this |locale|. The | 55 // Gets the ISO codes for the language and country of this |locale|. The |
| 51 // |locale| is an ISO locale ID that may not include a country ID, e.g., "fr" or | 56 // |locale| is an ISO locale ID that may not include a country ID, e.g., "fr" or |
| 52 // "de". This method converts the UI locale to a full locale ID and converts the | 57 // "de". This method converts the UI locale to a full locale ID and converts the |
| 53 // full locale ID to an ISO language code and an ISO3 country code. | 58 // full locale ID to an ISO language code and an ISO3 country code. |
| 54 void GetISOLanguageCountryCodeFromLocale(const std::string& locale, | 59 void GetISOLanguageCountryCodeFromLocale(const std::string& locale, |
| 55 std::string* language_code, | 60 std::string* language_code, |
| 56 std::string* country_code); | 61 std::string* country_code); |
| 57 | 62 |
| 63 // Reads the spellcheck.dictionary or spellcheck.dictionaries preference | |
|
please use gerrit instead
2015/06/05 17:50:06
No need to specify so much implementation details,
Julius
2015/06/05 21:38:33
Done.
| |
| 64 // (depending on whether the enable-multilingual-spellchecker flag is set), and | |
| 65 // returns the language codes. | |
| 66 std::vector<std::string> GetDictionaryLanguagesPref(PrefService* prefs); | |
| 67 | |
| 68 // Checks if the command-line switch enable-multilingual-spellchecker is set. | |
|
please use gerrit instead
2015/06/05 17:50:06
This comment will soon grow stale, because command
Julius
2015/06/05 21:38:33
Done.
| |
| 69 bool MultilingualSpellcheckIsEnabled(); | |
|
please use gerrit instead
2015/06/05 17:50:06
Newline after.
Julius
2015/06/05 21:38:33
Done.
| |
| 58 } // namespace spellcheck_common | 70 } // namespace spellcheck_common |
| 59 } // namespace chrome | 71 } // namespace chrome |
| 60 | 72 |
| 61 #endif // CHROME_COMMON_SPELLCHECK_COMMON_H_ | 73 #endif // CHROME_COMMON_SPELLCHECK_COMMON_H_ |
| OLD | NEW |