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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #include "components/omnibox/browser/omnibox_metrics_provider.h" | 66 #include "components/omnibox/browser/omnibox_metrics_provider.h" |
67 #include "components/prefs/pref_registry_simple.h" | 67 #include "components/prefs/pref_registry_simple.h" |
68 #include "components/prefs/pref_service.h" | 68 #include "components/prefs/pref_service.h" |
69 #include "components/sync/device_info/device_count_metrics_provider.h" | 69 #include "components/sync/device_info/device_count_metrics_provider.h" |
70 #include "components/translate/core/browser/translate_ranker_metrics_provider.h" | 70 #include "components/translate/core/browser/translate_ranker_metrics_provider.h" |
71 #include "components/version_info/version_info.h" | 71 #include "components/version_info/version_info.h" |
72 #include "content/public/browser/browser_thread.h" | 72 #include "content/public/browser/browser_thread.h" |
73 #include "content/public/browser/histogram_fetcher.h" | 73 #include "content/public/browser/histogram_fetcher.h" |
74 #include "content/public/browser/notification_service.h" | 74 #include "content/public/browser/notification_service.h" |
75 #include "extensions/features/features.h" | 75 #include "extensions/features/features.h" |
| 76 #include "ppapi/features/features.h" |
76 #include "printing/features/features.h" | 77 #include "printing/features/features.h" |
77 | 78 |
78 #if BUILDFLAG(ANDROID_JAVA_UI) | 79 #if BUILDFLAG(ANDROID_JAVA_UI) |
79 #include "chrome/browser/metrics/android_metrics_provider.h" | 80 #include "chrome/browser/metrics/android_metrics_provider.h" |
80 #include "chrome/browser/metrics/page_load_metrics_provider.h" | 81 #include "chrome/browser/metrics/page_load_metrics_provider.h" |
81 #endif | 82 #endif |
82 | 83 |
83 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 84 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
84 #include "chrome/browser/service_process/service_process_control.h" | 85 #include "chrome/browser/service_process/service_process_control.h" |
85 #endif | 86 #endif |
86 | 87 |
87 #if BUILDFLAG(ENABLE_EXTENSIONS) | 88 #if BUILDFLAG(ENABLE_EXTENSIONS) |
88 #include "chrome/browser/metrics/extensions_metrics_provider.h" | 89 #include "chrome/browser/metrics/extensions_metrics_provider.h" |
89 #endif | 90 #endif |
90 | 91 |
91 #if defined(ENABLE_PLUGINS) | 92 #if BUILDFLAG(ENABLE_PLUGINS) |
92 #include "chrome/browser/metrics/plugin_metrics_provider.h" | 93 #include "chrome/browser/metrics/plugin_metrics_provider.h" |
93 #endif | 94 #endif |
94 | 95 |
95 #if defined(OS_CHROMEOS) | 96 #if defined(OS_CHROMEOS) |
96 #include "chrome/browser/metrics/chromeos_metrics_provider.h" | 97 #include "chrome/browser/metrics/chromeos_metrics_provider.h" |
97 #include "chrome/browser/signin/signin_status_metrics_provider_chromeos.h" | 98 #include "chrome/browser/signin/signin_status_metrics_provider_chromeos.h" |
98 #endif | 99 #endif |
99 | 100 |
100 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
101 #include <windows.h> | 102 #include <windows.h> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 266 |
266 ChromeMetricsServiceClient::ChromeMetricsServiceClient( | 267 ChromeMetricsServiceClient::ChromeMetricsServiceClient( |
267 metrics::MetricsStateManager* state_manager) | 268 metrics::MetricsStateManager* state_manager) |
268 : metrics_state_manager_(state_manager), | 269 : metrics_state_manager_(state_manager), |
269 #if defined(OS_CHROMEOS) | 270 #if defined(OS_CHROMEOS) |
270 chromeos_metrics_provider_(nullptr), | 271 chromeos_metrics_provider_(nullptr), |
271 #endif | 272 #endif |
272 waiting_for_collect_final_metrics_step_(false), | 273 waiting_for_collect_final_metrics_step_(false), |
273 num_async_histogram_fetches_in_progress_(0), | 274 num_async_histogram_fetches_in_progress_(0), |
274 profiler_metrics_provider_(nullptr), | 275 profiler_metrics_provider_(nullptr), |
275 #if defined(ENABLE_PLUGINS) | 276 #if BUILDFLAG(ENABLE_PLUGINS) |
276 plugin_metrics_provider_(nullptr), | 277 plugin_metrics_provider_(nullptr), |
277 #endif | 278 #endif |
278 #if defined(OS_WIN) | 279 #if defined(OS_WIN) |
279 google_update_metrics_provider_(nullptr), | 280 google_update_metrics_provider_(nullptr), |
280 watcher_metrics_provider_(nullptr), | 281 watcher_metrics_provider_(nullptr), |
281 antivirus_metrics_provider_(nullptr), | 282 antivirus_metrics_provider_(nullptr), |
282 #endif | 283 #endif |
283 drive_metrics_provider_(nullptr), | 284 drive_metrics_provider_(nullptr), |
284 start_time_(base::TimeTicks::Now()), | 285 start_time_(base::TimeTicks::Now()), |
285 has_uploaded_profiler_data_(false), | 286 has_uploaded_profiler_data_(false), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 metrics::StabilityMetricsHelper::RegisterPrefs(registry); | 322 metrics::StabilityMetricsHelper::RegisterPrefs(registry); |
322 | 323 |
323 RegisterFileMetricsPreferences(registry); | 324 RegisterFileMetricsPreferences(registry); |
324 | 325 |
325 metrics::RegisterMetricsReportingStatePrefs(registry); | 326 metrics::RegisterMetricsReportingStatePrefs(registry); |
326 | 327 |
327 #if BUILDFLAG(ANDROID_JAVA_UI) | 328 #if BUILDFLAG(ANDROID_JAVA_UI) |
328 AndroidMetricsProvider::RegisterPrefs(registry); | 329 AndroidMetricsProvider::RegisterPrefs(registry); |
329 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 330 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
330 | 331 |
331 #if defined(ENABLE_PLUGINS) | 332 #if BUILDFLAG(ENABLE_PLUGINS) |
332 PluginMetricsProvider::RegisterPrefs(registry); | 333 PluginMetricsProvider::RegisterPrefs(registry); |
333 #endif // defined(ENABLE_PLUGINS) | 334 #endif // BUILDFLAG(ENABLE_PLUGINS) |
334 } | 335 } |
335 | 336 |
336 metrics::MetricsService* ChromeMetricsServiceClient::GetMetricsService() { | 337 metrics::MetricsService* ChromeMetricsServiceClient::GetMetricsService() { |
337 return metrics_service_.get(); | 338 return metrics_service_.get(); |
338 } | 339 } |
339 | 340 |
340 void ChromeMetricsServiceClient::SetMetricsClientId( | 341 void ChromeMetricsServiceClient::SetMetricsClientId( |
341 const std::string& client_id) { | 342 const std::string& client_id) { |
342 crash_keys::SetMetricsClientIdFromGUID(client_id); | 343 crash_keys::SetMetricsClientIdFromGUID(client_id); |
343 } | 344 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 // Load hardware class information. | 416 // Load hardware class information. |
416 initialize_task_queue_.push_back( | 417 initialize_task_queue_.push_back( |
417 base::Bind(&ChromeOSMetricsProvider::InitTaskGetHardwareClass, | 418 base::Bind(&ChromeOSMetricsProvider::InitTaskGetHardwareClass, |
418 base::Unretained(chromeos_metrics_provider_), next_task)); | 419 base::Unretained(chromeos_metrics_provider_), next_task)); |
419 // Get a Bluetooth Adapter. | 420 // Get a Bluetooth Adapter. |
420 initialize_task_queue_.push_back( | 421 initialize_task_queue_.push_back( |
421 base::Bind(&ChromeOSMetricsProvider::InitTaskGetBluetoothAdapter, | 422 base::Bind(&ChromeOSMetricsProvider::InitTaskGetBluetoothAdapter, |
422 base::Unretained(chromeos_metrics_provider_), next_task)); | 423 base::Unretained(chromeos_metrics_provider_), next_task)); |
423 #endif // defined(OS_CHROMEOS) | 424 #endif // defined(OS_CHROMEOS) |
424 | 425 |
425 #if defined(ENABLE_PLUGINS) | 426 #if BUILDFLAG(ENABLE_PLUGINS) |
426 // Load plugin information. | 427 // Load plugin information. |
427 initialize_task_queue_.push_back( | 428 initialize_task_queue_.push_back( |
428 base::Bind(&PluginMetricsProvider::GetPluginInformation, | 429 base::Bind(&PluginMetricsProvider::GetPluginInformation, |
429 base::Unretained(plugin_metrics_provider_), next_task)); | 430 base::Unretained(plugin_metrics_provider_), next_task)); |
430 #endif // defined(ENABLE_PLUGINS) | 431 #endif // BUILDFLAG(ENABLE_PLUGINS) |
431 | 432 |
432 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 433 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
433 // Launch task to gather Google Update statistics. | 434 // Launch task to gather Google Update statistics. |
434 initialize_task_queue_.push_back( | 435 initialize_task_queue_.push_back( |
435 base::Bind(&GoogleUpdateMetricsProviderWin::GetGoogleUpdateData, | 436 base::Bind(&GoogleUpdateMetricsProviderWin::GetGoogleUpdateData, |
436 base::Unretained(google_update_metrics_provider_), next_task)); | 437 base::Unretained(google_update_metrics_provider_), next_task)); |
437 #endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 438 #endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
438 | 439 |
439 #if defined(OS_WIN) | 440 #if defined(OS_WIN) |
440 // Load AntiVirus metrics. | 441 // Load AntiVirus metrics. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 #if defined(OS_WIN) | 512 #if defined(OS_WIN) |
512 BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); | 513 BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); |
513 return distribution->GetRegistryPath().append(L"\\StabilityMetrics"); | 514 return distribution->GetRegistryPath().append(L"\\StabilityMetrics"); |
514 #else | 515 #else |
515 return base::string16(); | 516 return base::string16(); |
516 #endif | 517 #endif |
517 } | 518 } |
518 | 519 |
519 void ChromeMetricsServiceClient::OnPluginLoadingError( | 520 void ChromeMetricsServiceClient::OnPluginLoadingError( |
520 const base::FilePath& plugin_path) { | 521 const base::FilePath& plugin_path) { |
521 #if defined(ENABLE_PLUGINS) | 522 #if BUILDFLAG(ENABLE_PLUGINS) |
522 plugin_metrics_provider_->LogPluginLoadingError(plugin_path); | 523 plugin_metrics_provider_->LogPluginLoadingError(plugin_path); |
523 #else | 524 #else |
524 NOTREACHED(); | 525 NOTREACHED(); |
525 #endif // defined(ENABLE_PLUGINS) | 526 #endif // BUILDFLAG(ENABLE_PLUGINS) |
526 } | 527 } |
527 | 528 |
528 bool ChromeMetricsServiceClient::IsReportingPolicyManaged() { | 529 bool ChromeMetricsServiceClient::IsReportingPolicyManaged() { |
529 return IsMetricsReportingPolicyManaged(); | 530 return IsMetricsReportingPolicyManaged(); |
530 } | 531 } |
531 | 532 |
532 metrics::EnableMetricsDefault | 533 metrics::EnableMetricsDefault |
533 ChromeMetricsServiceClient::GetMetricsReportingDefaultState() { | 534 ChromeMetricsServiceClient::GetMetricsReportingDefaultState() { |
534 return metrics::GetMetricsReportingDefaultState( | 535 return metrics::GetMetricsReportingDefaultState( |
535 g_browser_process->local_state()); | 536 g_browser_process->local_state()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 638 |
638 antivirus_metrics_provider_ = new AntiVirusMetricsProvider( | 639 antivirus_metrics_provider_ = new AntiVirusMetricsProvider( |
639 content::BrowserThread::GetBlockingPool() | 640 content::BrowserThread::GetBlockingPool() |
640 ->GetTaskRunnerWithShutdownBehavior( | 641 ->GetTaskRunnerWithShutdownBehavior( |
641 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)); | 642 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)); |
642 | 643 |
643 metrics_service_->RegisterMetricsProvider( | 644 metrics_service_->RegisterMetricsProvider( |
644 std::unique_ptr<metrics::MetricsProvider>(antivirus_metrics_provider_)); | 645 std::unique_ptr<metrics::MetricsProvider>(antivirus_metrics_provider_)); |
645 #endif // defined(OS_WIN) | 646 #endif // defined(OS_WIN) |
646 | 647 |
647 #if defined(ENABLE_PLUGINS) | 648 #if BUILDFLAG(ENABLE_PLUGINS) |
648 plugin_metrics_provider_ = new PluginMetricsProvider(local_state); | 649 plugin_metrics_provider_ = new PluginMetricsProvider(local_state); |
649 metrics_service_->RegisterMetricsProvider( | 650 metrics_service_->RegisterMetricsProvider( |
650 std::unique_ptr<metrics::MetricsProvider>(plugin_metrics_provider_)); | 651 std::unique_ptr<metrics::MetricsProvider>(plugin_metrics_provider_)); |
651 #endif // defined(ENABLE_PLUGINS) | 652 #endif // BUILDFLAG(ENABLE_PLUGINS) |
652 | 653 |
653 #if defined(OS_CHROMEOS) | 654 #if defined(OS_CHROMEOS) |
654 ChromeOSMetricsProvider* chromeos_metrics_provider = | 655 ChromeOSMetricsProvider* chromeos_metrics_provider = |
655 new ChromeOSMetricsProvider; | 656 new ChromeOSMetricsProvider; |
656 chromeos_metrics_provider_ = chromeos_metrics_provider; | 657 chromeos_metrics_provider_ = chromeos_metrics_provider; |
657 metrics_service_->RegisterMetricsProvider( | 658 metrics_service_->RegisterMetricsProvider( |
658 std::unique_ptr<metrics::MetricsProvider>(chromeos_metrics_provider)); | 659 std::unique_ptr<metrics::MetricsProvider>(chromeos_metrics_provider)); |
659 | 660 |
660 SigninStatusMetricsProviderChromeOS* signin_metrics_provider_cros = | 661 SigninStatusMetricsProviderChromeOS* signin_metrics_provider_cros = |
661 new SigninStatusMetricsProviderChromeOS; | 662 new SigninStatusMetricsProviderChromeOS; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 } | 880 } |
880 } | 881 } |
881 | 882 |
882 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 883 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
883 metrics_service_->OnApplicationNotIdle(); | 884 metrics_service_->OnApplicationNotIdle(); |
884 } | 885 } |
885 | 886 |
886 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { | 887 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { |
887 return metrics::IsCellularLogicEnabled(); | 888 return metrics::IsCellularLogicEnabled(); |
888 } | 889 } |
OLD | NEW |