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/file_path.h" | 7 #include "base/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 13 matching lines...) Expand all Loading... | |
24 user_data_dir = manager->user_data_dir(); | 24 user_data_dir = manager->user_data_dir(); |
25 } | 25 } |
26 if (profile_path == user_data_dir.AppendASCII(chrome::kInitialProfile)) { | 26 if (profile_path == user_data_dir.AppendASCII(chrome::kInitialProfile)) { |
27 metric = ProfileMetrics::ORIGINAL; | 27 metric = ProfileMetrics::ORIGINAL; |
28 } | 28 } |
29 return metric; | 29 return metric; |
30 } | 30 } |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 // Anything above 20 is lumped together as one metric. | |
35 const size_t kMaxNumberOfProfilesTracked = 21; | |
36 | |
34 enum ProfileAvatar { | 37 enum ProfileAvatar { |
35 AVATAR_GENERIC = 0, // The names for avatar icons | 38 AVATAR_GENERIC = 0, // The names for avatar icons |
36 AVATAR_GENERIC_AQUA, | 39 AVATAR_GENERIC_AQUA, |
37 AVATAR_GENERIC_BLUE, | 40 AVATAR_GENERIC_BLUE, |
38 AVATAR_GENERIC_GREEN, | 41 AVATAR_GENERIC_GREEN, |
39 AVATAR_GENERIC_ORANGE, | 42 AVATAR_GENERIC_ORANGE, |
40 AVATAR_GENERIC_PURPLE, | 43 AVATAR_GENERIC_PURPLE, |
41 AVATAR_GENERIC_RED, | 44 AVATAR_GENERIC_RED, |
42 AVATAR_GENERIC_YELLOW, | 45 AVATAR_GENERIC_YELLOW, |
43 AVATAR_SECRET_AGENT, | 46 AVATAR_SECRET_AGENT, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 NUM_PROFILE_TYPE_METRICS); | 203 NUM_PROFILE_TYPE_METRICS); |
201 } | 204 } |
202 | 205 |
203 void ProfileMetrics::LogProfileSwitchGaia(ProfileGaia metric) { | 206 void ProfileMetrics::LogProfileSwitchGaia(ProfileGaia metric) { |
204 if (metric == GAIA_OPT_IN) | 207 if (metric == GAIA_OPT_IN) |
205 LogProfileAvatarSelection(AVATAR_GAIA); | 208 LogProfileAvatarSelection(AVATAR_GAIA); |
206 UMA_HISTOGRAM_ENUMERATION("Profile.SwitchGaiaPhotoSettings", | 209 UMA_HISTOGRAM_ENUMERATION("Profile.SwitchGaiaPhotoSettings", |
207 metric, | 210 metric, |
208 NUM_PROFILE_GAIA_METRICS); | 211 NUM_PROFILE_GAIA_METRICS); |
209 } | 212 } |
213 | |
214 void ProfileMetrics::LogProfileLaunch(FilePath& profile_path) { | |
215 UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser", | |
216 GetProfileType(profile_path), | |
217 NUM_PROFILE_TYPE_METRICS); | |
218 } | |
219 | |
220 void ProfileMetrics::LogNumberOfProfiles(bool startup) { | |
221 ProfileManager* manager = g_browser_process->profile_manager(); | |
222 size_t number_of_profiles = | |
223 manager->GetProfileInfoCache().GetNumberOfProfiles(); | |
224 if (number_of_profiles > kMaxNumberOfProfilesTracked) | |
225 number_of_profiles = kMaxNumberOfProfilesTracked; | |
Ilya Sherman
2011/12/09 00:53:41
There shouldn't be any need to do this -- the last
rpetterson
2011/12/09 01:44:35
Cool. Done.
| |
226 if (startup) { | |
227 UMA_HISTOGRAM_ENUMERATION("Profile.NumberOfProfilesOnStartup", | |
228 number_of_profiles, | |
229 NUM_PROFILE_TYPE_METRICS); | |
Ilya Sherman
2011/12/09 00:53:41
I think you want UMA_HISTOGRAM_COUNTS_100 (or some
rpetterson
2011/12/09 01:44:35
Done.
| |
230 } else { | |
231 UMA_HISTOGRAM_ENUMERATION("Profile.NumberOfProfilesOnAddDelete", | |
Ilya Sherman
2011/12/09 00:53:41
ditto
rpetterson
2011/12/09 01:44:35
Done.
| |
232 number_of_profiles, | |
233 NUM_PROFILE_TYPE_METRICS); | |
234 } | |
235 } | |
OLD | NEW |