| Index: chrome/browser/metrics/chrome_metrics_service_client.cc
|
| diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc
|
| index 5f19fb208767611839e209b866f63896a59cbd48..fb8b7a5f481052b70bd68ae753fd05f4fba09d35 100644
|
| --- a/chrome/browser/metrics/chrome_metrics_service_client.cc
|
| +++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
|
| @@ -106,19 +106,6 @@ const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes.
|
| const int kStandardUploadIntervalSeconds = 30 * 60; // Thirty minutes.
|
| #endif
|
|
|
| -// Returns true if current connection type is cellular and user is assigned to
|
| -// experimental group for enabled cellular uploads.
|
| -bool IsCellularLogicEnabled() {
|
| - if (variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
|
| - "Enabled") != "true" ||
|
| - variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
|
| - "Optimize") == "false") {
|
| - return false;
|
| - }
|
| -
|
| - return net::NetworkChangeNotifier::IsConnectionCellular(
|
| - net::NetworkChangeNotifier::GetConnectionType());
|
| -}
|
|
|
| // Checks whether it is the first time that cellular uploads logic should be
|
| // enabled based on whether the the preference for that logic is initialized.
|
| @@ -311,7 +298,9 @@ ChromeMetricsServiceClient::CreateUploader(
|
|
|
| base::TimeDelta ChromeMetricsServiceClient::GetStandardUploadInterval() {
|
| #if defined(OS_ANDROID)
|
| - if (IsCellularLogicEnabled())
|
| + bool is_cellular = false;
|
| + IsCellularLogicEnabled(&is_cellular);
|
| + if (is_cellular)
|
| return base::TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds);
|
| #endif
|
| return base::TimeDelta::FromSeconds(kStandardUploadIntervalSeconds);
|
| @@ -355,7 +344,9 @@ void ChromeMetricsServiceClient::Initialize() {
|
| }
|
|
|
| metrics_service_.reset(new metrics::MetricsService(
|
| - metrics_state_manager_, this, g_browser_process->local_state()));
|
| + metrics_state_manager_, this, g_browser_process->local_state(),
|
| + base::Bind(&ChromeMetricsServiceClient::IsCellularLogicEnabled,
|
| + weak_ptr_factory_.GetWeakPtr())));
|
|
|
| // Register metrics providers.
|
| #if defined(ENABLE_EXTENSIONS)
|
| @@ -391,8 +382,9 @@ void ChromeMetricsServiceClient::Initialize() {
|
| metrics_service_->RegisterMetricsProvider(
|
| scoped_ptr<metrics::MetricsProvider>(drive_metrics_provider_));
|
|
|
| - profiler_metrics_provider_ =
|
| - new metrics::ProfilerMetricsProvider(base::Bind(&IsCellularLogicEnabled));
|
| + profiler_metrics_provider_ = new metrics::ProfilerMetricsProvider(
|
| + base::Bind(&ChromeMetricsServiceClient::IsCellularLogicEnabled,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| metrics_service_->RegisterMetricsProvider(
|
| scoped_ptr<metrics::MetricsProvider>(profiler_metrics_provider_));
|
|
|
| @@ -684,3 +676,17 @@ void ChromeMetricsServiceClient::Observe(
|
| void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) {
|
| metrics_service_->OnApplicationNotIdle();
|
| }
|
| +
|
| +// Assigns true to output param if current connection type is cellular and user
|
| +// is assigned to experimental group for enabled cellular uploads.
|
| +void ChromeMetricsServiceClient::IsCellularLogicEnabled(bool* out_is_enabled) {
|
| + if (variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
|
| + "Enabled") != "true" ||
|
| + variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
|
| + "Optimize") == "false") {
|
| + *out_is_enabled = false;
|
| + } else {
|
| + *out_is_enabled = net::NetworkChangeNotifier::IsConnectionCellular(
|
| + net::NetworkChangeNotifier::GetConnectionType());
|
| + }
|
| +}
|
|
|