| 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/ui/webui/options/language_options_handler_common.h" | 5 #include "chrome/browser/ui/webui/options/language_options_handler_common.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 22 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 23 #include "chrome/browser/spellchecker/spellcheck_service.h" | 23 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 24 #include "chrome/browser/translate/translate_manager.h" | 24 #include "chrome/browser/translate/translate_manager.h" |
| 25 #include "chrome/browser/translate/translate_prefs.h" | 25 #include "chrome/browser/translate/translate_prefs.h" |
| 26 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
| 27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/common/spellcheck_common.h" | 29 #include "chrome/common/spellcheck_common.h" |
| 30 #include "components/translate/core/browser/translate_download_manager.h" |
| 30 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
| 31 #include "content/public/browser/web_ui.h" | 32 #include "content/public/browser/web_ui.h" |
| 32 #include "grit/chromium_strings.h" | 33 #include "grit/chromium_strings.h" |
| 33 #include "grit/generated_resources.h" | 34 #include "grit/generated_resources.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 35 | 36 |
| 36 using base::UserMetricsAction; | 37 using base::UserMetricsAction; |
| 37 | 38 |
| 38 namespace options { | 39 namespace options { |
| 39 | 40 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 enable_spelling_auto_correct); | 124 enable_spelling_auto_correct); |
| 124 | 125 |
| 125 Profile* profile = Profile::FromWebUI(web_ui()); | 126 Profile* profile = Profile::FromWebUI(web_ui()); |
| 126 PrefService* prefs = profile->GetPrefs(); | 127 PrefService* prefs = profile->GetPrefs(); |
| 127 std::string default_target_language = | 128 std::string default_target_language = |
| 128 TranslateManager::GetTargetLanguage(prefs); | 129 TranslateManager::GetTargetLanguage(prefs); |
| 129 localized_strings->SetString("defaultTargetLanguage", | 130 localized_strings->SetString("defaultTargetLanguage", |
| 130 default_target_language); | 131 default_target_language); |
| 131 | 132 |
| 132 std::vector<std::string> languages; | 133 std::vector<std::string> languages; |
| 133 TranslateManager::GetSupportedLanguages(&languages); | 134 TranslateDownloadManager::GetSupportedLanguages(&languages); |
| 134 | 135 |
| 135 base::ListValue* languages_list = new base::ListValue(); | 136 base::ListValue* languages_list = new base::ListValue(); |
| 136 for (std::vector<std::string>::iterator it = languages.begin(); | 137 for (std::vector<std::string>::iterator it = languages.begin(); |
| 137 it != languages.end(); ++it) { | 138 it != languages.end(); ++it) { |
| 138 languages_list->Append(new base::StringValue(*it)); | 139 languages_list->Append(new base::StringValue(*it)); |
| 139 } | 140 } |
| 140 | 141 |
| 141 localized_strings->Set("translateSupportedLanguages", languages_list); | 142 localized_strings->Set("translateSupportedLanguages", languages_list); |
| 142 } | 143 } |
| 143 | 144 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 285 } |
| 285 | 286 |
| 286 base::WeakPtr<SpellcheckHunspellDictionary>& | 287 base::WeakPtr<SpellcheckHunspellDictionary>& |
| 287 LanguageOptionsHandlerCommon::GetHunspellDictionary() { | 288 LanguageOptionsHandlerCommon::GetHunspellDictionary() { |
| 288 if (!hunspell_dictionary_.get()) | 289 if (!hunspell_dictionary_.get()) |
| 289 RefreshHunspellDictionary(); | 290 RefreshHunspellDictionary(); |
| 290 return hunspell_dictionary_; | 291 return hunspell_dictionary_; |
| 291 } | 292 } |
| 292 | 293 |
| 293 } // namespace options | 294 } // namespace options |
| OLD | NEW |