| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/metrics/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // receives pointers to fully constructed objects. | 139 // receives pointers to fully constructed objects. |
| 140 scoped_ptr<ChromeMetricsServiceClient> client( | 140 scoped_ptr<ChromeMetricsServiceClient> client( |
| 141 new ChromeMetricsServiceClient(state_manager)); | 141 new ChromeMetricsServiceClient(state_manager)); |
| 142 client->Initialize(); | 142 client->Initialize(); |
| 143 | 143 |
| 144 return client.Pass(); | 144 return client.Pass(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // static | 147 // static |
| 148 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { | 148 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { |
| 149 registry->RegisterInt64Pref(prefs::kInstallDate, 0); | |
| 150 registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0); | 149 registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0); |
| 151 registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0); | 150 registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0); |
| 152 | 151 |
| 153 MetricsService::RegisterPrefs(registry); | 152 MetricsService::RegisterPrefs(registry); |
| 154 ChromeStabilityMetricsProvider::RegisterPrefs(registry); | 153 ChromeStabilityMetricsProvider::RegisterPrefs(registry); |
| 155 | 154 |
| 156 #if defined(OS_ANDROID) | 155 #if defined(OS_ANDROID) |
| 157 AndroidMetricsProvider::RegisterPrefs(registry); | 156 AndroidMetricsProvider::RegisterPrefs(registry); |
| 158 #endif // defined(OS_ANDROID) | 157 #endif // defined(OS_ANDROID) |
| 159 | 158 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 190 |
| 192 std::string version = version_info.Version(); | 191 std::string version = version_info.Version(); |
| 193 #if defined(ARCH_CPU_64_BITS) | 192 #if defined(ARCH_CPU_64_BITS) |
| 194 version += "-64"; | 193 version += "-64"; |
| 195 #endif // defined(ARCH_CPU_64_BITS) | 194 #endif // defined(ARCH_CPU_64_BITS) |
| 196 if (!version_info.IsOfficialBuild()) | 195 if (!version_info.IsOfficialBuild()) |
| 197 version.append("-devel"); | 196 version.append("-devel"); |
| 198 return version; | 197 return version; |
| 199 } | 198 } |
| 200 | 199 |
| 201 int64 ChromeMetricsServiceClient::GetInstallDate() { | |
| 202 return g_browser_process->local_state()->GetInt64(prefs::kInstallDate); | |
| 203 } | |
| 204 | |
| 205 void ChromeMetricsServiceClient::OnLogUploadComplete() { | 200 void ChromeMetricsServiceClient::OnLogUploadComplete() { |
| 206 // Collect network stats after each UMA upload. | 201 // Collect network stats after each UMA upload. |
| 207 network_stats_uploader_.CollectAndReportNetworkStats(); | 202 network_stats_uploader_.CollectAndReportNetworkStats(); |
| 208 } | 203 } |
| 209 | 204 |
| 210 void ChromeMetricsServiceClient::StartGatheringMetrics( | 205 void ChromeMetricsServiceClient::StartGatheringMetrics( |
| 211 const base::Closure& done_callback) { | 206 const base::Closure& done_callback) { |
| 212 finished_gathering_initial_metrics_callback_ = done_callback; | 207 finished_gathering_initial_metrics_callback_ = done_callback; |
| 213 base::Closure got_hardware_class_callback = | 208 base::Closure got_hardware_class_callback = |
| 214 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotHardwareClass, | 209 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotHardwareClass, |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // Capture the histogram samples. | 522 // Capture the histogram samples. |
| 528 if (dumps_with_crash != 0) | 523 if (dumps_with_crash != 0) |
| 529 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); | 524 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); |
| 530 if (dumps_with_no_crash != 0) | 525 if (dumps_with_no_crash != 0) |
| 531 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); | 526 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); |
| 532 int total_dumps = dumps_with_crash + dumps_with_no_crash; | 527 int total_dumps = dumps_with_crash + dumps_with_no_crash; |
| 533 if (total_dumps != 0) | 528 if (total_dumps != 0) |
| 534 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); | 529 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); |
| 535 } | 530 } |
| 536 #endif // defined(OS_WIN) | 531 #endif // defined(OS_WIN) |
| OLD | NEW |