OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ |
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Updates the language list of chrome://settings/languages. | 88 // Updates the language list of chrome://settings/languages. |
89 void UpdateLanguageList(const std::vector<std::string>& languages); | 89 void UpdateLanguageList(const std::vector<std::string>& languages); |
90 | 90 |
91 static bool CanTranslateLanguage( | 91 static bool CanTranslateLanguage( |
92 Profile* profile, const std::string& language); | 92 Profile* profile, const std::string& language); |
93 static bool ShouldAutoTranslate(PrefService* user_prefs, | 93 static bool ShouldAutoTranslate(PrefService* user_prefs, |
94 const std::string& original_language, std::string* target_language); | 94 const std::string& original_language, std::string* target_language); |
95 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 95 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
96 static void MigrateUserPrefs(PrefService* user_prefs); | 96 static void MigrateUserPrefs(PrefService* user_prefs); |
97 | 97 |
| 98 // Converts the language code for Translate. This removes the sub code (like |
| 99 // -US) except for Chinese, and converts the synonyms. |
| 100 // The same logic exists at language_options.js, and please keep consistency |
| 101 // with the JavaScript file. |
| 102 static std::string ConvertLangCodeForTranslation(const std::string &lang); |
| 103 |
98 private: | 104 private: |
99 friend class TranslatePrefsTest; | 105 friend class TranslatePrefsTest; |
100 FRIEND_TEST_ALL_PREFIXES(TranslatePrefsTest, CreateBlockedLanguages); | 106 FRIEND_TEST_ALL_PREFIXES(TranslatePrefsTest, CreateBlockedLanguages); |
101 FRIEND_TEST_ALL_PREFIXES(TranslatePrefsTest, | 107 FRIEND_TEST_ALL_PREFIXES(TranslatePrefsTest, |
102 CreateBlockedLanguagesNonEnglishUI); | 108 CreateBlockedLanguagesNonEnglishUI); |
103 | 109 |
104 // Merges two language sets to migrate to the language setting UI. | 110 // Merges two language sets to migrate to the language setting UI. |
105 static void CreateBlockedLanguages( | 111 static void CreateBlockedLanguages( |
106 std::vector<std::string>* blocked_languages, | 112 std::vector<std::string>* blocked_languages, |
107 const std::vector<std::string>& blacklisted_languages, | 113 const std::vector<std::string>& blacklisted_languages, |
(...skipping 16 matching lines...) Expand all Loading... |
124 // Retrieves the dictionary mapping the number of times translation has been | 130 // Retrieves the dictionary mapping the number of times translation has been |
125 // accepted for a language, creating it if necessary. | 131 // accepted for a language, creating it if necessary. |
126 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const; | 132 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const; |
127 | 133 |
128 PrefService* prefs_; // Weak. | 134 PrefService* prefs_; // Weak. |
129 | 135 |
130 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); | 136 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); |
131 }; | 137 }; |
132 | 138 |
133 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ | 139 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_PREFS_H_ |
OLD | NEW |