| 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 cd2abf0d770704fd60a0f6ba5744692588cf7cbf..b73b44b2e3b55a62e63e4cc0d4588ca912c70ed8 100644
|
| --- a/chrome/browser/metrics/chrome_metrics_service_client.cc
|
| +++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
|
| @@ -104,19 +104,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.
|
| @@ -342,7 +329,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)
|
| @@ -378,8 +367,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_));
|
|
|
| @@ -671,3 +661,17 @@ void ChromeMetricsServiceClient::Observe(
|
| void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) {
|
| metrics_service_->OnApplicationNotIdle();
|
| }
|
| +
|
| +// Assigns true 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());
|
| + }
|
| +}
|
|
|