OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... | |
28 | 28 |
29 namespace user_prefs { | 29 namespace user_prefs { |
30 class PrefRegistrySyncable; | 30 class PrefRegistrySyncable; |
31 } | 31 } |
32 | 32 |
33 namespace translate { | 33 namespace translate { |
34 | 34 |
35 // Feature flag for "Translate UI 2016 Q2" project. | 35 // Feature flag for "Translate UI 2016 Q2" project. |
36 extern const base::Feature kTranslateUI2016Q2; | 36 extern const base::Feature kTranslateUI2016Q2; |
37 | 37 |
38 // The trail (study) name in finch study config. | |
39 extern const char kTranslateUI2016Q2TrialName[]; | |
40 | |
41 // The name of the parameter for the number of translation trigger the "Always | |
42 // Translate" checkbox defaul to checked. | |
groby-ooo-7-16
2016/06/27 23:00:34
nit:"default"
ftang
2016/06/28 05:01:46
Done.
| |
43 extern const char kNumOfTranslationTriggerAlways[]; | |
groby-ooo-7-16
2016/06/27 23:00:34
The name is slightly unclear. Maybe kAlwaysTransla
ftang
2016/06/28 05:01:46
Done.
| |
44 | |
38 class TranslateAcceptLanguages; | 45 class TranslateAcceptLanguages; |
39 | 46 |
40 // Allows updating denial times for a specific language while maintaining the | 47 // Allows updating denial times for a specific language while maintaining the |
41 // maximum list size and ensuring PrefObservers are notified of change values. | 48 // maximum list size and ensuring PrefObservers are notified of change values. |
42 class DenialTimeUpdate { | 49 class DenialTimeUpdate { |
43 public: | 50 public: |
44 DenialTimeUpdate(PrefService* prefs, | 51 DenialTimeUpdate(PrefService* prefs, |
45 const std::string& language, | 52 const std::string& language, |
46 size_t max_denial_count); | 53 size_t max_denial_count); |
47 ~DenialTimeUpdate(); | 54 ~DenialTimeUpdate(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 // Gets the language list of the language settings. | 157 // Gets the language list of the language settings. |
151 void GetLanguageList(std::vector<std::string>* languages) const; | 158 void GetLanguageList(std::vector<std::string>* languages) const; |
152 | 159 |
153 // Updates the language list of the language settings. | 160 // Updates the language list of the language settings. |
154 void UpdateLanguageList(const std::vector<std::string>& languages); | 161 void UpdateLanguageList(const std::vector<std::string>& languages); |
155 | 162 |
156 bool CanTranslateLanguage(TranslateAcceptLanguages* accept_languages, | 163 bool CanTranslateLanguage(TranslateAcceptLanguages* accept_languages, |
157 const std::string& language); | 164 const std::string& language); |
158 bool ShouldAutoTranslate(const std::string& original_language, | 165 bool ShouldAutoTranslate(const std::string& original_language, |
159 std::string* target_language); | 166 std::string* target_language); |
167 | |
168 // Decide to default check the Always Transalte setting. | |
169 bool ShouldAlwaysTranslateBeCheckedByDefault(const std::string& language); | |
170 | |
160 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 171 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
161 static void MigrateUserPrefs(PrefService* user_prefs, | 172 static void MigrateUserPrefs(PrefService* user_prefs, |
162 const char* accept_languages_pref); | 173 const char* accept_languages_pref); |
163 | 174 |
164 private: | 175 private: |
165 friend class TranslatePrefsTest; | 176 friend class TranslatePrefsTest; |
166 | 177 |
167 // Merges two language sets to migrate to the language setting UI. | 178 // Merges two language sets to migrate to the language setting UI. |
168 static void CreateBlockedLanguages( | 179 static void CreateBlockedLanguages( |
169 std::vector<std::string>* blocked_languages, | 180 std::vector<std::string>* blocked_languages, |
(...skipping 30 matching lines...) Expand all Loading... | |
200 PrefService* prefs_; // Weak. | 211 PrefService* prefs_; // Weak. |
201 | 212 |
202 std::string country_; // The country the app runs in. | 213 std::string country_; // The country the app runs in. |
203 | 214 |
204 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); | 215 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); |
205 }; | 216 }; |
206 | 217 |
207 } // namespace translate | 218 } // namespace translate |
208 | 219 |
209 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ | 220 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ |
OLD | NEW |