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

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

Issue 2892143002: Remove all feature flag checks in Delegate. (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 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*
« 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