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

Unified Diff: chrome/browser/profiles/profile_metrics.cc

Issue 405473004: Only track profile inactivity for non-mobile platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move the ifdef Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_metrics.cc
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
index b7023672c529c6cb7b783727d9943966ca7e4165..6ec6908572f41c845eef10dcc2ee22f03834f4fa 100644
--- a/chrome/browser/profiles/profile_metrics.cc
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -68,6 +68,18 @@ void LogLockedProfileInformation(ProfileManager* manager) {
}
}
+bool HasProfileAtIndexBeenActiveSince(const ProfileInfoCache& info_cache,
+ int index,
+ const base::Time& active_limit) {
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ // TODO(mlerman): iOS and Android should set an ActiveTime in the
+ // ProfileInfoCache. (see ProfileManager::OnBrowserSetLastActive)
+ if (info_cache.GetProfileActiveTimeAtIndex(index) < active_limit)
+ return false;
+#endif
+ return true;
+}
+
} // namespace
enum ProfileAvatar {
@@ -118,7 +130,7 @@ bool ProfileMetrics::CountProfileInformation(ProfileManager* manager,
base::TimeDelta::FromDays(kMaximumDaysOfDisuse);
for (size_t i = 0; i < number_of_profiles; ++i) {
- if (info_cache.GetProfileActiveTimeAtIndex(i) < oldest) {
+ if (!HasProfileAtIndexBeenActiveSince(info_cache, i, oldest)) {
counts->unused++;
} else {
if (info_cache.ProfileIsSupervisedAtIndex(i))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698