Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 #endif | 98 #endif |
| 99 | 99 |
| 100 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
| 101 #include <windows.h> | 101 #include <windows.h> |
| 102 | 102 |
| 103 #include "chrome/browser/metrics/antivirus_metrics_provider_win.h" | 103 #include "chrome/browser/metrics/antivirus_metrics_provider_win.h" |
| 104 #include "chrome/browser/metrics/google_update_metrics_provider_win.h" | 104 #include "chrome/browser/metrics/google_update_metrics_provider_win.h" |
| 105 #include "chrome/common/metrics_constants_util_win.h" | 105 #include "chrome/common/metrics_constants_util_win.h" |
| 106 #include "chrome/install_static/install_util.h" | 106 #include "chrome/install_static/install_util.h" |
| 107 #include "chrome/installer/util/browser_distribution.h" | 107 #include "chrome/installer/util/browser_distribution.h" |
| 108 #include "components/browser_watcher/stability_debugging_win.h" | |
| 108 #include "components/browser_watcher/watcher_metrics_provider_win.h" | 109 #include "components/browser_watcher/watcher_metrics_provider_win.h" |
| 109 #endif | 110 #endif |
| 110 | 111 |
| 111 #if defined(OS_WIN) || defined(OS_MACOSX) | 112 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 112 #include "third_party/crashpad/crashpad/client/crashpad_info.h" | 113 #include "third_party/crashpad/crashpad/client/crashpad_info.h" |
| 113 #endif | 114 #endif |
| 114 | 115 |
| 115 #if !defined(OS_CHROMEOS) | 116 #if !defined(OS_CHROMEOS) |
| 116 #include "chrome/browser/signin/chrome_signin_status_metrics_provider_delegate.h " | 117 #include "chrome/browser/signin/chrome_signin_status_metrics_provider_delegate.h " |
| 117 #include "components/signin/core/browser/signin_status_metrics_provider.h" | 118 #include "components/signin/core/browser/signin_status_metrics_provider.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 DCHECK_NE(nullptr, channel_name); | 251 DCHECK_NE(nullptr, channel_name); |
| 251 | 252 |
| 252 wchar_t exe_file[MAX_PATH] = {}; | 253 wchar_t exe_file[MAX_PATH] = {}; |
| 253 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); | 254 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); |
| 254 | 255 |
| 255 base::string16 unused_special_build; | 256 base::string16 unused_special_build; |
| 256 install_static::GetExecutableVersionDetails( | 257 install_static::GetExecutableVersionDetails( |
| 257 exe_file, product_name, version_number, &unused_special_build, | 258 exe_file, product_name, version_number, &unused_special_build, |
| 258 channel_name); | 259 channel_name); |
| 259 } | 260 } |
| 261 | |
|
Alexei Svitkine (slow)
2016/11/22 22:22:19
Nit: Remove from the diff
manzagop (departed)
2016/11/23 16:35:49
Done.
| |
| 260 #endif // OS_WIN | 262 #endif // OS_WIN |
| 261 | 263 |
| 262 } // namespace | 264 } // namespace |
| 263 | 265 |
| 264 const char ChromeMetricsServiceClient::kBrowserMetricsName[] = "BrowserMetrics"; | 266 const char ChromeMetricsServiceClient::kBrowserMetricsName[] = "BrowserMetrics"; |
| 265 | 267 |
| 266 ChromeMetricsServiceClient::ChromeMetricsServiceClient( | 268 ChromeMetricsServiceClient::ChromeMetricsServiceClient( |
| 267 metrics::MetricsStateManager* state_manager) | 269 metrics::MetricsStateManager* state_manager) |
| 268 : metrics_state_manager_(state_manager), | 270 : metrics_state_manager_(state_manager), |
| 269 #if defined(OS_CHROMEOS) | 271 #if defined(OS_CHROMEOS) |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 #endif // OS_WIN || OS_MACOSX | 389 #endif // OS_WIN || OS_MACOSX |
| 388 } | 390 } |
| 389 | 391 |
| 390 void ChromeMetricsServiceClient::OnLogUploadComplete() { | 392 void ChromeMetricsServiceClient::OnLogUploadComplete() { |
| 391 // Collect time ticks stats after each UMA upload. | 393 // Collect time ticks stats after each UMA upload. |
| 392 #if defined(OS_WIN) | 394 #if defined(OS_WIN) |
| 393 chrome::CollectTimeTicksStats(); | 395 chrome::CollectTimeTicksStats(); |
| 394 #endif | 396 #endif |
| 395 } | 397 } |
| 396 | 398 |
| 399 void ChromeMetricsServiceClient::OnLogCleanShutdown() { | |
| 400 #if defined(OS_WIN) | |
| 401 base::FilePath user_data_dir; | |
| 402 if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | |
| 403 // TODO(manzagop): add a metric. | |
| 404 return; | |
| 405 } | |
| 406 browser_watcher::MarkStabilityFileForDeletion(user_data_dir); | |
| 407 #endif // OS_WIN | |
| 408 } | |
| 409 | |
| 397 void ChromeMetricsServiceClient::InitializeSystemProfileMetrics( | 410 void ChromeMetricsServiceClient::InitializeSystemProfileMetrics( |
| 398 const base::Closure& done_callback) { | 411 const base::Closure& done_callback) { |
| 399 DCHECK(initialize_task_queue_.empty()); | 412 DCHECK(initialize_task_queue_.empty()); |
| 400 | 413 |
| 401 // Each provider's initializer takes its own "done_callback" to enable | 414 // Each provider's initializer takes its own "done_callback" to enable |
| 402 // asynchronously chaining. We bind |next_task| to this callback, so | 415 // asynchronously chaining. We bind |next_task| to this callback, so |
| 403 // OnInitNextTask() gets called after each initializer, and we can go through | 416 // OnInitNextTask() gets called after each initializer, and we can go through |
| 404 // successive tasks in |initialize_task_queue_|. Note that |next_task| is | 417 // successive tasks in |initialize_task_queue_|. Note that |next_task| is |
| 405 // copied by value when passed into base::Bind(). | 418 // copied by value when passed into base::Bind(). |
| 406 base::Closure next_task = | 419 base::Closure next_task = |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 879 } | 892 } |
| 880 } | 893 } |
| 881 | 894 |
| 882 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 895 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
| 883 metrics_service_->OnApplicationNotIdle(); | 896 metrics_service_->OnApplicationNotIdle(); |
| 884 } | 897 } |
| 885 | 898 |
| 886 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { | 899 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { |
| 887 return metrics::IsCellularLogicEnabled(); | 900 return metrics::IsCellularLogicEnabled(); |
| 888 } | 901 } |
| OLD | NEW |