Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: components/translate/core/browser/translate_prefs.h

Issue 2920953002: Auto-always/never can at most triggered twice (new translate infobar) (Closed)
Patch Set: fix Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 #if defined(OS_ANDROID)
91 static const char kPrefTranslateAutoAlwaysCount[];
92 static const char kPrefTranslateAutoNeverCount[];
93 #endif
90 94
91 // |preferred_languages_pref| is only used on Chrome OS, other platforms must 95 // |preferred_languages_pref| is only used on Chrome OS, other platforms must
92 // pass NULL. 96 // pass NULL.
93 TranslatePrefs(PrefService* user_prefs, 97 TranslatePrefs(PrefService* user_prefs,
94 const char* accept_languages_pref, 98 const char* accept_languages_pref,
95 const char* preferred_languages_pref); 99 const char* preferred_languages_pref);
96 100
97 // Checks if the translate feature is enabled. 101 // Checks if the translate feature is enabled.
98 bool IsEnabled() const; 102 bool IsEnabled() const;
99 103
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void IncrementTranslationIgnoredCount(const std::string& language); 146 void IncrementTranslationIgnoredCount(const std::string& language);
143 void ResetTranslationIgnoredCount(const std::string& language); 147 void ResetTranslationIgnoredCount(const std::string& language);
144 148
145 // These methods are used to track how many times the user has accepted the 149 // 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 150 // translation for a specific language. (So we can present a UI to white-list
147 // that language if the user keeps accepting translations). 151 // that language if the user keeps accepting translations).
148 int GetTranslationAcceptedCount(const std::string& language) const; 152 int GetTranslationAcceptedCount(const std::string& language) const;
149 void IncrementTranslationAcceptedCount(const std::string& language); 153 void IncrementTranslationAcceptedCount(const std::string& language);
150 void ResetTranslationAcceptedCount(const std::string& language); 154 void ResetTranslationAcceptedCount(const std::string& language);
151 155
156 #if defined(OS_ANDROID)
157 // These methods are used to track how many times the auto-always translation
158 // has been triggered for a specific language.
159 int GetTranslationAutoAlwaysCount(const std::string& language) const;
160 void IncrementTranslationAutoAlwaysCount(const std::string& language);
161 void ResetTranslationAutoAlwaysCount(const std::string& language);
162
163 // These methods are used to track how many times the auto-never translation
164 // has been triggered for a specific language.
165 int GetTranslationAutoNeverCount(const std::string& language) const;
166 void IncrementTranslationAutoNeverCount(const std::string& language);
167 void ResetTranslationAutoNeverCount(const std::string& language);
168 #endif
169
152 // Update the last time on closing the Translate UI without translation. 170 // Update the last time on closing the Translate UI without translation.
153 void UpdateLastDeniedTime(const std::string& language); 171 void UpdateLastDeniedTime(const std::string& language);
154 172
155 // Returns true if translation is denied too often. 173 // Returns true if translation is denied too often.
156 bool IsTooOftenDenied(const std::string& language) const; 174 bool IsTooOftenDenied(const std::string& language) const;
157 175
158 // Resets the prefs of denial state. Only used internally for diagnostics. 176 // Resets the prefs of denial state. Only used internally for diagnostics.
159 void ResetDenialState(); 177 void ResetDenialState();
160 178
161 // Gets the language list of the language settings. 179 // Gets the language list of the language settings.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 PrefService* prefs_; // Weak. 241 PrefService* prefs_; // Weak.
224 242
225 std::string country_; // The country the app runs in. 243 std::string country_; // The country the app runs in.
226 244
227 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs); 245 DISALLOW_COPY_AND_ASSIGN(TranslatePrefs);
228 }; 246 };
229 247
230 } // namespace translate 248 } // namespace translate
231 249
232 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_ 250 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_PREFS_H_
OLDNEW
« no previous file with comments | « components/translate/core/browser/translate_infobar_delegate.cc ('k') | components/translate/core/browser/translate_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698