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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 2652793003: Add login screen locale and input method device policies (Closed)
Patch Set: Cleanup variable names Created 3 years, 11 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/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index e603602cc707f09aafa2bb81e3dda5fee1ef99f8..db99c85a681231fa15bd2ea3ba1e0df8c30ffcb6 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -46,10 +46,13 @@
#if defined(OS_CHROMEOS)
#include "base/sys_info.h"
#include "chrome/browser/chromeos/boot_times_recorder.h"
+#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/power_policy_controller.h"
#include "chromeos/dbus/session_manager_client.h"
#include "chromeos/dbus/update_engine_client.h"
+#include "chromeos/settings/cros_settings_names.h"
+#include "ui/base/l10n/l10n_util.h"
#endif
#if defined(OS_WIN)
@@ -168,12 +171,30 @@ void AttemptUserExit() {
if (state) {
chromeos::BootTimesRecorder::Get()->OnLogoutStarted(state);
+ bool commit_pending_write = false;
+
// Login screen should show up in owner's locale.
std::string owner_locale = state->GetString(prefs::kOwnerLocale);
if (!owner_locale.empty() &&
state->GetString(prefs::kApplicationLocale) != owner_locale &&
!state->IsManagedPreference(prefs::kApplicationLocale)) {
state->SetString(prefs::kApplicationLocale, owner_locale);
+ commit_pending_write = true;
+ }
+
+ // If a policy mandates the login screen locale, use it.
+ chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get();
+ const base::ListValue* login_screen_locales = nullptr;
+ std::string login_screen_locale;
+ if (cros_settings->GetList(chromeos::kDeviceLoginScreenLocales,
+ &login_screen_locales) &&
+ !login_screen_locales->empty() &&
+ login_screen_locales->GetString(0, &login_screen_locale)) {
+ state->SetString(prefs::kApplicationLocale, login_screen_locale);
+ commit_pending_write = true;
+ }
+
+ if (commit_pending_write) {
TRACE_EVENT0("shutdown", "CommitPendingWrite");
state->CommitPendingWrite();
}

Powered by Google App Engine
This is Rietveld 408576698