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 "ash/shell.h" | |
8 #include "base/bind.h" | 7 #include "base/bind.h" |
9 #include "base/command_line.h" | 8 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
11 #include "base/logging.h" | 10 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
14 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
15 #include "build/build_config.h" | 14 #include "build/build_config.h" |
16 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/browser_process_platform_part.h" | 16 #include "chrome/browser/browser_process_platform_part.h" |
(...skipping 11 matching lines...) Expand all Loading... |
29 #include "chrome/browser/ui/browser_window.h" | 28 #include "chrome/browser/ui/browser_window.h" |
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
31 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
33 #include "content/public/browser/browser_shutdown.h" | 32 #include "content/public/browser/browser_shutdown.h" |
34 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/navigation_details.h" | 34 #include "content/public/browser/navigation_details.h" |
36 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
37 | 36 |
38 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
39 #include "ash/multi_profile_uma.h" | |
40 #include "ash/session_state_delegate.h" | |
41 #include "base/sys_info.h" | 38 #include "base/sys_info.h" |
42 #include "chrome/browser/chromeos/boot_times_loader.h" | 39 #include "chrome/browser/chromeos/boot_times_loader.h" |
43 #include "chrome/browser/chromeos/login/user_manager.h" | 40 #include "chrome/browser/chromeos/login/user_manager.h" |
44 #include "chromeos/dbus/dbus_thread_manager.h" | 41 #include "chromeos/dbus/dbus_thread_manager.h" |
45 #include "chromeos/dbus/session_manager_client.h" | 42 #include "chromeos/dbus/session_manager_client.h" |
46 #include "chromeos/dbus/update_engine_client.h" | 43 #include "chromeos/dbus/update_engine_client.h" |
47 #endif | 44 #endif |
48 | 45 |
49 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
50 #include "base/win/win_util.h" | 47 #include "base/win/win_util.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 140 } |
144 | 141 |
145 void AttemptUserExit() { | 142 void AttemptUserExit() { |
146 #if defined(OS_CHROMEOS) | 143 #if defined(OS_CHROMEOS) |
147 StartShutdownTracing(); | 144 StartShutdownTracing(); |
148 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false); | 145 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false); |
149 // Write /tmp/uptime-logout-started as well. | 146 // Write /tmp/uptime-logout-started as well. |
150 const char kLogoutStarted[] = "logout-started"; | 147 const char kLogoutStarted[] = "logout-started"; |
151 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); | 148 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); |
152 | 149 |
153 // Since we are shutting down now we should record how many users have joined | |
154 // the session since session start. | |
155 ash::MultiProfileUMA::RecordUserCount( | |
156 ash::Shell::GetInstance()->session_state_delegate()-> | |
157 NumberOfLoggedInUsers()); | |
158 | |
159 // Login screen should show up in owner's locale. | 150 // Login screen should show up in owner's locale. |
160 PrefService* state = g_browser_process->local_state(); | 151 PrefService* state = g_browser_process->local_state(); |
161 if (state) { | 152 if (state) { |
162 std::string owner_locale = state->GetString(prefs::kOwnerLocale); | 153 std::string owner_locale = state->GetString(prefs::kOwnerLocale); |
163 if (!owner_locale.empty() && | 154 if (!owner_locale.empty() && |
164 state->GetString(prefs::kApplicationLocale) != owner_locale && | 155 state->GetString(prefs::kApplicationLocale) != owner_locale && |
165 !state->IsManagedPreference(prefs::kApplicationLocale)) { | 156 !state->IsManagedPreference(prefs::kApplicationLocale)) { |
166 state->SetString(prefs::kApplicationLocale, owner_locale); | 157 state->SetString(prefs::kApplicationLocale, owner_locale); |
167 TRACE_EVENT0("shutdown", "CommitPendingWrite"); | 158 TRACE_EVENT0("shutdown", "CommitPendingWrite"); |
168 state->CommitPendingWrite(); | 159 state->CommitPendingWrite(); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // environment is still active. | 396 // environment is still active. |
406 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 397 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
407 return !ash::Shell::HasInstance(); | 398 return !ash::Shell::HasInstance(); |
408 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 399 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
409 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 400 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
410 #endif | 401 #endif |
411 return true; | 402 return true; |
412 } | 403 } |
413 | 404 |
414 } // namespace chrome | 405 } // namespace chrome |
OLD | NEW |