| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/login/language_switch_menu.h" | 5 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // TODO(markusheintz): Change the if condition to prefs->IsUserModifiable() | 92 // TODO(markusheintz): Change the if condition to prefs->IsUserModifiable() |
| 93 // once Mattias landed his pending patch. | 93 // once Mattias landed his pending patch. |
| 94 if (!prefs->IsManagedPreference(prefs::kApplicationLocale)) { | 94 if (!prefs->IsManagedPreference(prefs::kApplicationLocale)) { |
| 95 prefs->SetString(prefs::kApplicationLocale, locale); | 95 prefs->SetString(prefs::kApplicationLocale, locale); |
| 96 prefs->SavePersistentPrefs(); | 96 prefs->SavePersistentPrefs(); |
| 97 | 97 |
| 98 // Switch the locale. | 98 // Switch the locale. |
| 99 ResourceBundle::ReloadSharedInstance(locale); | 99 ResourceBundle::ReloadSharedInstance(locale); |
| 100 | 100 |
| 101 // Enable the keyboard layouts that are necessary for the new locale. | 101 // Enable the keyboard layouts that are necessary for the new locale. |
| 102 chromeos::input_method::EnableInputMethods( | 102 input_method::EnableInputMethods( |
| 103 locale, chromeos::input_method::kKeyboardLayoutsOnly, | 103 locale, input_method::kKeyboardLayoutsOnly, |
| 104 kHardwareKeyboardLayout); | 104 language_prefs::kHardwareKeyboardLayout); |
| 105 | 105 |
| 106 // The following line does not seem to affect locale anyhow. Maybe in | 106 // The following line does not seem to affect locale anyhow. Maybe in |
| 107 // future.. | 107 // future.. |
| 108 g_browser_process->SetApplicationLocale(locale); | 108 g_browser_process->SetApplicationLocale(locale); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 //////////////////////////////////////////////////////////////////////////////// | 112 //////////////////////////////////////////////////////////////////////////////// |
| 113 // views::ViewMenuDelegate implementation. | 113 // views::ViewMenuDelegate implementation. |
| 114 | 114 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 138 void LanguageSwitchMenu::ExecuteCommand(int command_id) { | 138 void LanguageSwitchMenu::ExecuteCommand(int command_id) { |
| 139 const std::string locale = language_list_->GetLocaleFromIndex(command_id); | 139 const std::string locale = language_list_->GetLocaleFromIndex(command_id); |
| 140 SwitchLanguage(locale); | 140 SwitchLanguage(locale); |
| 141 InitLanguageMenu(); | 141 InitLanguageMenu(); |
| 142 | 142 |
| 143 // Update all view hierarchies that the locale has changed. | 143 // Update all view hierarchies that the locale has changed. |
| 144 views::Widget::NotifyLocaleChanged(); | 144 views::Widget::NotifyLocaleChanged(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace chromeos | 147 } // namespace chromeos |
| OLD | NEW |