Chromium Code Reviews| 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() { |