| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_COMMON_SPELLCHECK_COMMON_H_ | |
| 6 #define CHROME_COMMON_SPELLCHECK_COMMON_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 namespace base { | |
| 14 class FilePath; | |
| 15 } | |
| 16 | |
| 17 namespace chrome { | |
| 18 namespace spellcheck_common { | |
| 19 | |
| 20 // The number of hours that a session of feedback for spelling service lasts. | |
| 21 // After this number of hours passes, all feedback. | |
| 22 static const int kSessionHours = 6; | |
| 23 | |
| 24 // The number of context words to keep on either side of a misspelling for | |
| 25 // spelling service feedback. | |
| 26 static const int kContextWordCount = 2; | |
| 27 | |
| 28 // The number of seconds between sending feedback to spelling service. | |
| 29 static const int kFeedbackIntervalSeconds = 1800; // 30 minutes | |
| 30 | |
| 31 // Max number of dictionary suggestions. | |
| 32 static const int kMaxSuggestions = 5; | |
| 33 | |
| 34 // Maximum number of words in the custom spellcheck dictionary that can be | |
| 35 // synced. | |
| 36 static const size_t MAX_SYNCABLE_DICTIONARY_WORDS = 1300; | |
| 37 | |
| 38 // Maximum number of bytes in a word that can be added to the custom spellcheck | |
| 39 // dictionary. | |
| 40 static const size_t MAX_CUSTOM_DICTIONARY_WORD_BYTES = 99; | |
| 41 | |
| 42 base::FilePath GetVersionedFileName(const std::string& input_language, | |
| 43 const base::FilePath& dict_dir); | |
| 44 | |
| 45 // Returns the spellcheck language that should be used for |language|. For | |
| 46 // example, converts "hu-HU" into "hu", because we have only one variant of | |
| 47 // Hungarian. Converts "en-US" into "en-US", because we have several variants of | |
| 48 // English dictionaries. | |
| 49 // | |
| 50 // Returns an empty string if no spellcheck language found. For example, there's | |
| 51 // no single dictionary for English, so this function returns an empty string | |
| 52 // for "en". | |
| 53 std::string GetCorrespondingSpellCheckLanguage(const std::string& language); | |
| 54 | |
| 55 // Get SpellChecker supported languages. | |
| 56 void SpellCheckLanguages(std::vector<std::string>* languages); | |
| 57 | |
| 58 // Gets the ISO codes for the language and country of this |locale|. The | |
| 59 // |locale| is an ISO locale ID that may not include a country ID, e.g., "fr" or | |
| 60 // "de". This method converts the UI locale to a full locale ID and converts the | |
| 61 // full locale ID to an ISO language code and an ISO3 country code. | |
| 62 void GetISOLanguageCountryCodeFromLocale(const std::string& locale, | |
| 63 std::string* language_code, | |
| 64 std::string* country_code); | |
| 65 | |
| 66 } // namespace spellcheck_common | |
| 67 } // namespace chrome | |
| 68 | |
| 69 #endif // CHROME_COMMON_SPELLCHECK_COMMON_H_ | |
| OLD | NEW |