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 class PrefService; |
| 12 |
11 namespace base { | 13 namespace base { |
12 class FilePath; | 14 class FilePath; |
13 } | 15 } |
14 | 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; |
(...skipping 11 matching lines...) Expand all Loading... |
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 // Returns the list of enabled spellcheck dictionaries. |
| 64 std::vector<std::string> GetDictionaryLanguagesPref(PrefService* prefs); |
| 65 |
| 66 // Returns true if multilingual spellchecker is enabled. |
| 67 bool IsMultilingualSpellcheckEnabled(); |
| 68 |
58 } // namespace spellcheck_common | 69 } // namespace spellcheck_common |
59 } // namespace chrome | 70 } // namespace chrome |
60 | 71 |
61 #endif // CHROME_COMMON_SPELLCHECK_COMMON_H_ | 72 #endif // CHROME_COMMON_SPELLCHECK_COMMON_H_ |
OLD | NEW |