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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->locale, |
68 manager->GetInputMethodUtil()->GetHardwareLoginInputMethodId()); | 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->locale, input_method::kKeyboardLayoutsOnly, &candidates); |
76 for (std::vector<std::string>::const_iterator i = candidates.begin(); | 76 for (std::vector<std::string>::const_iterator i = candidates.begin(); |
77 i != candidates.end(); | 77 i != candidates.end(); |
78 ++i) | 78 ++i) |
(...skipping 23 matching lines...) Expand all Loading... |
102 base::Closure reloader( | 102 base::Closure reloader( |
103 base::Bind(&SwitchLanguageDoReloadLocale, base::Unretained(data.get()))); | 103 base::Bind(&SwitchLanguageDoReloadLocale, base::Unretained(data.get()))); |
104 content::BrowserThread::PostBlockingPoolTaskAndReply( | 104 content::BrowserThread::PostBlockingPoolTaskAndReply( |
105 FROM_HERE, | 105 FROM_HERE, |
106 reloader, | 106 reloader, |
107 base::Bind(&FinishSwitchLanguage, base::Passed(data.Pass()))); | 107 base::Bind(&FinishSwitchLanguage, base::Passed(data.Pass()))); |
108 } | 108 } |
109 | 109 |
110 } // namespace locale_util | 110 } // namespace locale_util |
111 } // namespace chromeos | 111 } // namespace chromeos |
OLD | NEW |