| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 prefs->SetString(prefs::kApplicationLocale, locale); | 126 prefs->SetString(prefs::kApplicationLocale, locale); |
| 127 prefs->SavePersistentPrefs(); | 127 prefs->SavePersistentPrefs(); |
| 128 | 128 |
| 129 return true; | 129 return true; |
| 130 } | 130 } |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 // static | 134 // static |
| 135 void LanguageSwitchMenu::LoadFontsForCurrentLocale() { | 135 void LanguageSwitchMenu::LoadFontsForCurrentLocale() { |
| 136 #if defined(TOOLKIT_USES_GTK) |
| 136 std::string gtkrc = l10n_util::GetStringUTF8(IDS_LOCALE_GTKRC); | 137 std::string gtkrc = l10n_util::GetStringUTF8(IDS_LOCALE_GTKRC); |
| 137 | 138 |
| 138 // Read locale-specific gtkrc. Ideally we'd discard all the previously read | 139 // Read locale-specific gtkrc. Ideally we'd discard all the previously read |
| 139 // gtkrc information, but GTK doesn't support that. Reading the new locale's | 140 // gtkrc information, but GTK doesn't support that. Reading the new locale's |
| 140 // gtkrc overrides the styles from previous ones when there is a conflict, but | 141 // gtkrc overrides the styles from previous ones when there is a conflict, but |
| 141 // styles that are added and not conflicted will not be overridden. So far | 142 // styles that are added and not conflicted will not be overridden. So far |
| 142 // there are no locales with such a thing; if there are then this solution | 143 // there are no locales with such a thing; if there are then this solution |
| 143 // will not work. | 144 // will not work. |
| 144 if (!gtkrc.empty()) | 145 if (!gtkrc.empty()) |
| 145 gtk_rc_parse_string(gtkrc.c_str()); | 146 gtk_rc_parse_string(gtkrc.c_str()); |
| 146 else | 147 else |
| 147 gtk_rc_parse("/etc/gtk-2.0/gtkrc"); | 148 gtk_rc_parse("/etc/gtk-2.0/gtkrc"); |
| 149 #else |
| 150 // TODO(saintlou): Need to figure out an Aura equivalent. |
| 151 NOTIMPLEMENTED(); |
| 152 #endif |
| 148 | 153 |
| 149 // Switch the font. | 154 // Switch the font. |
| 150 gfx::PlatformFontPango::ReloadDefaultFont(); | 155 gfx::PlatformFontPango::ReloadDefaultFont(); |
| 151 ResourceBundle::GetSharedInstance().ReloadFonts(); | 156 ResourceBundle::GetSharedInstance().ReloadFonts(); |
| 152 } | 157 } |
| 153 | 158 |
| 154 // static | 159 // static |
| 155 void LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts( | 160 void LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts( |
| 156 const std::string& locale) { | 161 const std::string& locale) { |
| 157 if (SwitchLanguage(locale)) { | 162 if (SwitchLanguage(locale)) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Here, we should enable keyboard layouts associated with the locale so | 203 // Here, we should enable keyboard layouts associated with the locale so |
| 199 // that users can use those keyboard layouts on the login screen. | 204 // that users can use those keyboard layouts on the login screen. |
| 200 SwitchLanguageAndEnableKeyboardLayouts(locale); | 205 SwitchLanguageAndEnableKeyboardLayouts(locale); |
| 201 InitLanguageMenu(); | 206 InitLanguageMenu(); |
| 202 | 207 |
| 203 // Update all view hierarchies that the locale has changed. | 208 // Update all view hierarchies that the locale has changed. |
| 204 views::Widget::NotifyLocaleChanged(); | 209 views::Widget::NotifyLocaleChanged(); |
| 205 } | 210 } |
| 206 | 211 |
| 207 } // namespace chromeos | 212 } // namespace chromeos |
| OLD | NEW |