const int kMaximumReportedProfileCount = 5;
const int kMaximumDaysOfDisuse = 4 * 7; // Should be integral number of weeks.
-struct ProfileCounts {
- size_t total;
- size_t signedin;
- size_t supervised;
- size_t unused;
- size_t gaia_icon;
-
- ProfileCounts()
- : total(0), signedin(0), supervised(0), unused(0), gaia_icon(0) {}
-};
-
ProfileMetrics::ProfileType GetProfileType(
const base::FilePath& profile_path) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
#endif
}
-bool CountProfileInformation(ProfileManager* manager, ProfileCounts* counts) {
- const ProfileInfoCache& info_cache = manager->GetProfileInfoCache();
- size_t number_of_profiles = info_cache.GetNumberOfProfiles();
- counts->total = number_of_profiles;
-
- // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests.
- if (!number_of_profiles)
- return false;
-
- // Maximum age for "active" profile is 4 weeks.
- base::Time oldest = base::Time::Now() -
- base::TimeDelta::FromDays(kMaximumDaysOfDisuse);
-
- for (size_t i = 0; i < number_of_profiles; ++i) {
- if (info_cache.GetProfileActiveTimeAtIndex(i) < oldest) {
- counts->unused++;
- } else {
- if (info_cache.ProfileIsSupervisedAtIndex(i))
- counts->supervised++;
- if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) {
- counts->signedin++;
- if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i))
- counts->gaia_icon++;
- }
- }
- }
- return true;
-}
-
void LogLockedProfileInformation(ProfileManager* manager) {
const ProfileInfoCache& info_cache = manager->GetProfileInfoCache();
size_t number_of_profiles = info_cache.GetNumberOfProfiles();
}
}
+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 {
NUM_PROFILE_AVATAR_METRICS
};
+bool ProfileMetrics::CountProfileInformation(ProfileManager* manager,
+ ProfileCounts* counts) {
+ const ProfileInfoCache& info_cache = manager->GetProfileInfoCache();
+ size_t number_of_profiles = info_cache.GetNumberOfProfiles();
+ counts->total = number_of_profiles;
+
+ // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests.
+ if (!number_of_profiles)
+ return false;
+
+ // Maximum age for "active" profile is 4 weeks.
+ base::Time oldest = base::Time::Now() -
+ base::TimeDelta::FromDays(kMaximumDaysOfDisuse);
+
+ for (size_t i = 0; i < number_of_profiles; ++i) {
+ if (!HasProfileAtIndexBeenActiveSince(info_cache, i, oldest)) {
+ counts->unused++;
+ } else {
+ if (info_cache.ProfileIsSupervisedAtIndex(i))
+ counts->supervised++;
+ if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) {
+ counts->signedin++;
+ if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i))
+ counts->gaia_icon++;
+ }
+ }
+ }
+ return true;
+}
+
+
void ProfileMetrics::UpdateReportedProfilesStatistics(ProfileManager* manager) {
ProfileCounts counts;
if (CountProfileInformation(manager, &counts)) {
NUM_PROFILE_AVATAR_METRICS);
}
-void ProfileMetrics::LogProfileDeleteUser(ProfileNetUserCounts metric) {
- DCHECK(metric < NUM_PROFILE_NET_METRICS);
- UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", metric,
+void ProfileMetrics::LogProfileDeleteUser(ProfileDelete metric) {
+ DCHECK(metric < NUM_DELETE_PROFILE_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.DeleteProfileAction", metric,
+ NUM_DELETE_PROFILE_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", PROFILE_DELETED,
NUM_PROFILE_NET_METRICS);
}
NUM_PROFILE_AUTH_METRICS);
}
-void ProfileMetrics::LogProfileUpgradeEnrollment(
- ProfileUpgradeEnrollment metric) {
- UMA_HISTOGRAM_ENUMERATION("Profile.UpgradeEnrollment", metric,
- NUM_PROFILE_ENROLLMENT_METRICS);
-}
-
void ProfileMetrics::LogProfileDesktopMenu(
ProfileDesktopMenu metric,
signin::GAIAServiceType gaia_service) {
UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIAReAuth", metric,
NUM_PROFILE_DESKTOP_MENU_METRICS);
break;
+ case signin::GAIA_SERVICE_TYPE_SIGNUP:
+ UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIASignup", metric,
+ NUM_PROFILE_DESKTOP_MENU_METRICS);
+ break;
case signin::GAIA_SERVICE_TYPE_DEFAULT:
UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIADefault", metric,
NUM_PROFILE_DESKTOP_MENU_METRICS);
UMA_HISTOGRAM_BOOLEAN("Profile.Delete", profile_was_signed_in);
}
+void ProfileMetrics::LogProfileNewAvatarMenuNotYou(
+ ProfileNewAvatarMenuNotYou metric) {
+ DCHECK_LT(metric, NUM_PROFILE_AVATAR_MENU_NOT_YOU_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.NewAvatarMenu.NotYou", metric,
+ NUM_PROFILE_AVATAR_MENU_NOT_YOU_METRICS);
+}
+
+void ProfileMetrics::LogProfileNewAvatarMenuSignin(
+ ProfileNewAvatarMenuSignin metric) {
+ DCHECK_LT(metric, NUM_PROFILE_AVATAR_MENU_SIGNIN_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.NewAvatarMenu.Signin", metric,
+ NUM_PROFILE_AVATAR_MENU_SIGNIN_METRICS);
+}
+
+void ProfileMetrics::LogProfileNewAvatarMenuUpgrade(
+ ProfileNewAvatarMenuUpgrade metric) {
+ DCHECK_LT(metric, NUM_PROFILE_AVATAR_MENU_UPGRADE_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.NewAvatarMenu.Upgrade", metric,
+ NUM_PROFILE_AVATAR_MENU_UPGRADE_METRICS);
+}
+
#if defined(OS_ANDROID)
void ProfileMetrics::LogProfileAndroidAccountManagementMenu(
ProfileAndroidAccountManagementMenu metric,
metric,
NUM_PROFILE_ANDROID_ACCOUNT_MANAGEMENT_MENU_METRICS);
break;
+ case signin::GAIA_SERVICE_TYPE_SIGNUP:
+ UMA_HISTOGRAM_ENUMERATION(
+ "Profile.AndroidAccountManagementMenu.GAIASignup",
+ metric,
+ NUM_PROFILE_ANDROID_ACCOUNT_MANAGEMENT_MENU_METRICS);
+ break;
case signin::GAIA_SERVICE_TYPE_DEFAULT:
UMA_HISTOGRAM_ENUMERATION(
"Profile.AndroidAccountManagementMenu.GAIADefault",