Chromium Code Reviews| 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 #endif | |
|
sky
2011/10/12 00:04:34
If you don't have a NOTIMPLEMENTED here, then you
Emmanuel Saint-loubert-Bié
2011/10/12 00:21:28
Done.
| |
| 148 | 150 |
| 149 // Switch the font. | 151 // Switch the font. |
| 150 gfx::PlatformFontPango::ReloadDefaultFont(); | 152 gfx::PlatformFontPango::ReloadDefaultFont(); |
| 151 ResourceBundle::GetSharedInstance().ReloadFonts(); | 153 ResourceBundle::GetSharedInstance().ReloadFonts(); |
| 152 } | 154 } |
| 153 | 155 |
| 154 // static | 156 // static |
| 155 void LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts( | 157 void LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts( |
| 156 const std::string& locale) { | 158 const std::string& locale) { |
| 157 if (SwitchLanguage(locale)) { | 159 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 | 200 // Here, we should enable keyboard layouts associated with the locale so |
| 199 // that users can use those keyboard layouts on the login screen. | 201 // that users can use those keyboard layouts on the login screen. |
| 200 SwitchLanguageAndEnableKeyboardLayouts(locale); | 202 SwitchLanguageAndEnableKeyboardLayouts(locale); |
| 201 InitLanguageMenu(); | 203 InitLanguageMenu(); |
| 202 | 204 |
| 203 // Update all view hierarchies that the locale has changed. | 205 // Update all view hierarchies that the locale has changed. |
| 204 views::Widget::NotifyLocaleChanged(); | 206 views::Widget::NotifyLocaleChanged(); |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace chromeos | 209 } // namespace chromeos |
| OLD | NEW |