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

Unified Diff: chrome/browser/metrics/metrics_log.cc

Issue 25364002: Add multi_profile_user_count field to system_profile proto. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
« no previous file with comments | « chrome/browser/metrics/metrics_log.h ('k') | chrome/browser/metrics/metrics_log_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_log.cc
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index f2962a5015a797296396ea2cb0afa8db2c23b025..49d7fc7a932890d5f25094bc2d2da656d5718d19 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -62,6 +62,10 @@
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/login/user_manager.h"
+#endif
+
using content::GpuDataManager;
using metrics::OmniboxEventProto;
using metrics::PerfDataProto;
@@ -379,7 +383,11 @@ static base::LazyInstance<std::string>::Leaky
g_version_extension = LAZY_INSTANCE_INITIALIZER;
MetricsLog::MetricsLog(const std::string& client_id, int session_id)
- : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {}
+ : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {
+#if defined(OS_CHROMEOS)
+ UpdateMultiProfileUserCount();
+#endif
+}
MetricsLog::~MetricsLog() {}
@@ -799,6 +807,7 @@ void MetricsLog::RecordEnvironmentProto(
base::Unretained(this)));
DCHECK(adapter_.get());
WriteBluetoothProto(hardware);
+ UpdateMultiProfileUserCount();
#endif
}
@@ -954,3 +963,21 @@ void MetricsLog::WriteBluetoothProto(
}
#endif // defined(OS_CHROMEOS)
}
+
+#if defined(OS_CHROMEOS)
+void MetricsLog::UpdateMultiProfileUserCount() {
+ if (chromeos::UserManager::IsInitialized() &&
+ chromeos::UserManager::Get()->IsMultipleProfilesAllowed()) {
+ uint32 user_count = chromeos::UserManager::Get()
+ ->GetLoggedInUsers().size();
+ SystemProfileProto* system_profile = uma_proto()->mutable_system_profile();
+
+ // We invalidate the user count if it changed while the log was open.
+ if (system_profile->has_multi_profile_user_count() &&
+ user_count != system_profile->multi_profile_user_count())
+ user_count = 0;
+
+ system_profile->set_multi_profile_user_count(user_count);
+ }
+}
+#endif
« no previous file with comments | « chrome/browser/metrics/metrics_log.h ('k') | chrome/browser/metrics/metrics_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698