OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/l10n_util.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 scoped_ptr<chromeos::locale_util::LanguageSwitchResult> | 425 scoped_ptr<chromeos::locale_util::LanguageSwitchResult> |
426 language_switch_result, | 426 language_switch_result, |
427 UILanguageListResolvedCallback callback) { | 427 UILanguageListResolvedCallback callback) { |
428 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 428 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
429 | 429 |
430 scoped_ptr<scoped_ptr<base::ListValue>> new_language_list( | 430 scoped_ptr<scoped_ptr<base::ListValue>> new_language_list( |
431 new scoped_ptr<base::ListValue>()); | 431 new scoped_ptr<base::ListValue>()); |
432 scoped_ptr<std::string> new_language_list_locale(new std::string); | 432 scoped_ptr<std::string> new_language_list_locale(new std::string); |
433 scoped_ptr<std::string> new_selected_language(new std::string); | 433 scoped_ptr<std::string> new_selected_language(new std::string); |
434 | 434 |
435 content::BrowserThread::GetBlockingPool()->PostTaskAndReply( | 435 base::Closure resolve_on_pool = |
436 FROM_HERE, | |
437 base::Bind(&ResolveLanguageListOnBlockingPool, | 436 base::Bind(&ResolveLanguageListOnBlockingPool, |
438 base::Owned(language_switch_result.release()), | 437 base::Owned(language_switch_result.release()), |
439 base::Unretained(new_language_list.get()), | 438 base::Unretained(new_language_list.get()), |
440 base::Unretained(new_language_list_locale.get()), | 439 base::Unretained(new_language_list_locale.get()), |
441 base::Unretained(new_selected_language.get())), | 440 base::Unretained(new_selected_language.get())); |
| 441 |
| 442 base::Closure on_language_list_resolved = |
442 base::Bind(&OnLanguageListResolved, | 443 base::Bind(&OnLanguageListResolved, |
443 callback, | 444 callback, |
444 base::Passed(new_language_list.Pass()), | 445 base::Passed(new_language_list.Pass()), |
445 base::Passed(new_language_list_locale.Pass()), | 446 base::Passed(new_language_list_locale.Pass()), |
446 base::Passed(new_selected_language.Pass()))); | 447 base::Passed(new_selected_language.Pass())); |
| 448 |
| 449 content::BrowserThread::GetBlockingPool()->PostTaskAndReply( |
| 450 FROM_HERE, resolve_on_pool, on_language_list_resolved); |
447 } | 451 } |
448 | 452 |
449 scoped_ptr<base::ListValue> GetMinimalUILanguageList() { | 453 scoped_ptr<base::ListValue> GetMinimalUILanguageList() { |
450 const std::string application_locale = | 454 const std::string application_locale = |
451 g_browser_process->GetApplicationLocale(); | 455 g_browser_process->GetApplicationLocale(); |
452 base::string16 language_native_display_name = | 456 base::string16 language_native_display_name = |
453 l10n_util::GetDisplayNameForLocale( | 457 l10n_util::GetDisplayNameForLocale( |
454 application_locale, application_locale, true); | 458 application_locale, application_locale, true); |
455 | 459 |
456 scoped_ptr<base::ListValue> language_list(new base::ListValue()); | 460 scoped_ptr<base::ListValue> language_list(new base::ListValue()); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 619 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
616 const input_method::InputMethodDescriptor current_input_method = | 620 const input_method::InputMethodDescriptor current_input_method = |
617 input_method::InputMethodManager::Get() | 621 input_method::InputMethodManager::Get() |
618 ->GetActiveIMEState() | 622 ->GetActiveIMEState() |
619 ->GetCurrentInputMethod(); | 623 ->GetCurrentInputMethod(); |
620 return CreateInputMethodsEntry(current_input_method, | 624 return CreateInputMethodsEntry(current_input_method, |
621 current_input_method.id()); | 625 current_input_method.id()); |
622 } | 626 } |
623 | 627 |
624 } // namespace chromeos | 628 } // namespace chromeos |
OLD | NEW |