Chromium Code Reviews| 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(); |
| } |
| } |