Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Unified Diff: chrome/browser/chromeos/login/language_switch_menu.cc

Issue 2809058: Add application locale policy. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: " Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/language_switch_menu.cc
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc
old mode 100644
new mode 100755
index ae643581d2ee290d4e128dee44828ad7f0002498..d93e8fe85198b7ea876255391f8f829b4becfab5
--- a/chrome/browser/chromeos/login/language_switch_menu.cc
+++ b/chrome/browser/chromeos/login/language_switch_menu.cc
@@ -88,19 +88,26 @@ void LanguageSwitchMenu::SwitchLanguage(const std::string& locale) {
// Save new locale.
DCHECK(g_browser_process);
PrefService* prefs = g_browser_process->local_state();
- prefs->SetString(prefs::kApplicationLocale, locale);
- prefs->SavePersistentPrefs();
-
- // Switch the locale.
- ResourceBundle::ReloadSharedInstance(UTF8ToWide(locale));
-
- // Enable the keyboard layouts that are necessary for the new locale.
- chromeos::input_method::EnableInputMethods(
- locale, chromeos::input_method::kKeyboardLayoutsOnly,
- kHardwareKeyboardLayout);
-
- // The following line does not seem to affect locale anyhow. Maybe in future..
- g_browser_process->SetApplicationLocale(locale);
+ // TODO(markusheintz): If the preference is managed and can not be changed by
+ // the user, changing the language should be disabled in the UI.
+ // TODO(markusheintz): Change the if condition to prefs->IsUserModifiable()
+ // once Mattias landed his pending patch.
+ if (!prefs->IsManagedPreference(prefs::kApplicationLocale)) {
+ prefs->SetString(prefs::kApplicationLocale, locale);
+ prefs->SavePersistentPrefs();
+
+ // Switch the locale.
+ ResourceBundle::ReloadSharedInstance(UTF8ToWide(locale));
+
+ // Enable the keyboard layouts that are necessary for the new locale.
+ chromeos::input_method::EnableInputMethods(
+ locale, chromeos::input_method::kKeyboardLayoutsOnly,
+ kHardwareKeyboardLayout);
+
+ // The following line does not seem to affect locale anyhow. Maybe in
+ // future..
+ g_browser_process->SetApplicationLocale(locale);
+ }
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/chromeos/input_method/candidate_window.cc ('k') | chrome/browser/configuration_policy_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698