| Index: chrome/browser/profiles/profile_impl.cc
|
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
|
| index 24b5935a81292cc50c2469439deb35b2fdef2f98..0768a66964024c4176dd2b4d885f93caac7d9b90 100644
|
| --- a/chrome/browser/profiles/profile_impl.cc
|
| +++ b/chrome/browser/profiles/profile_impl.cc
|
| @@ -45,6 +45,7 @@
|
| #include "chrome/browser/net/pref_proxy_config_tracker.h"
|
| #include "chrome/browser/net/proxy_service_factory.h"
|
| #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h"
|
| +#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
|
| #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
|
| #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
|
| #include "chrome/browser/net/ssl_config_service_manager.h"
|
| @@ -84,6 +85,7 @@
|
| #include "chrome/grit/chromium_strings.h"
|
| #include "components/bookmarks/browser/bookmark_model.h"
|
| #include "components/content_settings/core/browser/host_content_settings_map.h"
|
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.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"
|
| @@ -637,69 +639,30 @@ void ProfileImpl::DoFinalInit() {
|
| session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES;
|
| }
|
|
|
| + // TODO(bengr): Remove this in M-43.
|
| + data_reduction_proxy::MigrateStatisticsPrefs(g_browser_process->local_state(),
|
| + prefs_.get());
|
| +
|
| ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log();
|
|
|
| - base::Callback<void(bool)> data_reduction_proxy_unavailable;
|
| - scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
|
| - data_reduction_proxy_params;
|
| - scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
|
| - scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
|
| - data_reduction_proxy_statistics_prefs;
|
| - scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> event_store;
|
| - DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
|
| - DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
|
| - data_reduction_proxy_params =
|
| - data_reduction_proxy_chrome_settings->params()->Clone();
|
| - data_reduction_proxy_unavailable =
|
| - base::Bind(
|
| - &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
|
| - base::Unretained(data_reduction_proxy_chrome_settings));
|
| - // The event_store is used by DataReductionProxyChromeSettings, configurator,
|
| - // and ProfileIOData. Ownership is passed to the latter via
|
| - // ProfileIOData::Handle, which is only destroyed after
|
| - // BrowserContextKeyedServices, including DataReductionProxyChromeSettings
|
| - event_store.reset(
|
| - new data_reduction_proxy::DataReductionProxyEventStore(
|
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)));
|
| - // The configurator is used by DataReductionProxyChromeSettings and
|
| - // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle,
|
| - // which is only destroyed after BrowserContextKeyedServices,
|
| - // including DataReductionProxyChromeSettings.
|
| - chrome_configurator.reset(
|
| - new DataReductionProxyChromeConfigurator(
|
| - prefs_.get(),
|
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
|
| - net_log,
|
| - event_store.get()));
|
| - // Retain a raw pointer to use for initialization of data reduction proxy
|
| - // settings after ownership is passed
|
| - data_reduction_proxy::DataReductionProxyEventStore*
|
| - data_reduction_proxy_event_store = event_store.get();
|
| // Retain a raw pointer to use for initialization of data reduction proxy
|
| // settings after ownership is passed.
|
| DataReductionProxyChromeConfigurator*
|
| - data_reduction_proxy_chrome_configurator = chrome_configurator.get();
|
| -#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
|
| - // TODO(bengr): Remove this in M-43.
|
| - data_reduction_proxy::MigrateStatisticsPrefs(g_browser_process->local_state(),
|
| - prefs_.get());
|
| - data_reduction_proxy_statistics_prefs =
|
| - scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(
|
| - new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
|
| - prefs_.get(),
|
| - base::MessageLoopProxy::current(),
|
| - commit_delay));
|
| - data_reduction_proxy_chrome_settings->SetDataReductionProxyStatisticsPrefs(
|
| - data_reduction_proxy_statistics_prefs.get());
|
| + data_reduction_proxy_chrome_configurator = nullptr;
|
| +
|
| + scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
|
| + data_reduction_proxy_io_data =
|
| + CreateDataReductionProxyChromeIOData(
|
| + net_log, this, prefs_.get(),
|
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
|
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
|
| + &data_reduction_proxy_chrome_configurator).Pass();
|
| +
|
| + // Retain a raw pointer to use for initialization of data reduction proxy
|
| + // settings after ownership is passed
|
| + data_reduction_proxy::DataReductionProxyEventStore*
|
| + data_reduction_proxy_event_store =
|
| + data_reduction_proxy_io_data->event_store();
|
|
|
| // Make sure we initialize the ProfileIOData after everything else has been
|
| // initialized that we might be reading from the IO thread.
|
| @@ -709,18 +672,12 @@ void ProfileImpl::DoFinalInit() {
|
| extensions_cookie_path, GetPath(), infinite_cache_path,
|
| predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
|
| CreateDomainReliabilityMonitor(local_state),
|
| - data_reduction_proxy_unavailable,
|
| - chrome_configurator.Pass(),
|
| - data_reduction_proxy_params.Pass(),
|
| - data_reduction_proxy_statistics_prefs.Pass(),
|
| - event_store.Pass());
|
| - data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
|
| - data_reduction_proxy_chrome_configurator,
|
| - prefs_.get(),
|
| - g_browser_process->local_state(),
|
| - GetRequestContext(),
|
| - net_log,
|
| - data_reduction_proxy_event_store);
|
| + data_reduction_proxy_io_data.Pass());
|
| + DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this)->
|
| + InitDataReductionProxySettings(
|
| + data_reduction_proxy_chrome_configurator, prefs_.get(),
|
| + g_browser_process->local_state(), GetRequestContext(), net_log,
|
| + data_reduction_proxy_event_store);
|
|
|
| #if defined(ENABLE_PLUGINS)
|
| ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
|
|
|