Chromium Code Reviews| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 public: | 80 public: |
| 81 static const char kPrefLanguageProfile[]; | 81 static const char kPrefLanguageProfile[]; |
| 82 static const char kPrefTranslateSiteBlacklist[]; | 82 static const char kPrefTranslateSiteBlacklist[]; |
| 83 static const char kPrefTranslateWhitelists[]; | 83 static const char kPrefTranslateWhitelists[]; |
| 84 static const char kPrefTranslateDeniedCount[]; | 84 static const char kPrefTranslateDeniedCount[]; |
| 85 static const char kPrefTranslateIgnoredCount[]; | 85 static const char kPrefTranslateIgnoredCount[]; |
| 86 static const char kPrefTranslateAcceptedCount[]; | 86 static const char kPrefTranslateAcceptedCount[]; |
| 87 static const char kPrefTranslateBlockedLanguages[]; | 87 static const char kPrefTranslateBlockedLanguages[]; |
| 88 static const char kPrefTranslateLastDeniedTimeForLanguage[]; | 88 static const char kPrefTranslateLastDeniedTimeForLanguage[]; |
| 89 static const char kPrefTranslateTooOftenDeniedForLanguage[]; | 89 static const char kPrefTranslateTooOftenDeniedForLanguage[]; |
| 90 static const char kPrefTranslateAutoAlwaysCount[]; | |
|
Marti Wong
2017/06/02 07:37:13
2 questions:
- Do I need someone's approval for ad
groby-ooo-7-16
2017/06/07 17:02:49
Prefs don't need approval (AFAIK :). If they're An
Marti Wong
2017/06/09 03:28:26
Talked to Yana.
These are for Android only, at lea
| |
| 91 static const char kPrefTranslateAutoNeverCount[]; | |
| 90 | 92 |
| 91 // |preferred_languages_pref| is only used on Chrome OS, other platforms must | 93 // |preferred_languages_pref| is only used on Chrome OS, other platforms must |
| 92 // pass NULL. | 94 // pass NULL. |
| 93 TranslatePrefs(PrefService* user_prefs, | 95 TranslatePrefs(PrefService* user_prefs, |
| 94 const char* accept_languages_pref, | 96 const char* accept_languages_pref, |
| 95 const char* preferred_languages_pref); | 97 const char* preferred_languages_pref); |
| 96 | 98 |
| 97 // Checks if the translate feature is enabled. | 99 // Checks if the translate feature is enabled. |
| 98 bool IsEnabled() const; | 100 bool IsEnabled() const; |
| 99 | 101 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 void IncrementTranslationIgnoredCount(const std::string& language); | 144 void IncrementTranslationIgnoredCount(const std::string& language); |
| 143 void ResetTranslationIgnoredCount(const std::string& language); | 145 void ResetTranslationIgnoredCount(const std::string& language); |
| 144 | 146 |
| 145 // These methods are used to track how many times the user has accepted the | 147 // These methods are used to track how many times the user has accepted the |
| 146 // translation for a specific language. (So we can present a UI to white-list | 148 // translation for a specific language. (So we can present a UI to white-list |
| 147 // that language if the user keeps accepting translations). | 149 // that language if the user keeps accepting translations). |
| 148 int GetTranslationAcceptedCount(const std::string& language) const; | 150 int GetTranslationAcceptedCount(const std::string& language) const; |
| 149 void IncrementTranslationAcceptedCount(const std::string& language); | 151 void IncrementTranslationAcceptedCount(const std::string& language); |
| 150 void ResetTranslationAcceptedCount(const std::string& language); | 152 void ResetTranslationAcceptedCount(const std::string& language); |
| 151 | 153 |
| 154 // These methods are used to track how many times the auto-always translation | |
| 155 // has been triggered for a specific language. | |
| 156 int GetTranslationAutoAlwaysCount(const std::string& language) const; | |
| 157 void IncrementTranslationAutoAlwaysCount(const std::string& language); | |
| 158 void ResetTranslationAutoAlwaysCount(const std::string& language); | |
| 159 | |
| 160 // These methods are used to track how many times the auto-never translation | |
| 161 // has been triggered for a specific language. | |
| 162 int GetTranslationAutoNeverCount(const std::string& language) const; | |
| 163 void IncrementTranslationAutoNeverCount(const std::string& language); | |
| 164 void ResetTranslationAutoNeverCount(const std::string& language); | |
| 165 | |
| 152 // Update the last time on closing the Translate UI without translation. | 166 // Update the last time on closing the Translate UI without translation. |
| 153 void UpdateLastDeniedTime(const std::string& language); | 167 void UpdateLastDeniedTime(const std::string& language); |
| 154 | 168 |
| 155 // Returns true if translation is denied too often. | 169 // Returns true if translation is denied too often. |
| 156 bool IsTooOftenDenied(const std::string& language) const; | 170 bool IsTooOftenDenied(const std::string& language) const; |
| 157 | 171 |
| 158 // Resets the prefs of denial state. Only used internally for diagnostics. | 172 // Resets the prefs of denial state. Only used internally for diagnostics. |
| 159 void ResetDenialState(); | 173 void ResetDenialState(); |
| 160 | 174 |
| 161 // Gets the language list of the language settings. | 175 // Gets the language list of the language settings. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 // Path to the preference storing the accept languages. | 221 // Path to the preference storing the accept languages. |
| 208 const std::string accept_languages_pref_; | 222 const std::string accept_languages_pref_; |
| 209 #if defined(OS_CHROMEOS) | 223 #if defined(OS_CHROMEOS) |
| 210 // Path to the preference storing the preferred languages. | 224 // Path to the preference storing the preferred languages. |
| 211 // Only used on ChromeOS. | 225 // Only used on ChromeOS. |
| 212 std::string preferred_languages_pref_; | 226 std::string preferred_languages_pref_; |
| 213 #endif | 227 #endif |
| 214 | 228 |
| 215 // Retrieves the dictionary mapping the number of times translation has been | 229 // Retrieves the dictionary mapping the number of times translation has been |
| 216 // denied for a language, creating it if necessary. | 230 // denied for a language, creating it if necessary. |
| 217 base::DictionaryValue* GetTranslationDeniedCountDictionary(); | 231 base::DictionaryValue* GetTranslationDeniedCountDictionary(); |
|
Marti Wong
2017/06/02 07:37:13
Should I add "const" at the end of this line?
groby-ooo-7-16
2017/06/07 17:02:49
Probably yes.
Sidebar: Either solution is iffy.
Marti Wong
2017/06/09 03:28:26
It seems this functions are never been used.
I wil
| |
| 218 | 232 |
| 219 // Retrieves the dictionary mapping the number of times translation has been | 233 // Retrieves the dictionary mapping the number of times translation has been |
| 220 // accepted for a language, creating it if necessary. | 234 // accepted for a language, creating it if necessary. |
| 221 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const; | 235 base::DictionaryValue* GetTranslationAcceptedCountDictionary() const; |
| 222 | 236 |
| 237 // Retrieves the dictionary mapping the number of times auto-always translate | |
| 238 // has been triggered for a language, creating it if necessary. | |
| 239 base::DictionaryValue* GetTranslateAutoAlwaysCountDictionary() const; | |
| 240 | |
| 241 // Retrieves the dictionary mapping the number of times auto-never translate | |
| 242 // has been triggered for a language, creating it if necessary. | |
| 243 base::DictionaryValue* GetTranslationAutoNeverCountDictionary() const; | |
|
Marti Wong
2017/06/09 03:28:26
Removed. functions never been used.
| |
| 244 | |
| 223 PrefService* prefs_; // Weak. | 245 PrefService* prefs_; // Weak. |
| 224 | 246 |
| 225 std::string country_; // The country the app runs in. | 247 std::string country_; // The country the app runs in. |
| 226 | 248 |
| 227 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); | 249 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); |
| 228 }; | 250 }; |
| 229 | 251 |
| 230 } // namespace translate | 252 } // namespace translate |
| 231 | 253 |
| 232 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ | 254 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ |
| OLD | NEW |