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

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

Issue 421653005: Adding synthetic field trial for DataReductionProxyEnabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@newPltWithCL
Patch Set: Created 6 years, 5 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/browser/data_reduction_proxy_settings.cc
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc
index 3f4f0ea1a3d4aa08e601a1dbb7db60c991e6d44b..06b7b764b2166b1de6d1ee9062ee98c17475d14e 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc
@@ -121,7 +121,8 @@ void DataReductionProxySettings::InitPrefMembers() {
void DataReductionProxySettings::InitDataReductionProxySettings(
PrefService* prefs,
PrefService* local_state_prefs,
- net::URLRequestContextGetter* url_request_context_getter) {
+ net::URLRequestContextGetter* url_request_context_getter,
+ const base::Callback<void(bool)>& on_data_reduction_proxy_enabled) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(prefs);
DCHECK(local_state_prefs);
@@ -129,8 +130,13 @@ void DataReductionProxySettings::InitDataReductionProxySettings(
prefs_ = prefs;
local_state_prefs_ = local_state_prefs;
url_request_context_getter_ = url_request_context_getter;
+ on_data_reduction_proxy_enabled_ = on_data_reduction_proxy_enabled;
InitPrefMembers();
RecordDataReductionInit();
+
+ on_data_reduction_proxy_enabled_.Run(
+ IsDataReductionProxyEnabled() ? true : false);
Alexei Svitkine (slow) 2014/07/30 17:27:04 I don't think you need the ternary operator here -
megjablon 2014/07/30 18:50:48 Facepalm. Done.
+
// Disable the proxy if it is not allowed to be used.
if (!params_->allowed())
return;
@@ -146,10 +152,12 @@ void DataReductionProxySettings::InitDataReductionProxySettings(
PrefService* prefs,
PrefService* local_state_prefs,
net::URLRequestContextGetter* url_request_context_getter,
- scoped_ptr<DataReductionProxyConfigurator> configurator) {
+ scoped_ptr<DataReductionProxyConfigurator> configurator,
+ const base::Callback<void(bool)>& on_data_reduction_proxy_enabled) {
InitDataReductionProxySettings(prefs,
local_state_prefs,
- url_request_context_getter);
+ url_request_context_getter,
+ on_data_reduction_proxy_enabled);
SetProxyConfigurator(configurator.Pass());
}
@@ -180,6 +188,8 @@ void DataReductionProxySettings::SetDataReductionProxyEnabled(bool enabled) {
if (spdy_proxy_auth_enabled_.GetValue() != enabled) {
spdy_proxy_auth_enabled_.SetValue(enabled);
+ on_data_reduction_proxy_enabled_.Run(
+ IsDataReductionProxyEnabled() ? true : false);
Alexei Svitkine (slow) 2014/07/30 17:27:04 Ditto.
megjablon 2014/07/30 18:50:48 Done.
OnProxyEnabledPrefChange();
}
}

Powered by Google App Engine
This is Rietveld 408576698