Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: chrome/browser/profiles/profile_metrics.cc

Issue 316863002: Rename "managed (mode|user)" to "supervised user" (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/signin/signin_header_helper.h"
15 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
16 #include "chrome/installer/util/google_update_settings.h" 16 #include "chrome/installer/util/google_update_settings.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/user_metrics.h" 18 #include "content/public/browser/user_metrics.h"
19 19
20 namespace { 20 namespace {
21 21
22 const int kMaximumReportedProfileCount = 5; 22 const int kMaximumReportedProfileCount = 5;
23 const int kMaximumDaysOfDisuse = 4 * 7; // Should be integral number of weeks. 23 const int kMaximumDaysOfDisuse = 4 * 7; // Should be integral number of weeks.
24 24
25 struct ProfileCounts { 25 struct ProfileCounts {
26 size_t total; 26 size_t total;
27 size_t signedin; 27 size_t signedin;
28 size_t managed; 28 size_t supervised;
29 size_t unused; 29 size_t unused;
30 size_t gaia_icon; 30 size_t gaia_icon;
31 31
32 ProfileCounts() 32 ProfileCounts()
33 : total(0), signedin(0), managed(0), unused(0), gaia_icon(0) {} 33 : total(0), signedin(0), supervised(0), unused(0), gaia_icon(0) {}
34 }; 34 };
35 35
36 ProfileMetrics::ProfileType GetProfileType( 36 ProfileMetrics::ProfileType GetProfileType(
37 const base::FilePath& profile_path) { 37 const base::FilePath& profile_path) {
38 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 38 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
39 ProfileMetrics::ProfileType metric = ProfileMetrics::SECONDARY; 39 ProfileMetrics::ProfileType metric = ProfileMetrics::SECONDARY;
40 ProfileManager* manager = g_browser_process->profile_manager(); 40 ProfileManager* manager = g_browser_process->profile_manager();
41 base::FilePath user_data_dir; 41 base::FilePath user_data_dir;
42 // In unittests, we do not always have a profile_manager so check. 42 // In unittests, we do not always have a profile_manager so check.
43 if (manager) { 43 if (manager) {
(...skipping 21 matching lines...) Expand all
65 return false; 65 return false;
66 66
67 // Maximum age for "active" profile is 4 weeks. 67 // Maximum age for "active" profile is 4 weeks.
68 base::Time oldest = base::Time::Now() - 68 base::Time oldest = base::Time::Now() -
69 base::TimeDelta::FromDays(kMaximumDaysOfDisuse); 69 base::TimeDelta::FromDays(kMaximumDaysOfDisuse);
70 70
71 for (size_t i = 0; i < number_of_profiles; ++i) { 71 for (size_t i = 0; i < number_of_profiles; ++i) {
72 if (info_cache.GetProfileActiveTimeAtIndex(i) < oldest) { 72 if (info_cache.GetProfileActiveTimeAtIndex(i) < oldest) {
73 counts->unused++; 73 counts->unused++;
74 } else { 74 } else {
75 if (info_cache.ProfileIsManagedAtIndex(i)) 75 if (info_cache.ProfileIsSupervisedAtIndex(i))
76 counts->managed++; 76 counts->supervised++;
77 if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) { 77 if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) {
78 counts->signedin++; 78 counts->signedin++;
79 if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i)) 79 if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i))
80 counts->gaia_icon++; 80 counts->gaia_icon++;
81 } 81 }
82 } 82 }
83 } 83 }
84 return true; 84 return true;
85 } 85 }
86 86
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 void ProfileMetrics::LogNumberOfProfiles(ProfileManager* manager) { 137 void ProfileMetrics::LogNumberOfProfiles(ProfileManager* manager) {
138 ProfileCounts counts; 138 ProfileCounts counts;
139 bool success = CountProfileInformation(manager, &counts); 139 bool success = CountProfileInformation(manager, &counts);
140 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfiles", counts.total); 140 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfiles", counts.total);
141 141
142 // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests. 142 // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests.
143 if (success) { 143 if (success) {
144 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles", 144 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles",
145 counts.managed); 145 counts.supervised);
146 UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles", 146 UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles",
147 100 * counts.managed / counts.total); 147 100 * counts.supervised / counts.total);
148 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles", 148 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles",
149 counts.signedin); 149 counts.signedin);
150 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfUnusedProfiles", 150 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfUnusedProfiles",
151 counts.unused); 151 counts.unused);
152 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfilesWithGAIAIcons", 152 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfilesWithGAIAIcons",
153 counts.gaia_icon); 153 counts.gaia_icon);
154 154
155 UpdateReportedOSProfileStatistics(counts.total, counts.signedin); 155 UpdateReportedOSProfileStatistics(counts.total, counts.signedin);
156 } 156 }
157 } 157 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 } 385 }
386 #endif // defined(OS_ANDROID) 386 #endif // defined(OS_ANDROID)
387 387
388 void ProfileMetrics::LogProfileLaunch(Profile* profile) { 388 void ProfileMetrics::LogProfileLaunch(Profile* profile) {
389 base::FilePath profile_path = profile->GetPath(); 389 base::FilePath profile_path = profile->GetPath();
390 UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser", 390 UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser",
391 GetProfileType(profile_path), 391 GetProfileType(profile_path),
392 NUM_PROFILE_TYPE_METRICS); 392 NUM_PROFILE_TYPE_METRICS);
393 393
394 if (profile->IsManaged()) { 394 if (profile->IsSupervised()) {
395 content::RecordAction( 395 content::RecordAction(
396 base::UserMetricsAction("ManagedMode_NewManagedUserWindow")); 396 base::UserMetricsAction("ManagedMode_NewManagedUserWindow"));
397 } 397 }
398 } 398 }
399 399
400 void ProfileMetrics::LogProfileSyncSignIn(const base::FilePath& profile_path) { 400 void ProfileMetrics::LogProfileSyncSignIn(const base::FilePath& profile_path) {
401 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", 401 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn",
402 GetProfileType(profile_path), 402 GetProfileType(profile_path),
403 NUM_PROFILE_TYPE_METRICS); 403 NUM_PROFILE_TYPE_METRICS);
404 } 404 }
405 405
406 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { 406 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) {
407 UMA_HISTOGRAM_ENUMERATION("Profile.Update", 407 UMA_HISTOGRAM_ENUMERATION("Profile.Update",
408 GetProfileType(profile_path), 408 GetProfileType(profile_path),
409 NUM_PROFILE_TYPE_METRICS); 409 NUM_PROFILE_TYPE_METRICS);
410 } 410 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/browser/signin/chrome_signin_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698