OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |