Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h" | 5 #include "ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 #include "ios/chrome/browser/ui/browser_otr_state.h" | 50 #include "ios/chrome/browser/ui/browser_otr_state.h" |
| 51 #include "ios/chrome/common/channel_info.h" | 51 #include "ios/chrome/common/channel_info.h" |
| 52 #include "ios/web/public/web_thread.h" | 52 #include "ios/web/public/web_thread.h" |
| 53 | 53 |
| 54 namespace { | 54 namespace { |
| 55 | 55 |
| 56 // Standard interval between log uploads, in seconds. | 56 // Standard interval between log uploads, in seconds. |
| 57 const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes. | 57 const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes. |
| 58 const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes. | 58 const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Fifteen minutes. |
| 59 | 59 |
| 60 // Returns true if current connection type is cellular and user is assigned to | 60 // Assigns true to output param if current connection type is cellular and user |
| 61 // experimental group for enabled cellular uploads. | 61 // is assigned to experimental group for enabled cellular uploads. |
|
Alexei Svitkine (slow)
2016/03/31 20:00:40
What's the reason for this change? Seems like this
gayane -on leave until 09-2017
2016/03/31 21:55:10
I changed this function not to have a return value
| |
| 62 bool IsCellularLogicEnabled() { | 62 void IsCellularLogicEnabled(bool* out_is_enabled) { |
| 63 if (variations::GetVariationParamValue("UMA_EnableCellularLogUpload", | 63 if (variations::GetVariationParamValue("UMA_EnableCellularLogUpload", |
| 64 "Enabled") != "true" || | 64 "Enabled") != "true" || |
| 65 variations::GetVariationParamValue("UMA_EnableCellularLogUpload", | 65 variations::GetVariationParamValue("UMA_EnableCellularLogUpload", |
| 66 "Optimize") == "false") { | 66 "Optimize") == "false") { |
| 67 return false; | 67 *out_is_enabled = false; |
| 68 } else { | |
| 69 *out_is_enabled = net::NetworkChangeNotifier::IsConnectionCellular( | |
| 70 net::NetworkChangeNotifier::GetConnectionType()); | |
| 68 } | 71 } |
| 69 | |
| 70 return net::NetworkChangeNotifier::IsConnectionCellular( | |
| 71 net::NetworkChangeNotifier::GetConnectionType()); | |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 IOSChromeMetricsServiceClient::IOSChromeMetricsServiceClient( | 76 IOSChromeMetricsServiceClient::IOSChromeMetricsServiceClient( |
| 77 metrics::MetricsStateManager* state_manager) | 77 metrics::MetricsStateManager* state_manager) |
| 78 : metrics_state_manager_(state_manager), | 78 : metrics_state_manager_(state_manager), |
| 79 stability_metrics_provider_(nullptr), | 79 stability_metrics_provider_(nullptr), |
| 80 profiler_metrics_provider_(nullptr), | 80 profiler_metrics_provider_(nullptr), |
| 81 drive_metrics_provider_(nullptr), | 81 drive_metrics_provider_(nullptr), |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 IOSChromeMetricsServiceClient::CreateUploader( | 178 IOSChromeMetricsServiceClient::CreateUploader( |
| 179 const base::Callback<void(int)>& on_upload_complete) { | 179 const base::Callback<void(int)>& on_upload_complete) { |
| 180 return scoped_ptr<metrics::MetricsLogUploader>( | 180 return scoped_ptr<metrics::MetricsLogUploader>( |
| 181 new metrics::NetMetricsLogUploader( | 181 new metrics::NetMetricsLogUploader( |
| 182 GetApplicationContext()->GetSystemURLRequestContext(), | 182 GetApplicationContext()->GetSystemURLRequestContext(), |
| 183 metrics::kDefaultMetricsServerUrl, metrics::kDefaultMetricsMimeType, | 183 metrics::kDefaultMetricsServerUrl, metrics::kDefaultMetricsMimeType, |
| 184 on_upload_complete)); | 184 on_upload_complete)); |
| 185 } | 185 } |
| 186 | 186 |
| 187 base::TimeDelta IOSChromeMetricsServiceClient::GetStandardUploadInterval() { | 187 base::TimeDelta IOSChromeMetricsServiceClient::GetStandardUploadInterval() { |
| 188 if (IsCellularLogicEnabled()) | 188 bool is_cellular = false; |
| 189 IsCellularLogicEnabled(&is_cellular); | |
| 190 if (is_cellular) | |
| 189 return base::TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds); | 191 return base::TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds); |
| 190 return base::TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); | 192 return base::TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); |
| 191 } | 193 } |
| 192 | 194 |
| 193 base::string16 IOSChromeMetricsServiceClient::GetRegistryBackupKey() { | 195 base::string16 IOSChromeMetricsServiceClient::GetRegistryBackupKey() { |
| 194 return base::string16(); | 196 return base::string16(); |
| 195 } | 197 } |
| 196 | 198 |
| 197 void IOSChromeMetricsServiceClient::OnRendererProcessCrash() { | 199 void IOSChromeMetricsServiceClient::OnRendererProcessCrash() { |
| 198 stability_metrics_provider_->LogRendererCrash(); | 200 stability_metrics_provider_->LogRendererCrash(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 base::Unretained(this))); | 329 base::Unretained(this))); |
| 328 } | 330 } |
| 329 | 331 |
| 330 void IOSChromeMetricsServiceClient::OnTabParented(web::WebState* web_state) { | 332 void IOSChromeMetricsServiceClient::OnTabParented(web::WebState* web_state) { |
| 331 metrics_service_->OnApplicationNotIdle(); | 333 metrics_service_->OnApplicationNotIdle(); |
| 332 } | 334 } |
| 333 | 335 |
| 334 void IOSChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 336 void IOSChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
| 335 metrics_service_->OnApplicationNotIdle(); | 337 metrics_service_->OnApplicationNotIdle(); |
| 336 } | 338 } |
| OLD | NEW |