| 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" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/profiles/profile_info_cache.h" | 12 #include "chrome/browser/profiles/profile_info_cache.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/browser/signin/signin_header_helper.h" |
| 14 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/installer/util/google_update_settings.h" | 16 #include "chrome/installer/util/google_update_settings.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/user_metrics.h" | 18 #include "content/public/browser/user_metrics.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 const int kMaximumReportedProfileCount = 5; | 22 const int kMaximumReportedProfileCount = 5; |
| 22 const int kMaximumDaysOfDisuse = 4 * 7; // Should be integral number of weeks. | 23 const int kMaximumDaysOfDisuse = 4 * 7; // Should be integral number of weeks. |
| 23 | 24 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 UMA_HISTOGRAM_ENUMERATION("Profile.AuthResult", metric, | 289 UMA_HISTOGRAM_ENUMERATION("Profile.AuthResult", metric, |
| 289 NUM_PROFILE_AUTH_METRICS); | 290 NUM_PROFILE_AUTH_METRICS); |
| 290 } | 291 } |
| 291 | 292 |
| 292 void ProfileMetrics::LogProfileUpgradeEnrollment( | 293 void ProfileMetrics::LogProfileUpgradeEnrollment( |
| 293 ProfileUpgradeEnrollment metric) { | 294 ProfileUpgradeEnrollment metric) { |
| 294 UMA_HISTOGRAM_ENUMERATION("Profile.UpgradeEnrollment", metric, | 295 UMA_HISTOGRAM_ENUMERATION("Profile.UpgradeEnrollment", metric, |
| 295 NUM_PROFILE_ENROLLMENT_METRICS); | 296 NUM_PROFILE_ENROLLMENT_METRICS); |
| 296 } | 297 } |
| 297 | 298 |
| 299 void ProfileMetrics::LogProfileDesktopMenu(ProfileDesktopMenu metric, |
| 300 signin::GAIA_SERVICE_TYPE gaia_service) { |
| 301 switch (gaia_service) { |
| 302 case signin::GAIA_SERVICE_TYPE_NONE: |
| 303 UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.NonGAIA", metric, |
| 304 NUM_PROFILE_DESKTOP_MENU_METRICS); |
| 305 break; |
| 306 case signin::GAIA_SERVICE_TYPE_SIGNOUT: |
| 307 UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIASignout", metric, |
| 308 NUM_PROFILE_DESKTOP_MENU_METRICS); |
| 309 break; |
| 310 case signin::GAIA_SERVICE_TYPE_SIGNOUTOPTIONS_INCOGNITO: |
| 311 UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIASignoutIncognito", |
| 312 metric, NUM_PROFILE_DESKTOP_MENU_METRICS); |
| 313 break; |
| 314 case signin::GAIA_SERVICE_TYPE_ADDSESSION: |
| 315 UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIAAddSession", metric, |
| 316 NUM_PROFILE_DESKTOP_MENU_METRICS); |
| 317 break; |
| 318 case signin::GAIA_SERVICE_TYPE_REAUTH: |
| 319 UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIAReAuth", metric, |
| 320 NUM_PROFILE_DESKTOP_MENU_METRICS); |
| 321 break; |
| 322 case signin::GAIA_SERVICE_TYPE_DEFAULT: |
| 323 UMA_HISTOGRAM_ENUMERATION("Profile.DesktopMenu.GAIADefault", metric, |
| 324 NUM_PROFILE_DESKTOP_MENU_METRICS); |
| 325 break; |
| 326 } |
| 327 } |
| 328 |
| 298 void ProfileMetrics::LogProfileLaunch(Profile* profile) { | 329 void ProfileMetrics::LogProfileLaunch(Profile* profile) { |
| 299 base::FilePath profile_path = profile->GetPath(); | 330 base::FilePath profile_path = profile->GetPath(); |
| 300 UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser", | 331 UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser", |
| 301 GetProfileType(profile_path), | 332 GetProfileType(profile_path), |
| 302 NUM_PROFILE_TYPE_METRICS); | 333 NUM_PROFILE_TYPE_METRICS); |
| 303 | 334 |
| 304 if (profile->IsManaged()) { | 335 if (profile->IsManaged()) { |
| 305 content::RecordAction( | 336 content::RecordAction( |
| 306 base::UserMetricsAction("ManagedMode_NewManagedUserWindow")); | 337 base::UserMetricsAction("ManagedMode_NewManagedUserWindow")); |
| 307 } | 338 } |
| 308 } | 339 } |
| 309 | 340 |
| 310 void ProfileMetrics::LogProfileSyncSignIn(const base::FilePath& profile_path) { | 341 void ProfileMetrics::LogProfileSyncSignIn(const base::FilePath& profile_path) { |
| 311 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", | 342 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", |
| 312 GetProfileType(profile_path), | 343 GetProfileType(profile_path), |
| 313 NUM_PROFILE_TYPE_METRICS); | 344 NUM_PROFILE_TYPE_METRICS); |
| 314 } | 345 } |
| 315 | 346 |
| 316 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { | 347 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { |
| 317 UMA_HISTOGRAM_ENUMERATION("Profile.Update", | 348 UMA_HISTOGRAM_ENUMERATION("Profile.Update", |
| 318 GetProfileType(profile_path), | 349 GetProfileType(profile_path), |
| 319 NUM_PROFILE_TYPE_METRICS); | 350 NUM_PROFILE_TYPE_METRICS); |
| 320 } | 351 } |
| OLD | NEW |