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

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 ng build breakage Created 4 years, 11 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..66e7954ac13fa2c9d7b2992bf57f7be105d63a13 100644
--- a/components/translate/core/browser/translate_ui_delegate.cc
+++ b/components/translate/core/browser/translate_ui_delegate.cc
@@ -222,25 +222,26 @@ void TranslateUIDelegate::RevertTranslation() {
}
void TranslateUIDelegate::TranslationDeclined(bool explicitly_closed) {
- if (!translate_driver_->IsOffTheRecord()) {
groby-ooo-7-16 2016/01/28 21:17:28 Overall, I'd prefer it if you'd just add && explic
ftang 2016/01/28 22:37:21 Done.
ftang 2016/01/28 22:37:21 Acknowledged.
- const std::string& language = GetOriginalLanguageCode();
- prefs_->ResetTranslationAcceptedCount(language);
- prefs_->IncrementTranslationDeniedCount(language);
- prefs_->UpdateLastDeniedTime(language);
- }
-
- // Remember that the user declined the translation so as to prevent showing a
- // translate UI for that page again. (TranslateManager initiates translations
- // 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_) {
- translate_manager_->GetLanguageState().set_translation_declined(true);
- UMA_HISTOGRAM_BOOLEAN(kDeclineTranslate, true);
- }
+ if (explicitly_closed) {
+ if (!translate_driver_->IsOffTheRecord()) {
+ const std::string& language = GetOriginalLanguageCode();
+ prefs_->ResetTranslationAcceptedCount(language);
+ prefs_->IncrementTranslationDeniedCount(language);
+ prefs_->UpdateLastDeniedTime(language);
+ }
- if (!explicitly_closed)
+ // Remember that the user declined the translation so as to prevent showing
+ // a translate UI for that page again. (TranslateManager initiates
+ // translations 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 (explicitly_closed && translate_manager_) {
groby-ooo-7-16 2016/01/28 21:17:28 If you keep this structure, no need to check |expl
ftang 2016/01/28 22:37:21 Done.
+ translate_manager_->GetLanguageState().set_translation_declined(true);
+ UMA_HISTOGRAM_BOOLEAN(kDeclineTranslate, true);
+ }
+ } else {
UMA_HISTOGRAM_BOOLEAN(kDeclineTranslateDismissUI, true);
+ }
}
bool TranslateUIDelegate::IsLanguageBlocked() {

Powered by Google App Engine
This is Rietveld 408576698