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

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

Issue 17157015: Bug fix: Translate infobar should appear when the user configured so (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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/translate/translate_manager.cc
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 8a2d93a5d28662164ba4f995a2436ea8c69a88c7..9613a1bb7db107f3075bd9a3e96f6d4c7a52639f 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -438,17 +438,23 @@ void TranslateManager::InitiateTranslation(WebContents* web_contents,
return;
}
- // Don't translate similar languages (ex: en-US to en).
std::string target_lang = GetTargetLanguage(prefs);
std::string language_code = GetLanguageCode(page_lang);
- if (language_code == target_lang) {
- TranslateBrowserMetrics::ReportInitiationStatus(
- TranslateBrowserMetrics::INITIATION_STATUS_SIMILAR_LANGUAGES);
- return;
- }
CommandLine* command_line = CommandLine::ForCurrentProcess();
+ // Don't translate similar languages (ex: en-US to en).
+ // When the flag --enable-translate-settings is on, the locale (|target_lang|)
+ // is not needed to be considered because the user can configure the languages
+ // in the settings UI.
+ if (!command_line->HasSwitch(switches::kEnableTranslateSettings)) {
+ if (language_code == target_lang) {
+ TranslateBrowserMetrics::ReportInitiationStatus(
+ TranslateBrowserMetrics::INITIATION_STATUS_SIMILAR_LANGUAGES);
+ return;
+ }
+ }
+
// Don't translate any language the user configured as accepted languages.
// When the flag --enable-translate-settings is on, the condition is
// different. In this case, even though a language is an Accept language,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698