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

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

Issue 2652793003: Add login screen locale and input method device policies (Closed)
Patch Set: Cleanup, display IME Tray even for a single IME when managed. 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..33537b7dd0982a54479c7c53ce63d5e620a217ba 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -46,10 +46,12 @@
#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"
#endif
#if defined(OS_WIN)
@@ -168,12 +170,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* loginScreenLocales = nullptr;
+ std::string loginScreenLocale;
+ if (cros_settings->GetList(chromeos::kDeviceLoginScreenLocales,
+ &loginScreenLocales) &&
+ !loginScreenLocales->empty() &&
+ loginScreenLocales->GetString(0, &loginScreenLocale)) {
+ state->SetString(prefs::kApplicationLocale, loginScreenLocale);
+
+ commit_pending_write = true;
+ }
+ if (commit_pending_write) {
TRACE_EVENT0("shutdown", "CommitPendingWrite");
state->CommitPendingWrite();
}

Powered by Google App Engine
This is Rietveld 408576698