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> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if (hunspell_dictionary_->IsDownloadInProgress()) | 220 if (hunspell_dictionary_->IsDownloadInProgress()) |
221 OnHunspellDictionaryDownloadBegin(); | 221 OnHunspellDictionaryDownloadBegin(); |
222 else if (hunspell_dictionary_->IsDownloadFailure()) | 222 else if (hunspell_dictionary_->IsDownloadFailure()) |
223 OnHunspellDictionaryDownloadFailure(); | 223 OnHunspellDictionaryDownloadFailure(); |
224 else | 224 else |
225 OnHunspellDictionaryDownloadSuccess(); | 225 OnHunspellDictionaryDownloadSuccess(); |
226 } | 226 } |
227 | 227 |
228 void LanguageOptionsHandlerCommon::UiLanguageChangeCallback( | 228 void LanguageOptionsHandlerCommon::UiLanguageChangeCallback( |
229 const base::ListValue* args) { | 229 const base::ListValue* args) { |
230 const std::string language_code = UTF16ToASCII(ExtractStringValue(args)); | 230 const std::string language_code = |
| 231 base::UTF16ToASCII(ExtractStringValue(args)); |
231 CHECK(!language_code.empty()); | 232 CHECK(!language_code.empty()); |
232 const std::string action = base::StringPrintf( | 233 const std::string action = base::StringPrintf( |
233 "LanguageOptions_UiLanguageChange_%s", language_code.c_str()); | 234 "LanguageOptions_UiLanguageChange_%s", language_code.c_str()); |
234 content::RecordComputedAction(action); | 235 content::RecordComputedAction(action); |
235 SetApplicationLocale(language_code); | 236 SetApplicationLocale(language_code); |
236 base::StringValue language_value(language_code); | 237 base::StringValue language_value(language_code); |
237 web_ui()->CallJavascriptFunction("options.LanguageOptions.uiLanguageSaved", | 238 web_ui()->CallJavascriptFunction("options.LanguageOptions.uiLanguageSaved", |
238 language_value); | 239 language_value); |
239 } | 240 } |
240 | 241 |
241 void LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback( | 242 void LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback( |
242 const base::ListValue* args) { | 243 const base::ListValue* args) { |
243 const std::string language_code = UTF16ToASCII(ExtractStringValue(args)); | 244 const std::string language_code = |
| 245 base::UTF16ToASCII(ExtractStringValue(args)); |
244 CHECK(!language_code.empty()); | 246 CHECK(!language_code.empty()); |
245 const std::string action = base::StringPrintf( | 247 const std::string action = base::StringPrintf( |
246 "LanguageOptions_SpellCheckLanguageChange_%s", language_code.c_str()); | 248 "LanguageOptions_SpellCheckLanguageChange_%s", language_code.c_str()); |
247 content::RecordComputedAction(action); | 249 content::RecordComputedAction(action); |
248 RefreshHunspellDictionary(); | 250 RefreshHunspellDictionary(); |
249 } | 251 } |
250 | 252 |
251 void LanguageOptionsHandlerCommon::UpdateLanguageListCallback( | 253 void LanguageOptionsHandlerCommon::UpdateLanguageListCallback( |
252 const base::ListValue* args) { | 254 const base::ListValue* args) { |
253 CHECK_EQ(args->GetSize(), 1u); | 255 CHECK_EQ(args->GetSize(), 1u); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 288 } |
287 | 289 |
288 base::WeakPtr<SpellcheckHunspellDictionary>& | 290 base::WeakPtr<SpellcheckHunspellDictionary>& |
289 LanguageOptionsHandlerCommon::GetHunspellDictionary() { | 291 LanguageOptionsHandlerCommon::GetHunspellDictionary() { |
290 if (!hunspell_dictionary_.get()) | 292 if (!hunspell_dictionary_.get()) |
291 RefreshHunspellDictionary(); | 293 RefreshHunspellDictionary(); |
292 return hunspell_dictionary_; | 294 return hunspell_dictionary_; |
293 } | 295 } |
294 | 296 |
295 } // namespace options | 297 } // namespace options |
OLD | NEW |