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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 if (data->success) { | 56 if (data->success) { |
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 std::vector<std::string> hardware_layouts; |
67 data->locale, | 67 manager->GetInputMethodUtil()->GetHardwareLoginInputMethodId( |
Alexander Alekseev
2014/02/11 13:36:02
nit: GetHardwareLoginInputMethodId => GetHardwareL
Seigo Nonaka
2014/02/12 13:21:02
Done.
| |
68 manager->GetInputMethodUtil()->GetHardwareLoginInputMethodId()); | 68 &hardware_layouts); |
69 manager->EnableLoginLayouts(data->locale, hardware_layouts); | |
69 if (!data->login_layouts_only) { | 70 if (!data->login_layouts_only) { |
70 // Enable all the other layouts | 71 // Enable all the other layouts |
71 std::vector<std::string> candidates; | 72 std::vector<std::string> candidates; |
72 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 73 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
73 // Add input methods associated with the language. | 74 // Add input methods associated with the language. |
74 util->GetInputMethodIdsFromLanguageCode( | 75 util->GetInputMethodIdsFromLanguageCode( |
75 data->locale, input_method::kKeyboardLayoutsOnly, &candidates); | 76 data->locale, input_method::kKeyboardLayoutsOnly, &candidates); |
76 for (std::vector<std::string>::const_iterator i = candidates.begin(); | 77 for (std::vector<std::string>::const_iterator i = candidates.begin(); |
77 i != candidates.end(); | 78 i != candidates.end(); |
78 ++i) | 79 ++i) |
(...skipping 23 matching lines...) Expand all Loading... | |
102 base::Closure reloader( | 103 base::Closure reloader( |
103 base::Bind(&SwitchLanguageDoReloadLocale, base::Unretained(data.get()))); | 104 base::Bind(&SwitchLanguageDoReloadLocale, base::Unretained(data.get()))); |
104 content::BrowserThread::PostBlockingPoolTaskAndReply( | 105 content::BrowserThread::PostBlockingPoolTaskAndReply( |
105 FROM_HERE, | 106 FROM_HERE, |
106 reloader, | 107 reloader, |
107 base::Bind(&FinishSwitchLanguage, base::Passed(data.Pass()))); | 108 base::Bind(&FinishSwitchLanguage, base::Passed(data.Pass()))); |
108 } | 109 } |
109 | 110 |
110 } // namespace locale_util | 111 } // namespace locale_util |
111 } // namespace chromeos | 112 } // namespace chromeos |
OLD | NEW |