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

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

Issue 1632953002: Change the TranslateDeclined() to only count decline if the explicit_closed is set to true (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mac unit test breakage Created 4 years, 10 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_ui_delegate.cc
diff --git a/components/translate/core/browser/translate_ui_delegate.cc b/components/translate/core/browser/translate_ui_delegate.cc
index 39af5b816feccdfef2d4f54f1c8272290572e662..244d7cbfcfd7c87fdc7a9a54e3b2360f4bd31abc 100644
--- a/components/translate/core/browser/translate_ui_delegate.cc
+++ b/components/translate/core/browser/translate_ui_delegate.cc
@@ -222,7 +222,7 @@ void TranslateUIDelegate::RevertTranslation() {
}
void TranslateUIDelegate::TranslationDeclined(bool explicitly_closed) {
- if (!translate_driver_->IsOffTheRecord()) {
+ if (explicitly_closed && !translate_driver_->IsOffTheRecord()) {
const std::string& language = GetOriginalLanguageCode();
prefs_->ResetTranslationAcceptedCount(language);
prefs_->IncrementTranslationDeniedCount(language);
@@ -234,13 +234,14 @@ void TranslateUIDelegate::TranslationDeclined(bool explicitly_closed) {
// when getting a LANGUAGE_DETERMINED from the page, which happens when a load
// stops. That could happen multiple times, including after the user already
// declined the translation.)
- if (translate_manager_) {
+ if (explicitly_closed && translate_manager_) {
translate_manager_->GetLanguageState().set_translation_declined(true);
UMA_HISTOGRAM_BOOLEAN(kDeclineTranslate, true);
}
- if (!explicitly_closed)
+ if (!explicitly_closed) {
UMA_HISTOGRAM_BOOLEAN(kDeclineTranslateDismissUI, true);
+ }
}
bool TranslateUIDelegate::IsLanguageBlocked() {

Powered by Google App Engine
This is Rietveld 408576698