| 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 d54fd260a311eff6c830fb7a2aed178df9fe82d7..5d63307724306c8fa3dbdc3e99b8659542236090 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,28 +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,
|
| - bool enable_quic) {
|
| - SetProxyConfigurator(io_data->configurator());
|
| + net::URLRequestContextGetter* request_context_getter,
|
| + 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.
|
| + // 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_getter));
|
| DataReductionProxySettings::InitDataReductionProxySettings(
|
| - profile_prefs,
|
| - io_data->PassStatisticsPrefs(),
|
| - request_context,
|
| - io_data->net_log(),
|
| - io_data->event_store(),
|
| - enable_quic);
|
| + profile_prefs, io_data, service.Pass());
|
| + io_data->SetDataReductionProxyService(
|
| + data_reduction_proxy_service()->GetWeakPtr());
|
| +
|
| DataReductionProxySettings::SetOnDataReductionEnabledCallback(
|
| base::Bind(&DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial,
|
| base::Unretained(this)));
|
|
|