OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "components/signin/core/browser/signin_header_helper.h" | 13 #include "components/signin/core/browser/signin_header_helper.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 class ProfileManager; | 16 class ProfileManager; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class FilePath; | 19 class FilePath; |
20 } | 20 } |
21 | 21 |
| 22 namespace profile_metrics { |
| 23 struct Counts; |
| 24 } |
| 25 |
22 class ProfileMetrics { | 26 class ProfileMetrics { |
23 public: | 27 public: |
24 struct ProfileCounts { | |
25 size_t total; | |
26 size_t signedin; | |
27 size_t supervised; | |
28 size_t unused; | |
29 size_t gaia_icon; | |
30 size_t auth_errors; | |
31 | |
32 ProfileCounts() | |
33 : total(0), | |
34 signedin(0), | |
35 supervised(0), | |
36 unused(0), | |
37 gaia_icon(0), | |
38 auth_errors(0) {} | |
39 }; | |
40 | 28 |
41 // Enum for counting the ways users were added. | 29 // Enum for counting the ways users were added. |
42 enum ProfileAdd { | 30 enum ProfileAdd { |
43 ADD_NEW_USER_ICON = 0, // User adds new user from icon menu | 31 ADD_NEW_USER_ICON = 0, // User adds new user from icon menu |
44 ADD_NEW_USER_MENU, // User adds new user from menu bar | 32 ADD_NEW_USER_MENU, // User adds new user from menu bar |
45 ADD_NEW_USER_DIALOG, // User adds new user from create-profile dialog | 33 ADD_NEW_USER_DIALOG, // User adds new user from create-profile dialog |
46 ADD_NEW_USER_MANAGER, // User adds new user from User Manager | 34 ADD_NEW_USER_MANAGER, // User adds new user from User Manager |
47 ADD_NEW_USER_LAST_DELETED, // Auto-created after deleting last user | 35 ADD_NEW_USER_LAST_DELETED, // Auto-created after deleting last user |
48 NUM_PROFILE_ADD_METRICS | 36 NUM_PROFILE_ADD_METRICS |
49 }; | 37 }; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 PROFILE_AVATAR_MENU_UPGRADE_WHATS_NEW, | 194 PROFILE_AVATAR_MENU_UPGRADE_WHATS_NEW, |
207 // User selects 'Not You?' in the upgrade bubble. | 195 // User selects 'Not You?' in the upgrade bubble. |
208 PROFILE_AVATAR_MENU_UPGRADE_NOT_YOU, | 196 PROFILE_AVATAR_MENU_UPGRADE_NOT_YOU, |
209 NUM_PROFILE_AVATAR_MENU_UPGRADE_METRICS, | 197 NUM_PROFILE_AVATAR_MENU_UPGRADE_METRICS, |
210 }; | 198 }; |
211 | 199 |
212 static void UpdateReportedProfilesStatistics(ProfileManager* manager); | 200 static void UpdateReportedProfilesStatistics(ProfileManager* manager); |
213 // Count and return summary information about the profiles currently in the | 201 // Count and return summary information about the profiles currently in the |
214 // |manager|. This information is returned in the output variable |counts|. | 202 // |manager|. This information is returned in the output variable |counts|. |
215 static bool CountProfileInformation(ProfileManager* manager, | 203 static bool CountProfileInformation(ProfileManager* manager, |
216 ProfileCounts* counts); | 204 profile_metrics::Counts* counts); |
217 | 205 |
218 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 206 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
219 static void LogNumberOfProfileSwitches(); | 207 static void LogNumberOfProfileSwitches(); |
220 #endif | 208 #endif |
221 | 209 |
222 #if defined(OS_WIN) || defined(OS_MACOSX) | 210 #if defined(OS_WIN) || defined(OS_MACOSX) |
223 // Update OS level tracking of profile counts. | 211 // Update OS level tracking of profile counts. |
224 static void UpdateReportedOSProfileStatistics(size_t active, size_t signedin); | 212 static void UpdateReportedOSProfileStatistics(size_t active, size_t signedin); |
225 #endif | 213 #endif |
226 | 214 |
(...skipping 27 matching lines...) Expand all Loading... |
254 | 242 |
255 // These functions should only be called on the UI thread because they hook | 243 // These functions should only be called on the UI thread because they hook |
256 // into g_browser_process through a helper function. | 244 // into g_browser_process through a helper function. |
257 static void LogProfileLaunch(Profile* profile); | 245 static void LogProfileLaunch(Profile* profile); |
258 static void LogProfileSyncSignIn(const base::FilePath& profile_path); | 246 static void LogProfileSyncSignIn(const base::FilePath& profile_path); |
259 static void LogProfileUpdate(const base::FilePath& profile_path); | 247 static void LogProfileUpdate(const base::FilePath& profile_path); |
260 }; | 248 }; |
261 | 249 |
262 | 250 |
263 #endif // CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_ | 251 #endif // CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_ |
OLD | NEW |