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

Unified Diff: chrome/browser/translate/translate_infobar_delegate.cc

Issue 17368005: [Translate] Do not show TRANSLATING and AFTER_TRANSLATE when on a translate session (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 | « chrome/browser/translate/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: chrome/browser/translate/translate_infobar_delegate.cc
diff --git a/chrome/browser/translate/translate_infobar_delegate.cc b/chrome/browser/translate/translate_infobar_delegate.cc
index ca9df4c1d7150a479a83db0db61458fa16f85194..2432f1238c2f30ca3acb330787c1d0961374add0 100644
--- a/chrome/browser/translate/translate_infobar_delegate.cc
+++ b/chrome/browser/translate/translate_infobar_delegate.cc
@@ -74,6 +74,16 @@ void TranslateInfoBarDelegate::Create(
original_language, target_language));
infobar->UpdateBackgroundAnimation(old_delegate);
+ // Do not create the after translate infobar if we are auto translating.
+ if (infobar_type == TranslateInfoBarDelegate::AFTER_TRANSLATE
Takashi Toyoshima 2013/06/21 12:19:53 In chromium style, "||" should be the end of previ
Miguel Garcia 2013/06/21 13:24:59 Done.
+ || infobar_type == TranslateInfoBarDelegate::TRANSLATING) {
+ TranslateTabHelper* translate_tab_helper =
+ TranslateTabHelper::FromWebContents(infobar_service->web_contents());
+ if (!translate_tab_helper
+ || translate_tab_helper->language_state().InTranslateNavigation())
+ return;
+ }
+
// Add the new delegate if necessary.
if (!old_delegate) {
infobar_service->AddInfoBar(infobar.PassAs<InfoBarDelegate>());
@@ -126,14 +136,6 @@ void TranslateInfoBarDelegate::TranslationDeclined() {
UMA_HISTOGRAM_BOOLEAN(kDeclineTranslate, true);
}
-bool TranslateInfoBarDelegate::InTranslateNavigation() {
- TranslateTabHelper* translate_tab_helper =
- TranslateTabHelper::FromWebContents(web_contents());
- if (!translate_tab_helper)
- return false;
- return translate_tab_helper->language_state().InTranslateNavigation();
-}
-
bool TranslateInfoBarDelegate::IsTranslatableLanguageByPrefs() {
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
« no previous file with comments | « chrome/browser/translate/translate_infobar_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698