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

Unified Diff: components/translate/core/browser/translate_infobar_delegate.cc

Issue 2874393002: Automatically trigger Never-Translate in new translation 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_infobar_delegate.cc
diff --git a/components/translate/core/browser/translate_infobar_delegate.cc b/components/translate/core/browser/translate_infobar_delegate.cc
index f6008521dd3d7ef0304ace07617ef6ef483f1ccd..b530c6661f58926b7c8103bd4f182fd928df85d6 100644
--- a/components/translate/core/browser/translate_infobar_delegate.cc
+++ b/components/translate/core/browser/translate_infobar_delegate.cc
@@ -49,6 +49,9 @@ const int kNeverTranslateMinCount = 3;
// For Compact UI, if number of consecutive translations is equal to this
// number, infobar will automatically trigger "Always Translate".
const int kAcceptCountThreshold = 5;
+// For Compact UI, if number of consecutive denied is equal to this
+// number, infobar will automatically trigger "Never Translate Language".
+const int kDeniedCountThreshold = 7;
} // namespace
@@ -308,6 +311,12 @@ bool TranslateInfoBarDelegate::ShouldAutoAlwaysTranslate() {
kAcceptCountThreshold);
}
+bool TranslateInfoBarDelegate::ShouldAutoNeverTranslate() {
Leo 2017/05/12 05:09:07 Can we move all the CompactUIEnabled logic to ui/a
Marti Wong 2017/05/12 07:16:11 Done.
+ return (IsCompactUIEnabled() &&
+ prefs_->GetTranslationDeniedCount(original_language_code()) ==
+ kDeniedCountThreshold);
+}
+
// static
void TranslateInfoBarDelegate::GetAfterTranslateStrings(
std::vector<base::string16>* strings,

Powered by Google App Engine
This is Rietveld 408576698