Chromium Code Reviews| 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/prefs/pref_member.h" | 10 #include "base/prefs/pref_member.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 // related prefs. | 247 // related prefs. |
| 248 if (!prefs) | 248 if (!prefs) |
| 249 return; | 249 return; |
| 250 // TODO(marq): Consider moving this so stats are wiped the first time the | 250 // TODO(marq): Consider moving this so stats are wiped the first time the |
| 251 // proxy settings are actually (not maybe) turned on. | 251 // proxy settings are actually (not maybe) turned on. |
| 252 if (spdy_proxy_auth_enabled_.GetValue() && | 252 if (spdy_proxy_auth_enabled_.GetValue() && |
| 253 !prefs->GetBoolean(prefs::kDataReductionProxyWasEnabledBefore)) { | 253 !prefs->GetBoolean(prefs::kDataReductionProxyWasEnabledBefore)) { |
| 254 prefs->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, true); | 254 prefs->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, true); |
| 255 ResetDataReductionStatistics(); | 255 ResetDataReductionStatistics(); |
| 256 } | 256 } |
| 257 if (!at_startup) { | |
| 258 if (IsDataReductionProxyEnabled()) | |
| 259 RecordSettingsEnabledState(DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON); | |
| 260 else | |
| 261 RecordSettingsEnabledState(DATA_REDUCTION_SETTINGS_ACTION_ON_TO_OFF); | |
| 262 } | |
| 257 // Configure use of the data reduction proxy if it is enabled. | 263 // Configure use of the data reduction proxy if it is enabled. |
| 258 if (at_startup && !data_reduction_proxy_service_->Initialized()) | 264 if (at_startup && !data_reduction_proxy_service_->Initialized()) |
| 259 deferred_initialization_ = true; | 265 deferred_initialization_ = true; |
| 260 else | 266 else |
| 261 UpdateIOData(at_startup); | 267 UpdateIOData(at_startup); |
| 262 } | 268 } |
| 263 | 269 |
| 264 DataReductionProxyEventStore* DataReductionProxySettings::GetEventStore() | 270 DataReductionProxyEventStore* DataReductionProxySettings::GetEventStore() |
| 265 const { | 271 const { |
| 266 if (data_reduction_proxy_service_) | 272 if (data_reduction_proxy_service_) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 282 | 288 |
| 283 RecordStartupState(state); | 289 RecordStartupState(state); |
| 284 } | 290 } |
| 285 | 291 |
| 286 void DataReductionProxySettings::RecordStartupState(ProxyStartupState state) { | 292 void DataReductionProxySettings::RecordStartupState(ProxyStartupState state) { |
| 287 UMA_HISTOGRAM_ENUMERATION(kUMAProxyStartupStateHistogram, | 293 UMA_HISTOGRAM_ENUMERATION(kUMAProxyStartupStateHistogram, |
| 288 state, | 294 state, |
| 289 PROXY_STARTUP_STATE_COUNT); | 295 PROXY_STARTUP_STATE_COUNT); |
| 290 } | 296 } |
| 291 | 297 |
| 298 void DataReductionProxySettings::RecordSettingsEnabledState( | |
|
sclittle
2015/10/09 20:52:48
It doesn't look like this function needs to be a m
Raj
2015/10/10 01:51:47
Done.
| |
| 299 DataReductionSettingsEnabledAction action) { | |
| 300 UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.EnabledState", action, | |
| 301 DATA_REDUCTION_SETTINGS_ACTION_BOUNDARY); | |
| 302 } | |
| 303 | |
| 292 void DataReductionProxySettings::RecordLoFiImplicitOptOutAction( | 304 void DataReductionProxySettings::RecordLoFiImplicitOptOutAction( |
| 293 LoFiImplicitOptOutAction action) const { | 305 LoFiImplicitOptOutAction action) const { |
| 294 net::NetworkChangeNotifier::ConnectionType connection_type = | 306 net::NetworkChangeNotifier::ConnectionType connection_type = |
| 295 net::NetworkChangeNotifier::GetConnectionType(); | 307 net::NetworkChangeNotifier::GetConnectionType(); |
| 296 | 308 |
| 297 switch (connection_type) { | 309 switch (connection_type) { |
| 298 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: | 310 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: |
| 299 UMA_HISTOGRAM_ENUMERATION( | 311 UMA_HISTOGRAM_ENUMERATION( |
| 300 "DataReductionProxy.LoFi.ImplicitOptOutAction.Unknown", action, | 312 "DataReductionProxy.LoFi.ImplicitOptOutAction.Unknown", action, |
| 301 LO_FI_OPT_OUT_ACTION_INDEX_BOUNDARY); | 313 LO_FI_OPT_OUT_ACTION_INDEX_BOUNDARY); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 int64* received_content_length, | 367 int64* received_content_length, |
| 356 int64* last_update_time) { | 368 int64* last_update_time) { |
| 357 DCHECK(thread_checker_.CalledOnValidThread()); | 369 DCHECK(thread_checker_.CalledOnValidThread()); |
| 358 DCHECK(data_reduction_proxy_service_->compression_stats()); | 370 DCHECK(data_reduction_proxy_service_->compression_stats()); |
| 359 | 371 |
| 360 data_reduction_proxy_service_->compression_stats()->GetContentLengths( | 372 data_reduction_proxy_service_->compression_stats()->GetContentLengths( |
| 361 days, original_content_length, received_content_length, last_update_time); | 373 days, original_content_length, received_content_length, last_update_time); |
| 362 } | 374 } |
| 363 | 375 |
| 364 } // namespace data_reduction_proxy | 376 } // namespace data_reduction_proxy |
| OLD | NEW |