| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
| 37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/crash_keys.h" | 38 #include "chrome/common/crash_keys.h" |
| 39 #include "chrome/common/features.h" | 39 #include "chrome/common/features.h" |
| 40 #include "chrome/installer/util/util_constants.h" | 40 #include "chrome/installer/util/util_constants.h" |
| 41 #include "components/metrics/call_stack_profile_metrics_provider.h" | 41 #include "components/metrics/call_stack_profile_metrics_provider.h" |
| 42 #include "components/metrics/drive_metrics_provider.h" | 42 #include "components/metrics/drive_metrics_provider.h" |
| 43 #include "components/metrics/file_metrics_provider.h" | 43 #include "components/metrics/file_metrics_provider.h" |
| 44 #include "components/metrics/gpu/gpu_metrics_provider.h" | 44 #include "components/metrics/gpu/gpu_metrics_provider.h" |
| 45 #include "components/metrics/metrics_pref_names.h" | 45 #include "components/metrics/metrics_pref_names.h" |
| 46 #include "components/metrics/metrics_reporting_default_state.h" |
| 46 #include "components/metrics/metrics_service.h" | 47 #include "components/metrics/metrics_service.h" |
| 47 #include "components/metrics/metrics_service_client.h" | 48 #include "components/metrics/metrics_service_client.h" |
| 48 #include "components/metrics/metrics_state_manager.h" | 49 #include "components/metrics/metrics_state_manager.h" |
| 49 #include "components/metrics/net/cellular_logic_helper.h" | 50 #include "components/metrics/net/cellular_logic_helper.h" |
| 50 #include "components/metrics/net/net_metrics_log_uploader.h" | 51 #include "components/metrics/net/net_metrics_log_uploader.h" |
| 51 #include "components/metrics/net/network_metrics_provider.h" | 52 #include "components/metrics/net/network_metrics_provider.h" |
| 52 #include "components/metrics/net/version_utils.h" | 53 #include "components/metrics/net/version_utils.h" |
| 53 #include "components/metrics/profiler/profiler_metrics_provider.h" | 54 #include "components/metrics/profiler/profiler_metrics_provider.h" |
| 54 #include "components/metrics/profiler/tracking_synchronizer.h" | 55 #include "components/metrics/profiler/tracking_synchronizer.h" |
| 55 #include "components/metrics/stability_metrics_helper.h" | 56 #include "components/metrics/stability_metrics_helper.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 return client; | 244 return client; |
| 244 } | 245 } |
| 245 | 246 |
| 246 // static | 247 // static |
| 247 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { | 248 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { |
| 248 metrics::MetricsService::RegisterPrefs(registry); | 249 metrics::MetricsService::RegisterPrefs(registry); |
| 249 metrics::StabilityMetricsHelper::RegisterPrefs(registry); | 250 metrics::StabilityMetricsHelper::RegisterPrefs(registry); |
| 250 | 251 |
| 251 RegisterInstallerFileMetricsPreferences(registry); | 252 RegisterInstallerFileMetricsPreferences(registry); |
| 252 | 253 |
| 253 RegisterMetricsReportingStatePrefs(registry); | 254 metrics::RegisterMetricsReportingStatePrefs(registry); |
| 254 | 255 |
| 255 #if BUILDFLAG(ANDROID_JAVA_UI) | 256 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 256 AndroidMetricsProvider::RegisterPrefs(registry); | 257 AndroidMetricsProvider::RegisterPrefs(registry); |
| 257 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 258 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 258 | 259 |
| 259 #if defined(ENABLE_PLUGINS) | 260 #if defined(ENABLE_PLUGINS) |
| 260 PluginMetricsProvider::RegisterPrefs(registry); | 261 PluginMetricsProvider::RegisterPrefs(registry); |
| 261 #endif // defined(ENABLE_PLUGINS) | 262 #endif // defined(ENABLE_PLUGINS) |
| 262 } | 263 } |
| 263 | 264 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 NOTREACHED(); | 370 NOTREACHED(); |
| 370 #endif // defined(ENABLE_PLUGINS) | 371 #endif // defined(ENABLE_PLUGINS) |
| 371 } | 372 } |
| 372 | 373 |
| 373 bool ChromeMetricsServiceClient::IsReportingPolicyManaged() { | 374 bool ChromeMetricsServiceClient::IsReportingPolicyManaged() { |
| 374 return IsMetricsReportingPolicyManaged(); | 375 return IsMetricsReportingPolicyManaged(); |
| 375 } | 376 } |
| 376 | 377 |
| 377 metrics::MetricsServiceClient::EnableMetricsDefault | 378 metrics::MetricsServiceClient::EnableMetricsDefault |
| 378 ChromeMetricsServiceClient::GetDefaultOptIn() { | 379 ChromeMetricsServiceClient::GetDefaultOptIn() { |
| 379 return GetMetricsReportingDefaultOptIn(g_browser_process->local_state()); | 380 return metrics::GetMetricsReportingDefaultOptIn( |
| 381 g_browser_process->local_state()); |
| 380 } | 382 } |
| 381 | 383 |
| 382 void ChromeMetricsServiceClient::Initialize() { | 384 void ChromeMetricsServiceClient::Initialize() { |
| 383 // Clear metrics reports if it is the first time cellular upload logic should | 385 // Clear metrics reports if it is the first time cellular upload logic should |
| 384 // apply to avoid sudden bulk uploads. It needs to be done before initializing | 386 // apply to avoid sudden bulk uploads. It needs to be done before initializing |
| 385 // metrics service so that metrics log manager is initialized correctly. | 387 // metrics service so that metrics log manager is initialized correctly. |
| 386 if (ShouldClearSavedMetrics()) { | 388 if (ShouldClearSavedMetrics()) { |
| 387 PrefService* local_state = g_browser_process->local_state(); | 389 PrefService* local_state = g_browser_process->local_state(); |
| 388 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs); | 390 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs); |
| 389 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs); | 391 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 } | 729 } |
| 728 } | 730 } |
| 729 | 731 |
| 730 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 732 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
| 731 metrics_service_->OnApplicationNotIdle(); | 733 metrics_service_->OnApplicationNotIdle(); |
| 732 } | 734 } |
| 733 | 735 |
| 734 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { | 736 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { |
| 735 return metrics::IsCellularLogicEnabled(); | 737 return metrics::IsCellularLogicEnabled(); |
| 736 } | 738 } |
| OLD | NEW |