OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/lifetime/application_lifetime.h" | 5 #include "chrome/browser/lifetime/application_lifetime.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
40 #include "components/metrics/metrics_service.h" | 40 #include "components/metrics/metrics_service.h" |
41 #include "components/prefs/pref_service.h" | 41 #include "components/prefs/pref_service.h" |
42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/navigation_details.h" | 43 #include "content/public/browser/navigation_details.h" |
44 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
45 | 45 |
46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
47 #include "base/sys_info.h" | 47 #include "base/sys_info.h" |
48 #include "chrome/browser/chromeos/boot_times_recorder.h" | 48 #include "chrome/browser/chromeos/boot_times_recorder.h" |
| 49 #include "chrome/browser/chromeos/settings/cros_settings.h" |
49 #include "chromeos/dbus/dbus_thread_manager.h" | 50 #include "chromeos/dbus/dbus_thread_manager.h" |
50 #include "chromeos/dbus/power_policy_controller.h" | 51 #include "chromeos/dbus/power_policy_controller.h" |
51 #include "chromeos/dbus/session_manager_client.h" | 52 #include "chromeos/dbus/session_manager_client.h" |
52 #include "chromeos/dbus/update_engine_client.h" | 53 #include "chromeos/dbus/update_engine_client.h" |
| 54 #include "chromeos/settings/cros_settings_names.h" |
53 #endif | 55 #endif |
54 | 56 |
55 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
56 #include "base/win/win_util.h" | 58 #include "base/win/win_util.h" |
57 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 59 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
58 #endif | 60 #endif |
59 | 61 |
60 namespace chrome { | 62 namespace chrome { |
61 namespace { | 63 namespace { |
62 | 64 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 #if defined(OS_CHROMEOS) | 163 #if defined(OS_CHROMEOS) |
162 VLOG(1) << "AttemptUserExit"; | 164 VLOG(1) << "AttemptUserExit"; |
163 browser_shutdown::StartShutdownTracing(); | 165 browser_shutdown::StartShutdownTracing(); |
164 chromeos::BootTimesRecorder::Get()->AddLogoutTimeMarker("LogoutStarted", | 166 chromeos::BootTimesRecorder::Get()->AddLogoutTimeMarker("LogoutStarted", |
165 false); | 167 false); |
166 | 168 |
167 PrefService* state = g_browser_process->local_state(); | 169 PrefService* state = g_browser_process->local_state(); |
168 if (state) { | 170 if (state) { |
169 chromeos::BootTimesRecorder::Get()->OnLogoutStarted(state); | 171 chromeos::BootTimesRecorder::Get()->OnLogoutStarted(state); |
170 | 172 |
| 173 bool commit_pending_write = false; |
| 174 |
171 // Login screen should show up in owner's locale. | 175 // Login screen should show up in owner's locale. |
172 std::string owner_locale = state->GetString(prefs::kOwnerLocale); | 176 std::string owner_locale = state->GetString(prefs::kOwnerLocale); |
173 if (!owner_locale.empty() && | 177 if (!owner_locale.empty() && |
174 state->GetString(prefs::kApplicationLocale) != owner_locale && | 178 state->GetString(prefs::kApplicationLocale) != owner_locale && |
175 !state->IsManagedPreference(prefs::kApplicationLocale)) { | 179 !state->IsManagedPreference(prefs::kApplicationLocale)) { |
176 state->SetString(prefs::kApplicationLocale, owner_locale); | 180 state->SetString(prefs::kApplicationLocale, owner_locale); |
| 181 commit_pending_write = true; |
| 182 } |
| 183 |
| 184 // If a policy mandates the login screen locale, use it. |
| 185 chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get(); |
| 186 const base::ListValue* loginScreenLocales = nullptr; |
| 187 std::string loginScreenLocale; |
| 188 if (cros_settings->GetList(chromeos::kDeviceLoginScreenLocales, |
| 189 &loginScreenLocales) && |
| 190 !loginScreenLocales->empty() && |
| 191 loginScreenLocales->GetString(0, &loginScreenLocale)) { |
| 192 state->SetString(prefs::kApplicationLocale, loginScreenLocale); |
| 193 |
| 194 commit_pending_write = true; |
| 195 } |
| 196 if (commit_pending_write) { |
177 TRACE_EVENT0("shutdown", "CommitPendingWrite"); | 197 TRACE_EVENT0("shutdown", "CommitPendingWrite"); |
178 state->CommitPendingWrite(); | 198 state->CommitPendingWrite(); |
179 } | 199 } |
180 } | 200 } |
181 g_send_stop_request_to_session_manager = true; | 201 g_send_stop_request_to_session_manager = true; |
182 // On ChromeOS, always terminate the browser, regardless of the result of | 202 // On ChromeOS, always terminate the browser, regardless of the result of |
183 // AreAllBrowsersCloseable(). See crbug.com/123107. | 203 // AreAllBrowsersCloseable(). See crbug.com/123107. |
184 chrome::NotifyAndTerminate(true); | 204 chrome::NotifyAndTerminate(true); |
185 #else | 205 #else |
186 // Reset the restart bit that might have been set in cancelled restart | 206 // Reset the restart bit that might have been set in cancelled restart |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 void OnAppExiting() { | 428 void OnAppExiting() { |
409 static bool notified = false; | 429 static bool notified = false; |
410 if (notified) | 430 if (notified) |
411 return; | 431 return; |
412 notified = true; | 432 notified = true; |
413 HandleAppExitingForPlatform(); | 433 HandleAppExitingForPlatform(); |
414 } | 434 } |
415 #endif // !defined(OS_ANDROID) | 435 #endif // !defined(OS_ANDROID) |
416 | 436 |
417 } // namespace chrome | 437 } // namespace chrome |
OLD | NEW |