| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager.h" | 5 #include "chrome/browser/translate/translate_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 BrowserWindow* window = browser ? browser->window() : NULL; | 719 BrowserWindow* window = browser ? browser->window() : NULL; |
| 720 TranslateBubbleFactory::Show(window, web_contents, view_state); | 720 TranslateBubbleFactory::Show(window, web_contents, view_state); |
| 721 #else | 721 #else |
| 722 NOTREACHED(); | 722 NOTREACHED(); |
| 723 #endif | 723 #endif |
| 724 } | 724 } |
| 725 | 725 |
| 726 // static | 726 // static |
| 727 std::string TranslateManager::GetTargetLanguage(PrefService* prefs) { | 727 std::string TranslateManager::GetTargetLanguage(PrefService* prefs) { |
| 728 std::string ui_lang = | 728 std::string ui_lang = |
| 729 GetLanguageCode(g_browser_process->GetApplicationLocale()); | 729 TranslatePrefs::ConvertLangCodeForTranslation( |
| 730 GetLanguageCode(g_browser_process->GetApplicationLocale())); |
| 731 |
| 730 if (IsSupportedLanguage(ui_lang)) | 732 if (IsSupportedLanguage(ui_lang)) |
| 731 return ui_lang; | 733 return ui_lang; |
| 732 | 734 |
| 733 // Getting the accepted languages list | 735 // Getting the accepted languages list |
| 734 std::string accept_langs_str = prefs->GetString(prefs::kAcceptLanguages); | 736 std::string accept_langs_str = prefs->GetString(prefs::kAcceptLanguages); |
| 735 | 737 |
| 736 std::vector<std::string> accept_langs_list; | 738 std::vector<std::string> accept_langs_list; |
| 737 base::SplitString(accept_langs_str, ',', &accept_langs_list); | 739 base::SplitString(accept_langs_str, ',', &accept_langs_list); |
| 738 | 740 |
| 739 // Will translate to the first supported language on the Accepted Language | 741 // Will translate to the first supported language on the Accepted Language |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 // so we are more aggressive about showing the shortcut to never translate. | 774 // so we are more aggressive about showing the shortcut to never translate. |
| 773 #if defined(OS_ANDROID) | 775 #if defined(OS_ANDROID) |
| 774 config.never_translate_min_count = 1; | 776 config.never_translate_min_count = 1; |
| 775 #else | 777 #else |
| 776 config.never_translate_min_count = 3; | 778 config.never_translate_min_count = 3; |
| 777 #endif // defined(OS_ANDROID) | 779 #endif // defined(OS_ANDROID) |
| 778 | 780 |
| 779 config.always_translate_min_count = 3; | 781 config.always_translate_min_count = 3; |
| 780 return config; | 782 return config; |
| 781 } | 783 } |
| OLD | NEW |