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

Side by Side Diff: chrome/browser/translate/translate_tab_helper.cc

Issue 317623003: Translate: Bug fix: need to normalize the language code for Translate UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: toyoshim's review Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/translate/translate_tab_helper.h" 5 #include "chrome/browser/translate/translate_tab_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 content::WebContents* web_contents, 115 content::WebContents* web_contents,
116 std::string* source, 116 std::string* source,
117 std::string* target) { 117 std::string* target) {
118 DCHECK(source != NULL); 118 DCHECK(source != NULL);
119 DCHECK(target != NULL); 119 DCHECK(target != NULL);
120 120
121 TranslateTabHelper* translate_tab_helper = FromWebContents(web_contents); 121 TranslateTabHelper* translate_tab_helper = FromWebContents(web_contents);
122 if (!translate_tab_helper) 122 if (!translate_tab_helper)
123 return; 123 return;
124 124
125 *source = translate_tab_helper->GetLanguageState().original_language(); 125 *source = TranslateDownloadManager::GetLanguageCode(
126 translate_tab_helper->GetLanguageState().original_language());
126 127
127 Profile* profile = 128 Profile* profile =
128 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 129 Profile::FromBrowserContext(web_contents->GetBrowserContext());
129 Profile* original_profile = profile->GetOriginalProfile(); 130 Profile* original_profile = profile->GetOriginalProfile();
130 PrefService* prefs = original_profile->GetPrefs(); 131 PrefService* prefs = original_profile->GetPrefs();
131 scoped_ptr<TranslatePrefs> translate_prefs = CreateTranslatePrefs(prefs); 132 scoped_ptr<TranslatePrefs> translate_prefs = CreateTranslatePrefs(prefs);
132 if (!web_contents->GetBrowserContext()->IsOffTheRecord()) { 133 if (!web_contents->GetBrowserContext()->IsOffTheRecord()) {
133 std::string auto_translate_language = 134 std::string auto_translate_language =
134 TranslateManager::GetAutoTargetLanguage(*source, translate_prefs.get()); 135 TranslateManager::GetAutoTargetLanguage(*source, translate_prefs.get());
135 if (!auto_translate_language.empty()) { 136 if (!auto_translate_language.empty()) {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 if (GetLanguageState().InTranslateNavigation()) 534 if (GetLanguageState().InTranslateNavigation())
534 return; 535 return;
535 } 536 }
536 537
537 TranslateBubbleFactory::Show( 538 TranslateBubbleFactory::Show(
538 browser->window(), web_contents(), step, error_type); 539 browser->window(), web_contents(), step, error_type);
539 #else 540 #else
540 NOTREACHED(); 541 NOTREACHED();
541 #endif 542 #endif
542 } 543 }
OLDNEW
« 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