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" |
11 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
12 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 12 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
13 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 13 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
14 #include "chrome/browser/chromeos/language_preferences.h" | 14 #include "chrome/browser/chromeos/language_preferences.h" |
15 #include "chrome/browser/chromeos/login/language_list.h" | 15 #include "chrome/browser/chromeos/login/language_list.h" |
16 #include "chrome/browser/chromeos/login/ownership_service.h" | 16 #include "chrome/browser/chromeos/login/ownership_service.h" |
17 #include "chrome/browser/chromeos/login/screen_observer.h" | 17 #include "chrome/browser/chromeos/login/screen_observer.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "grit/platform_locale_settings.h" | 21 #include "grit/platform_locale_settings.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
24 #include "ui/gfx/platform_font_gtk.h" | 24 #include "ui/gfx/platform_font_pango.h" |
25 #include "views/controls/button/menu_button.h" | 25 #include "views/controls/button/menu_button.h" |
26 #include "views/controls/menu/menu_item_view.h" | 26 #include "views/controls/menu/menu_item_view.h" |
27 #include "views/controls/menu/menu_runner.h" | 27 #include "views/controls/menu/menu_runner.h" |
28 #include "views/controls/menu/submenu_view.h" | 28 #include "views/controls/menu/submenu_view.h" |
29 #include "views/widget/widget.h" | 29 #include "views/widget/widget.h" |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 const int kLanguageMainMenuSize = 5; | 33 const int kLanguageMainMenuSize = 5; |
34 // TODO(glotov): need to specify the list as a part of the image customization. | 34 // TODO(glotov): need to specify the list as a part of the image customization. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // gtkrc overrides the styles from previous ones when there is a conflict, but | 132 // gtkrc overrides the styles from previous ones when there is a conflict, but |
133 // styles that are added and not conflicted will not be overridden. So far | 133 // styles that are added and not conflicted will not be overridden. So far |
134 // there are no locales with such a thing; if there are then this solution | 134 // there are no locales with such a thing; if there are then this solution |
135 // will not work. | 135 // will not work. |
136 if (!gtkrc.empty()) | 136 if (!gtkrc.empty()) |
137 gtk_rc_parse_string(gtkrc.c_str()); | 137 gtk_rc_parse_string(gtkrc.c_str()); |
138 else | 138 else |
139 gtk_rc_parse("/etc/gtk-2.0/gtkrc"); | 139 gtk_rc_parse("/etc/gtk-2.0/gtkrc"); |
140 | 140 |
141 // Switch the font. | 141 // Switch the font. |
142 gfx::PlatformFontGtk::ReloadDefaultFont(); | 142 gfx::PlatformFontPango::ReloadDefaultFont(); |
143 ResourceBundle::GetSharedInstance().ReloadFonts(); | 143 ResourceBundle::GetSharedInstance().ReloadFonts(); |
144 } | 144 } |
145 | 145 |
146 // static | 146 // static |
147 void LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts( | 147 void LanguageSwitchMenu::SwitchLanguageAndEnableKeyboardLayouts( |
148 const std::string& locale) { | 148 const std::string& locale) { |
149 if (SwitchLanguage(locale)) { | 149 if (SwitchLanguage(locale)) { |
150 // If we have switched the locale, enable the keyboard layouts that | 150 // If we have switched the locale, enable the keyboard layouts that |
151 // are necessary for the new locale. Change the current input method | 151 // are necessary for the new locale. Change the current input method |
152 // to the hardware keyboard layout since the input method currently in | 152 // to the hardware keyboard layout since the input method currently in |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 g_browser_process->local_state()->SetString( | 193 g_browser_process->local_state()->SetString( |
194 prefs::kApplicationLocale, locale); | 194 prefs::kApplicationLocale, locale); |
195 g_browser_process->local_state()->ScheduleSavePersistentPrefs(); | 195 g_browser_process->local_state()->ScheduleSavePersistentPrefs(); |
196 InitLanguageMenu(); | 196 InitLanguageMenu(); |
197 | 197 |
198 // Update all view hierarchies that the locale has changed. | 198 // Update all view hierarchies that the locale has changed. |
199 views::Widget::NotifyLocaleChanged(); | 199 views::Widget::NotifyLocaleChanged(); |
200 } | 200 } |
201 | 201 |
202 } // namespace chromeos | 202 } // namespace chromeos |
OLD | NEW |