Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc

Issue 2791563002: Create feature and enable data collection for Data Saver site breakdown (Closed)
Patch Set: sclittle comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
index 80631551d9ca9468b1bfad08c933c6abd5e1dc44..b07e7dd8c8bbdafba501863d38e0ea58852e0d19 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
@@ -15,6 +16,7 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h"
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
@@ -103,6 +105,12 @@ void DataReductionProxySettings::InitDataReductionProxySettings(
UpdateConfigValues();
RecordDataReductionInit();
data_reduction_proxy_service_->InitializeLoFiPrefs();
+
+ if (base::FeatureList::IsEnabled(features::kDataReductionSiteBreakdown) &&
+ spdy_proxy_auth_enabled_.GetValue()) {
+ data_reduction_proxy_service_->compression_stats()
+ ->SetDataUsageReportingEnabled(true);
+ }
}
void DataReductionProxySettings::OnServiceInitialized() {
@@ -139,9 +147,14 @@ bool DataReductionProxySettings::IsDataReductionProxyManaged() {
void DataReductionProxySettings::SetDataReductionProxyEnabled(bool enabled) {
DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(data_reduction_proxy_service_->compression_stats());
if (spdy_proxy_auth_enabled_.GetValue() != enabled) {
spdy_proxy_auth_enabled_.SetValue(enabled);
OnProxyEnabledPrefChange();
+ if (base::FeatureList::IsEnabled(features::kDataReductionSiteBreakdown)) {
+ data_reduction_proxy_service_->compression_stats()
+ ->SetDataUsageReportingEnabled(enabled);
+ }
}
}
@@ -152,6 +165,13 @@ int64_t DataReductionProxySettings::GetDataReductionLastUpdateTime() {
data_reduction_proxy_service_->compression_stats()->GetLastUpdateTime();
}
+void DataReductionProxySettings::ClearDataSavingStatistics() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(data_reduction_proxy_service_->compression_stats());
+ data_reduction_proxy_service_->compression_stats()
+ ->ClearDataSavingStatistics();
+}
+
int64_t DataReductionProxySettings::GetTotalHttpContentLengthSaved() {
DCHECK(thread_checker_.CalledOnValidThread());
return data_reduction_proxy_service_->compression_stats()

Powered by Google App Engine
This is Rietveld 408576698