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

Side by Side Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 180243025: Changing the UsersPerSession UMA metric to only count possible multi profile sessions and do this u… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing windows build Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
31 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "content/public/browser/browser_shutdown.h" 33 #include "content/public/browser/browser_shutdown.h"
34 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/navigation_details.h" 35 #include "content/public/browser/navigation_details.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 37
38 #if defined(OS_CHROMEOS) 38 #if defined(OS_CHROMEOS)
39 #include "ash/multi_profile_uma.h"
40 #include "ash/session_state_delegate.h"
41 #include "base/sys_info.h" 39 #include "base/sys_info.h"
42 #include "chrome/browser/chromeos/boot_times_loader.h" 40 #include "chrome/browser/chromeos/boot_times_loader.h"
43 #include "chrome/browser/chromeos/login/user_manager.h" 41 #include "chrome/browser/chromeos/login/user_manager.h"
44 #include "chromeos/dbus/dbus_thread_manager.h" 42 #include "chromeos/dbus/dbus_thread_manager.h"
45 #include "chromeos/dbus/session_manager_client.h" 43 #include "chromeos/dbus/session_manager_client.h"
46 #include "chromeos/dbus/update_engine_client.h" 44 #include "chromeos/dbus/update_engine_client.h"
47 #endif 45 #endif
48 46
49 #if defined(OS_WIN) 47 #if defined(OS_WIN)
50 #include "base/win/win_util.h" 48 #include "base/win/win_util.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 141 }
144 142
145 void AttemptUserExit() { 143 void AttemptUserExit() {
146 #if defined(OS_CHROMEOS) 144 #if defined(OS_CHROMEOS)
147 StartShutdownTracing(); 145 StartShutdownTracing();
148 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false); 146 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false);
149 // Write /tmp/uptime-logout-started as well. 147 // Write /tmp/uptime-logout-started as well.
150 const char kLogoutStarted[] = "logout-started"; 148 const char kLogoutStarted[] = "logout-started";
151 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); 149 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted);
152 150
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. 151 // Login screen should show up in owner's locale.
160 PrefService* state = g_browser_process->local_state(); 152 PrefService* state = g_browser_process->local_state();
161 if (state) { 153 if (state) {
162 std::string owner_locale = state->GetString(prefs::kOwnerLocale); 154 std::string owner_locale = state->GetString(prefs::kOwnerLocale);
163 if (!owner_locale.empty() && 155 if (!owner_locale.empty() &&
164 state->GetString(prefs::kApplicationLocale) != owner_locale && 156 state->GetString(prefs::kApplicationLocale) != owner_locale &&
165 !state->IsManagedPreference(prefs::kApplicationLocale)) { 157 !state->IsManagedPreference(prefs::kApplicationLocale)) {
166 state->SetString(prefs::kApplicationLocale, owner_locale); 158 state->SetString(prefs::kApplicationLocale, owner_locale);
167 TRACE_EVENT0("shutdown", "CommitPendingWrite"); 159 TRACE_EVENT0("shutdown", "CommitPendingWrite");
168 state->CommitPendingWrite(); 160 state->CommitPendingWrite();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // environment is still active. 397 // environment is still active.
406 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) 398 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE)
407 return !ash::Shell::HasInstance(); 399 return !ash::Shell::HasInstance();
408 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) 400 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
409 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); 401 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty();
410 #endif 402 #endif
411 return true; 403 return true;
412 } 404 }
413 405
414 } // namespace chrome 406 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698