Chromium Code Reviews| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 bool ProfileMetrics::CountProfileInformation(ProfileManager* manager, | 106 bool ProfileMetrics::CountProfileInformation(ProfileManager* manager, |
| 107 ProfileCounts* counts) { | 107 ProfileCounts* counts) { |
| 108 const ProfileInfoCache& info_cache = manager->GetProfileInfoCache(); | 108 const ProfileInfoCache& info_cache = manager->GetProfileInfoCache(); |
| 109 size_t number_of_profiles = info_cache.GetNumberOfProfiles(); | 109 size_t number_of_profiles = info_cache.GetNumberOfProfiles(); |
| 110 counts->total = number_of_profiles; | 110 counts->total = number_of_profiles; |
| 111 | 111 |
| 112 // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests. | 112 // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests. |
| 113 if (!number_of_profiles) | 113 if (!number_of_profiles) |
| 114 return false; | 114 return false; |
| 115 | 115 |
| 116 // Maximum age for "active" profile is 4 weeks. | 116 |
| 117 base::Time oldest = base::Time::Now() - | |
| 118 base::TimeDelta::FromDays(kMaximumDaysOfDisuse); | |
| 119 | 117 |
| 120 for (size_t i = 0; i < number_of_profiles; ++i) { | 118 for (size_t i = 0; i < number_of_profiles; ++i) { |
| 119 // IOS and ANDROID never set an ActiveTime in the ProfileManager. | |
| 120 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 121 // Maximum age for "active" profile is 4 weeks. | |
| 122 base::Time oldest = base::Time::Now() - | |
|
bcwhite
2014/07/18 01:13:59
This is now calculating this value for every profi
| |
| 123 base::TimeDelta::FromDays(kMaximumDaysOfDisuse); | |
| 124 | |
| 121 if (info_cache.GetProfileActiveTimeAtIndex(i) < oldest) { | 125 if (info_cache.GetProfileActiveTimeAtIndex(i) < oldest) { |
|
bcwhite
2014/07/18 01:13:59
I think the better choice would be to set the acti
| |
| 122 counts->unused++; | 126 counts->unused++; |
| 123 } else { | 127 } else { |
| 128 #else | |
| 129 { | |
|
bcwhite
2014/07/18 01:13:59
This duplicate open brace will break editors' auto
| |
| 130 #endif | |
| 124 if (info_cache.ProfileIsSupervisedAtIndex(i)) | 131 if (info_cache.ProfileIsSupervisedAtIndex(i)) |
| 125 counts->supervised++; | 132 counts->supervised++; |
| 126 if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) { | 133 if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) { |
| 127 counts->signedin++; | 134 counts->signedin++; |
| 128 if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i)) | 135 if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i)) |
| 129 counts->gaia_icon++; | 136 counts->gaia_icon++; |
| 130 } | 137 } |
| 131 } | 138 } |
| 132 } | 139 } |
| 133 return true; | 140 return true; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", | 428 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", |
| 422 GetProfileType(profile_path), | 429 GetProfileType(profile_path), |
| 423 NUM_PROFILE_TYPE_METRICS); | 430 NUM_PROFILE_TYPE_METRICS); |
| 424 } | 431 } |
| 425 | 432 |
| 426 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { | 433 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { |
| 427 UMA_HISTOGRAM_ENUMERATION("Profile.Update", | 434 UMA_HISTOGRAM_ENUMERATION("Profile.Update", |
| 428 GetProfileType(profile_path), | 435 GetProfileType(profile_path), |
| 429 NUM_PROFILE_TYPE_METRICS); | 436 NUM_PROFILE_TYPE_METRICS); |
| 430 } | 437 } |
| OLD | NEW |