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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 if (chrome::GetTotalBrowserCountForProfile(profile_switched_to) > 0) { | 50 if (chrome::GetTotalBrowserCountForProfile(profile_switched_to) > 0) { |
51 return PROFILE_OPENED; | 51 return PROFILE_OPENED; |
52 } | 52 } |
53 | 53 |
54 return PROFILE_OPENED_NO_BROWSER; | 54 return PROFILE_OPENED_NO_BROWSER; |
55 } | 55 } |
56 | 56 |
57 ProfileMetrics::ProfileType GetProfileType( | 57 ProfileMetrics::ProfileType GetProfileType( |
58 const base::FilePath& profile_path) { | 58 const base::FilePath& profile_path) { |
59 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 59 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
60 ProfileMetrics::ProfileType metric = ProfileMetrics::SECONDARY; | 60 ProfileMetrics::ProfileType metric = ProfileMetrics::SECONDARY; |
61 ProfileManager* manager = g_browser_process->profile_manager(); | 61 ProfileManager* manager = g_browser_process->profile_manager(); |
62 base::FilePath user_data_dir; | 62 base::FilePath user_data_dir; |
63 // In unittests, we do not always have a profile_manager so check. | 63 // In unittests, we do not always have a profile_manager so check. |
64 if (manager) { | 64 if (manager) { |
65 user_data_dir = manager->user_data_dir(); | 65 user_data_dir = manager->user_data_dir(); |
66 } | 66 } |
67 if (profile_path == user_data_dir.AppendASCII(chrome::kInitialProfile)) { | 67 if (profile_path == user_data_dir.AppendASCII(chrome::kInitialProfile)) { |
68 metric = ProfileMetrics::ORIGINAL; | 68 metric = ProfileMetrics::ORIGINAL; |
69 } | 69 } |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", | 547 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", |
548 GetProfileType(profile_path), | 548 GetProfileType(profile_path), |
549 NUM_PROFILE_TYPE_METRICS); | 549 NUM_PROFILE_TYPE_METRICS); |
550 } | 550 } |
551 | 551 |
552 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { | 552 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { |
553 UMA_HISTOGRAM_ENUMERATION("Profile.Update", | 553 UMA_HISTOGRAM_ENUMERATION("Profile.Update", |
554 GetProfileType(profile_path), | 554 GetProfileType(profile_path), |
555 NUM_PROFILE_TYPE_METRICS); | 555 NUM_PROFILE_TYPE_METRICS); |
556 } | 556 } |
OLD | NEW |