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

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

Issue 2871783003: Automatically trigger Always-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
« no previous file with comments | « components/translate/core/browser/translate_infobar_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5fa42a5c705c0dbf1ac90aca3eba30477184e3d5..f5b807454d6f0dd76c26105b1ecabe07d43ee245 100644
--- a/components/translate/core/browser/translate_infobar_delegate.cc
+++ b/components/translate/core/browser/translate_infobar_delegate.cc
@@ -195,6 +195,10 @@ void TranslateInfoBarDelegate::ToggleAlwaysTranslate() {
ui_delegate_.SetAlwaysTranslate(!ui_delegate_.ShouldAlwaysTranslate());
}
+int TranslateInfoBarDelegate::GetTranslationAcceptedCount() {
+ return prefs_->GetTranslationAcceptedCount(original_language_code());
+}
+
void TranslateInfoBarDelegate::AlwaysTranslatePageLanguage() {
DCHECK(!ui_delegate_.ShouldAlwaysTranslate());
ui_delegate_.SetAlwaysTranslate(true);
@@ -378,7 +382,8 @@ int TranslateInfoBarDelegate::GetIconId() const {
void TranslateInfoBarDelegate::InfoBarDismissed() {
if (step_ != translate::TRANSLATE_STEP_BEFORE_TRANSLATE)
return;
-
+ if (IsCompactUIEnabled())
Marti Wong 2017/05/09 06:53:07 In Compact UI, the declined is only counted during
+ return;
// The user closed the infobar without clicking the translate button.
TranslationDeclined();
UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true);
« no previous file with comments | « components/translate/core/browser/translate_infobar_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698