Chromium Code Reviews| Index: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| index da920ffd4ef2d219fe45b6e10171b1aab8afce46..077d32c04dd52fff755e0f1fda4d99c70f6a61ff 100644 |
| --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/prefs/pref_service.h" |
| #include "base/prefs/scoped_user_pref_update.h" |
| +#include "base/time/time.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| #include "chrome/browser/prefs/proxy_prefs.h" |
| @@ -17,6 +18,7 @@ |
| #include "chrome/common/pref_names.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.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/browser/data_reduction_proxy_settings.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h" |
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
| @@ -67,26 +69,46 @@ void DataReductionProxyChromeSettings::MigrateDataReductionProxyOffProxyPrefs( |
| prefs->ClearPref(prefs::kProxy); |
| } |
| -DataReductionProxyChromeSettings::DataReductionProxyChromeSettings( |
| - scoped_ptr<DataReductionProxyParams> params) |
| - : DataReductionProxySettings(params.Pass()) { |
| +DataReductionProxyChromeSettings::DataReductionProxyChromeSettings() |
| + : DataReductionProxySettings() { |
| } |
| DataReductionProxyChromeSettings::~DataReductionProxyChromeSettings() { |
| } |
| +void DataReductionProxyChromeSettings::Shutdown() { |
| + data_reduction_proxy_service()->Shutdown(); |
| +} |
| + |
| void DataReductionProxyChromeSettings::InitDataReductionProxySettings( |
| data_reduction_proxy::DataReductionProxyIOData* io_data, |
| PrefService* profile_prefs, |
| - PrefService* local_state_prefs, |
| - net::URLRequestContextGetter* request_context) { |
| - SetProxyConfigurator(io_data->configurator()); |
| + net::URLRequestContextGetter* request_context, |
|
bengr
2015/02/20 00:00:36
request_context_getter
jeremyim
2015/02/20 02:17:17
Done.
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) { |
| +#if defined(OS_ANDROID) || defined(OS_IOS) |
| + // On mobile we write data reduction proxy prefs directly to the pref service. |
|
bengr
2015/02/20 00:00:36
"Data Reduction Proxy," everywhere.
jeremyim
2015/02/20 02:17:17
Done.
|
| + // On desktop we store data reduction proxy prefs in memory, writing to disk |
| + // every 60 minutes and on termination. Shutdown hooks must be added for |
| + // Android and iOS in order for non-zero delays to be supported. |
| + // (http://crbug.com/408264) |
| + base::TimeDelta commit_delay = base::TimeDelta(); |
| +#else |
| + base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
| +#endif |
| + |
| + scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
| + statistics_prefs = make_scoped_ptr( |
| + new data_reduction_proxy::DataReductionProxyStatisticsPrefs( |
| + profile_prefs, ui_task_runner, commit_delay)); |
| + scoped_ptr<data_reduction_proxy::DataReductionProxyService> |
| + service = make_scoped_ptr( |
| + new data_reduction_proxy::DataReductionProxyService( |
| + statistics_prefs.Pass(), this, request_context)); |
| DataReductionProxySettings::InitDataReductionProxySettings( |
| - profile_prefs, |
| - io_data->PassStatisticsPrefs(), |
| - request_context, |
| - io_data->net_log(), |
| - io_data->event_store()); |
| + profile_prefs, io_data, service.Pass()); |
| + io_data->SetDataReductionProxyService( |
| + data_reduction_proxy_service()->GetWeakPtr()); |
| + |
| DataReductionProxySettings::SetOnDataReductionEnabledCallback( |
| base::Bind(&DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial, |
| base::Unretained(this))); |