summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/multi_profile_uma.cc5
-rw-r--r--ash/multi_profile_uma.h3
-rw-r--r--chrome/browser/chromeos/login/user_manager_impl.cc5
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc11
-rw-r--r--chrome/browser/lifetime/application_lifetime.cc8
-rw-r--r--chrome/browser/ui/ash/session_state_delegate_chromeos.cc9
-rw-r--r--tools/metrics/histograms/histograms.xml2
7 files changed, 29 insertions, 14 deletions
diff --git a/ash/multi_profile_uma.cc b/ash/multi_profile_uma.cc
index f6d9840..2dd4049 100644
--- a/ash/multi_profile_uma.cc
+++ b/ash/multi_profile_uma.cc
@@ -36,4 +36,9 @@ void MultiProfileUMA::RecordTeleportAction(TeleportWindowAction action) {
NUM_TELEPORT_WINDOW_ACTIONS);
}
+// static
+void MultiProfileUMA::RecordUserCount(int number_of_users) {
+ UMA_HISTOGRAM_COUNTS_100("MultiProfile.UsersPerSession", number_of_users);
+}
+
} // namespace ash
diff --git a/ash/multi_profile_uma.h b/ash/multi_profile_uma.h
index 1c70482..a39ed81 100644
--- a/ash/multi_profile_uma.h
+++ b/ash/multi_profile_uma.h
@@ -55,6 +55,9 @@ class ASH_EXPORT MultiProfileUMA {
// Record the way and how many times a window got teleported to another desk.
static void RecordTeleportAction(TeleportWindowAction action);
+ // Record number of users joined into a session. Called upon logout.
+ static void RecordUserCount(int number_of_users);
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(MultiProfileUMA);
};
diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc
index f7547ea..5fae58b 100644
--- a/chrome/browser/chromeos/login/user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc
@@ -378,11 +378,6 @@ void UserManagerImpl::UserLoggedIn(const std::string& user_id,
UMA_HISTOGRAM_ENUMERATION("UserManager.LoginUserType",
active_user_->GetType(), User::NUM_USER_TYPES);
- if (IsMultipleProfilesAllowed()) {
- UMA_HISTOGRAM_COUNTS_100("MultiProfile.UserCount",
- GetLoggedInUsers().size());
- }
-
g_browser_process->local_state()->SetString(kLastLoggedInRegularUser,
(active_user_->GetType() == User::USER_TYPE_REGULAR) ? user_id : "");
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 2468cd2..c71fb3b 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -598,7 +598,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
}
virtual void ShowUserLogin() OVERRIDE {
- if (!ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled())
+ ash::Shell* shell = ash::Shell::GetInstance();
+ if (!shell->delegate()->IsMultiProfilesEnabled())
return;
// Only regular users could add other users to current session.
@@ -607,12 +608,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
return;
}
- // TODO(nkostylev): Show some UI messages why no more users could be added
- // to this session. http://crbug.com/230863
- // We limit list of logged in users to 3 due to memory constraints.
- // TODO(nkostylev): Adjust this limitation based on device capabilites.
- // http://crbug.com/230865
- if (UserManager::Get()->GetLoggedInUsers().size() >= 3)
+ if (static_cast<int>(UserManager::Get()->GetLoggedInUsers().size()) >=
+ shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers())
return;
// Launch sign in screen to add another user to current session.
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index 064c935..2185d61 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -36,6 +36,8 @@
#include "content/public/browser/notification_service.h"
#if defined(OS_CHROMEOS)
+#include "ash/multi_profile_uma.h"
+#include "ash/session_state_delegate.h"
#include "base/sys_info.h"
#include "chrome/browser/chromeos/boot_times_loader.h"
#include "chrome/browser/chromeos/login/user_manager.h"
@@ -148,6 +150,12 @@ void AttemptUserExit() {
const char kLogoutStarted[] = "logout-started";
chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted);
+ // Since we are shutting down now we should record how many users have joined
+ // the session since session start.
+ ash::MultiProfileUMA::RecordUserCount(
+ ash::Shell::GetInstance()->session_state_delegate()->
+ NumberOfLoggedInUsers());
+
// Login screen should show up in owner's locale.
PrefService* state = g_browser_process->local_state();
if (state) {
diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
index 3d8c3ac..d018c11 100644
--- a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
@@ -30,7 +30,14 @@ SessionStateDelegateChromeos::~SessionStateDelegateChromeos() {
}
int SessionStateDelegateChromeos::GetMaximumNumberOfLoggedInUsers() const {
- return 3;
+ // TODO(nkostylev): Show some UI messages why no more users could be added
+ // to this session. http://crbug.com/230863
+ // We limit list of logged in users to 10 due to memory constraints.
+ // Note that 10 seems excessive, but we want to test how many users are
+ // actually added to a session.
+ // TODO(nkostylev): Adjust this limitation based on device capabilites.
+ // http://crbug.com/230865
+ return 10;
}
int SessionStateDelegateChromeos::NumberOfLoggedInUsers() const {
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index b2d2875..5f8a0ef 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -7233,7 +7233,7 @@ other types of suffix sets.
</summary>
</histogram>
-<histogram name="Multiprofile.UserCount">
+<histogram name="MultiProfile.UsersPerSession">
<summary>
The number of users simultaneously signed into a multiprofile session on
ChromeOS. This is recorded whenever a new user logs in.