Chromium Code Reviews| 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 e6df58584d2b5e929ebf1fc29f145a4a0ce53358..1c547d31cee8ceedd4635846f3814b0cfce4b102 100644 |
| --- a/components/translate/core/browser/translate_infobar_delegate.cc |
| +++ b/components/translate/core/browser/translate_infobar_delegate.cc |
| @@ -7,7 +7,6 @@ |
| #include <algorithm> |
| #include <utility> |
| -#include "base/feature_list.h" |
| #include "base/i18n/string_compare.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/metrics/histogram_macros.h" |
| @@ -125,11 +124,6 @@ void TranslateInfoBarDelegate::Create( |
| infobar_manager->AddInfoBar(std::move(infobar)); |
| } |
| -// static |
| -bool TranslateInfoBarDelegate::IsCompactUIEnabled() { |
| - return base::FeatureList::IsEnabled(kTranslateCompactUI); |
| -} |
| - |
| void TranslateInfoBarDelegate::SetResponder(Responder* responder) { |
| responder_ = responder; |
| } |
| @@ -150,11 +144,13 @@ void TranslateInfoBarDelegate::Translate() { |
| void TranslateInfoBarDelegate::RevertTranslation() { |
| ui_delegate_.RevertTranslation(); |
| - if (IsCompactUIEnabled()) |
| - return; |
| infobar()->RemoveSelf(); |
| } |
| +void TranslateInfoBarDelegate::RevertWithoutClosingInfobar() { |
| + ui_delegate_.RevertTranslation(); |
| +} |
| + |
| void TranslateInfoBarDelegate::ReportLanguageDetectionError() { |
| if (translate_manager_) |
| translate_manager_->ReportLanguageDetectionError(); |
| @@ -387,13 +383,15 @@ int TranslateInfoBarDelegate::GetIconId() const { |
| } |
| void TranslateInfoBarDelegate::InfoBarDismissed() { |
| - if (step_ != translate::TRANSLATE_STEP_BEFORE_TRANSLATE) |
| - return; |
| - if (IsCompactUIEnabled()) |
| - return; |
| - // The user closed the infobar without clicking the translate button. |
| - TranslationDeclined(); |
| - UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); |
| + bool declined = responder_ |
|
napper
2017/05/19 23:01:31
const bool
|
| + ? responder_->Declined() |
| + : (step_ == translate::TRANSLATE_STEP_BEFORE_TRANSLATE); |
| + |
| + if (declined) { |
| + // The user closed the infobar without clicking the translate button. |
| + TranslationDeclined(); |
| + UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); |
| + } |
| } |
| TranslateInfoBarDelegate* |