| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/base/locale_util.h" | 5 #include "chrome/browser/chromeos/base/locale_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 g_browser_process->SetApplicationLocale(data->loaded_locale); | 57 g_browser_process->SetApplicationLocale(data->loaded_locale); |
| 58 | 58 |
| 59 if (data->enableLocaleKeyboardLayouts) { | 59 if (data->enableLocaleKeyboardLayouts) { |
| 60 // If we have switched the locale, enable the keyboard layouts that | 60 // If we have switched the locale, enable the keyboard layouts that |
| 61 // are necessary for the new locale. Change the current input method | 61 // are necessary for the new locale. Change the current input method |
| 62 // to the hardware keyboard layout since the input method currently in | 62 // to the hardware keyboard layout since the input method currently in |
| 63 // use may not be supported by the new locale (3rd parameter). | 63 // use may not be supported by the new locale (3rd parameter). |
| 64 input_method::InputMethodManager* manager = | 64 input_method::InputMethodManager* manager = |
| 65 input_method::InputMethodManager::Get(); | 65 input_method::InputMethodManager::Get(); |
| 66 manager->EnableLoginLayouts( | 66 manager->EnableLoginLayouts( |
| 67 data->locale, | 67 data->loaded_locale, |
| 68 manager->GetInputMethodUtil()->GetHardwareLoginInputMethodIds()); | 68 manager->GetInputMethodUtil()->GetHardwareLoginInputMethodIds()); |
| 69 if (!data->login_layouts_only) { | 69 if (!data->login_layouts_only) { |
| 70 // Enable all the other layouts | 70 // Enable all the other layouts |
| 71 std::vector<std::string> candidates; | 71 std::vector<std::string> candidates; |
| 72 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 72 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
| 73 // Add input methods associated with the language. | 73 // Add input methods associated with the language. |
| 74 util->GetInputMethodIdsFromLanguageCode( | 74 util->GetInputMethodIdsFromLanguageCode( |
| 75 data->locale, input_method::kKeyboardLayoutsOnly, &candidates); | 75 data->loaded_locale, |
| 76 input_method::kKeyboardLayoutsOnly, |
| 77 &candidates); |
| 76 for (std::vector<std::string>::const_iterator i = candidates.begin(); | 78 for (std::vector<std::string>::const_iterator i = candidates.begin(); |
| 77 i != candidates.end(); | 79 i != candidates.end(); |
| 78 ++i) | 80 ++i) |
| 79 manager->EnableInputMethod(*i); | 81 manager->EnableInputMethod(*i); |
| 80 } | 82 } |
| 81 } | 83 } |
| 82 } | 84 } |
| 83 gfx::PlatformFontPango::ReloadDefaultFont(); | 85 gfx::PlatformFontPango::ReloadDefaultFont(); |
| 84 if (data->callback) | 86 if (data->callback) |
| 85 data->callback->Run(data->locale, data->loaded_locale, data->success); | 87 data->callback->Run(data->locale, data->loaded_locale, data->success); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 base::Closure reloader( | 104 base::Closure reloader( |
| 103 base::Bind(&SwitchLanguageDoReloadLocale, base::Unretained(data.get()))); | 105 base::Bind(&SwitchLanguageDoReloadLocale, base::Unretained(data.get()))); |
| 104 content::BrowserThread::PostBlockingPoolTaskAndReply( | 106 content::BrowserThread::PostBlockingPoolTaskAndReply( |
| 105 FROM_HERE, | 107 FROM_HERE, |
| 106 reloader, | 108 reloader, |
| 107 base::Bind(&FinishSwitchLanguage, base::Passed(data.Pass()))); | 109 base::Bind(&FinishSwitchLanguage, base::Passed(data.Pass()))); |
| 108 } | 110 } |
| 109 | 111 |
| 110 } // namespace locale_util | 112 } // namespace locale_util |
| 111 } // namespace chromeos | 113 } // namespace chromeos |
| OLD | NEW |