| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile_metrics.h" | 5 #include "chrome/browser/profiles/profile_metrics.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 for (size_t i = 0; i < number_of_profiles; ++i) { | 132 for (size_t i = 0; i < number_of_profiles; ++i) { |
| 133 if (!HasProfileAtIndexBeenActiveSince(info_cache, i, oldest)) { | 133 if (!HasProfileAtIndexBeenActiveSince(info_cache, i, oldest)) { |
| 134 counts->unused++; | 134 counts->unused++; |
| 135 } else { | 135 } else { |
| 136 if (info_cache.ProfileIsSupervisedAtIndex(i)) | 136 if (info_cache.ProfileIsSupervisedAtIndex(i)) |
| 137 counts->supervised++; | 137 counts->supervised++; |
| 138 if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) { | 138 if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) { |
| 139 counts->signedin++; | 139 counts->signedin++; |
| 140 if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i)) | 140 if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i)) |
| 141 counts->gaia_icon++; | 141 counts->gaia_icon++; |
| 142 counts->auth_errors[info_cache.ProfileAuthErrorAtIndex(i)]++; |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 } | 145 } |
| 145 return true; | 146 return true; |
| 146 } | 147 } |
| 147 | 148 |
| 148 | 149 |
| 149 void ProfileMetrics::UpdateReportedProfilesStatistics(ProfileManager* manager) { | 150 void ProfileMetrics::UpdateReportedProfilesStatistics(ProfileManager* manager) { |
| 150 ProfileCounts counts; | 151 ProfileCounts counts; |
| 151 if (CountProfileInformation(manager, &counts)) { | 152 if (CountProfileInformation(manager, &counts)) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 172 counts.supervised); | 173 counts.supervised); |
| 173 UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles", | 174 UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles", |
| 174 100 * counts.supervised / counts.total); | 175 100 * counts.supervised / counts.total); |
| 175 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles", | 176 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles", |
| 176 counts.signedin); | 177 counts.signedin); |
| 177 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfUnusedProfiles", | 178 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfUnusedProfiles", |
| 178 counts.unused); | 179 counts.unused); |
| 179 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfilesWithGAIAIcons", | 180 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfilesWithGAIAIcons", |
| 180 counts.gaia_icon); | 181 counts.gaia_icon); |
| 181 | 182 |
| 183 for (size_t auth_error = 0; |
| 184 auth_error < GoogleServiceAuthError::State::NUM_STATES; |
| 185 auth_error++) { |
| 186 for (size_t i = 0; i < counts.auth_errors[auth_error]; i++) { |
| 187 UMA_HISTOGRAM_ENUMERATION("Profile.NumberOfProfileAuthErrors", |
| 188 auth_error, |
| 189 GoogleServiceAuthError::State::NUM_STATES); |
| 190 } |
| 191 } |
| 192 |
| 182 LogLockedProfileInformation(manager); | 193 LogLockedProfileInformation(manager); |
| 183 UpdateReportedOSProfileStatistics(counts.total, counts.signedin); | 194 UpdateReportedOSProfileStatistics(counts.total, counts.signedin); |
| 184 } | 195 } |
| 185 } | 196 } |
| 186 | 197 |
| 187 void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) { | 198 void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) { |
| 188 DCHECK(metric < NUM_PROFILE_ADD_METRICS); | 199 DCHECK(metric < NUM_PROFILE_ADD_METRICS); |
| 189 UMA_HISTOGRAM_ENUMERATION("Profile.AddNewUser", metric, | 200 UMA_HISTOGRAM_ENUMERATION("Profile.AddNewUser", metric, |
| 190 NUM_PROFILE_ADD_METRICS); | 201 NUM_PROFILE_ADD_METRICS); |
| 191 UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", ADD_NEW_USER, | 202 UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", ADD_NEW_USER, |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", | 471 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", |
| 461 GetProfileType(profile_path), | 472 GetProfileType(profile_path), |
| 462 NUM_PROFILE_TYPE_METRICS); | 473 NUM_PROFILE_TYPE_METRICS); |
| 463 } | 474 } |
| 464 | 475 |
| 465 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { | 476 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { |
| 466 UMA_HISTOGRAM_ENUMERATION("Profile.Update", | 477 UMA_HISTOGRAM_ENUMERATION("Profile.Update", |
| 467 GetProfileType(profile_path), | 478 GetProfileType(profile_path), |
| 468 NUM_PROFILE_TYPE_METRICS); | 479 NUM_PROFILE_TYPE_METRICS); |
| 469 } | 480 } |
| OLD | NEW |