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

Unified Diff: components/translate/core/browser/translate_prefs.h

Issue 2920953002: Auto-always/never can at most triggered twice (new translate infobar) (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/translate/core/browser/translate_prefs.h
diff --git a/components/translate/core/browser/translate_prefs.h b/components/translate/core/browser/translate_prefs.h
index 61a35d83a83cb4f59b4bfcd6fb3defc5a5a3e41e..8b40321aedf143ef0f75e03240542e6c387339a6 100644
--- a/components/translate/core/browser/translate_prefs.h
+++ b/components/translate/core/browser/translate_prefs.h
@@ -87,6 +87,8 @@ class TranslatePrefs {
static const char kPrefTranslateBlockedLanguages[];
static const char kPrefTranslateLastDeniedTimeForLanguage[];
static const char kPrefTranslateTooOftenDeniedForLanguage[];
+ 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
+ static const char kPrefTranslateAutoNeverCount[];
// |preferred_languages_pref| is only used on Chrome OS, other platforms must
// pass NULL.
@@ -149,6 +151,18 @@ class TranslatePrefs {
void IncrementTranslationAcceptedCount(const std::string& language);
void ResetTranslationAcceptedCount(const std::string& language);
+ // These methods are used to track how many times the auto-always translation
+ // has been triggered for a specific language.
+ int GetTranslationAutoAlwaysCount(const std::string& language) const;
+ void IncrementTranslationAutoAlwaysCount(const std::string& language);
+ void ResetTranslationAutoAlwaysCount(const std::string& language);
+
+ // These methods are used to track how many times the auto-never translation
+ // has been triggered for a specific language.
+ int GetTranslationAutoNeverCount(const std::string& language) const;
+ void IncrementTranslationAutoNeverCount(const std::string& language);
+ void ResetTranslationAutoNeverCount(const std::string& language);
+
// Update the last time on closing the Translate UI without translation.
void UpdateLastDeniedTime(const std::string& language);
@@ -220,6 +234,14 @@ class TranslatePrefs {
// accepted for a language, creating it if necessary.
base::DictionaryValue* GetTranslationAcceptedCountDictionary() const;
+ // Retrieves the dictionary mapping the number of times auto-always translate
+ // has been triggered for a language, creating it if necessary.
+ base::DictionaryValue* GetTranslateAutoAlwaysCountDictionary() const;
+
+ // Retrieves the dictionary mapping the number of times auto-never translate
+ // has been triggered for a language, creating it if necessary.
+ base::DictionaryValue* GetTranslationAutoNeverCountDictionary() const;
Marti Wong 2017/06/09 03:28:26 Removed. functions never been used.
+
PrefService* prefs_; // Weak.
std::string country_; // The country the app runs in.

Powered by Google App Engine
This is Rietveld 408576698