Chromium Code Reviews| Index: chrome/browser/profiles/profile_impl_io_data.cc |
| diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc |
| index b49d8075939e9c4bd950fb3b872d0f93d9e7a99b..99f1bd5413bff322298a5f1843be15830f740f57 100644 |
| --- a/chrome/browser/profiles/profile_impl_io_data.cc |
| +++ b/chrome/browser/profiles/profile_impl_io_data.cc |
| @@ -28,20 +28,14 @@ |
| #include "chrome/browser/net/http_server_properties_manager_factory.h" |
| #include "chrome/browser/net/predictor.h" |
| #include "chrome/browser/net/quota_policy_channel_id_store.h" |
| -#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| -#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h" |
| -#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h" |
| -#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h" |
| -#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h" |
| -#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h" |
| -#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h" |
| -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" |
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" |
| +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" |
|
sclittle
2015/01/14 22:54:46
Is this needed here?
bengr
2015/01/15 00:30:31
Nope. Done.
|
| #include "components/domain_reliability/monitor.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/cookie_store_factory.h" |
| @@ -90,7 +84,6 @@ net::BackendType ChooseCacheBackendType() { |
| } // namespace |
| using content::BrowserThread; |
| -using data_reduction_proxy::DataReductionProxyParams; |
| ProfileImplIOData::Handle::Handle(Profile* profile) |
| : io_data_(new ProfileImplIOData), |
| @@ -102,8 +95,6 @@ ProfileImplIOData::Handle::Handle(Profile* profile) |
| ProfileImplIOData::Handle::~Handle() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - io_data_->data_reduction_proxy_statistics_prefs()->WritePrefs(); |
| - |
| if (io_data_->predictor_ != NULL) { |
| // io_data_->predictor_ might be NULL if Init() was never called |
| // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). |
| @@ -119,7 +110,7 @@ ProfileImplIOData::Handle::~Handle() { |
| if (io_data_->http_server_properties_manager_) |
| io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); |
| - io_data_->data_reduction_proxy_enabled_.Destroy(); |
| + io_data_->data_reduction_proxy_io_data()->DestroyPrefsOnUIThread(); |
| io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); |
| } |
| @@ -138,15 +129,8 @@ void ProfileImplIOData::Handle::Init( |
| storage::SpecialStoragePolicy* special_storage_policy, |
| scoped_ptr<domain_reliability::DomainReliabilityMonitor> |
| domain_reliability_monitor, |
| - const base::Callback<void(bool)>& data_reduction_proxy_unavailable, |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> |
| - data_reduction_proxy_configurator, |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
| - data_reduction_proxy_params, |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
| - data_reduction_proxy_statistics_prefs, |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> |
| - data_reduction_proxy_event_store) { |
| + scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| + data_reduction_proxy_io_data) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| DCHECK(!io_data_->lazy_params_); |
| DCHECK(predictor); |
| @@ -179,15 +163,8 @@ void ProfileImplIOData::Handle::Init( |
| if (io_data_->domain_reliability_monitor_) |
| io_data_->domain_reliability_monitor_->MoveToNetworkThread(); |
| - io_data_->set_data_reduction_proxy_unavailable_callback( |
| - data_reduction_proxy_unavailable); |
| - io_data_->set_data_reduction_proxy_configurator( |
| - data_reduction_proxy_configurator.Pass()); |
| - io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass()); |
| - io_data_->set_data_reduction_proxy_statistics_prefs( |
| - data_reduction_proxy_statistics_prefs.Pass()); |
| - io_data_->set_data_reduction_proxy_event_store( |
| - data_reduction_proxy_event_store.Pass()); |
| + io_data_->set_data_reduction_proxy_io_data( |
| + data_reduction_proxy_io_data.Pass()); |
| } |
| content::ResourceContext* |
| @@ -367,9 +344,8 @@ void ProfileImplIOData::Handle::LazyInitialize() const { |
| io_data_->safe_browsing_enabled()->MoveToThread( |
| BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| #endif |
| - io_data_->data_reduction_proxy_enabled_.Init( |
| - data_reduction_proxy::prefs::kDataReductionProxyEnabled, pref_service); |
| - io_data_->data_reduction_proxy_enabled_.MoveToThread( |
| + io_data_->data_reduction_proxy_io_data()->InitPrefsOnUIThread( |
| + pref_service, |
| BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| io_data_->InitializeOnUIThread(profile_); |
| } |
| @@ -458,52 +434,6 @@ void ProfileImplIOData::InitializeInternal( |
| FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| "436671 ProfileImplIOData::InitializeInternal2")); |
| - set_data_reduction_proxy_auth_request_handler( |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> |
| - (new data_reduction_proxy::DataReductionProxyAuthRequestHandler( |
| - DataReductionProxyChromeSettings::GetClient(), |
| - data_reduction_proxy_params(), |
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); |
| - set_data_reduction_proxy_usage_stats( |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> |
| - (new data_reduction_proxy::DataReductionProxyUsageStats( |
| - data_reduction_proxy_params(), |
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) |
| - .get()))); |
| - data_reduction_proxy_usage_stats()->set_unavailable_callback( |
| - data_reduction_proxy_unavailable_callback()); |
| - |
| - // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| - tracked_objects::ScopedTracker tracking_profile3( |
| - FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| - "436671 ProfileImplIOData::InitializeInternal3")); |
| - |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> |
| - data_reduction_proxy_network_delegate( |
| - new data_reduction_proxy::DataReductionProxyNetworkDelegate( |
| - chrome_network_delegate.Pass(), |
| - data_reduction_proxy_params(), |
| - data_reduction_proxy_auth_request_handler(), |
| - base::Bind( |
| - &data_reduction_proxy::DataReductionProxyConfigurator:: |
| - GetProxyConfigOnIOThread, |
| - base::Unretained(data_reduction_proxy_configurator())))); |
| - data_reduction_proxy_network_delegate->InitProxyConfigOverrider( |
| - base::Bind(data_reduction_proxy::OnResolveProxyHandler)); |
| - data_reduction_proxy_network_delegate->InitStatisticsPrefsAndUMA( |
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| - data_reduction_proxy_statistics_prefs(), |
| - &data_reduction_proxy_enabled_, |
| - data_reduction_proxy_usage_stats()); |
| - network_delegate_ = data_reduction_proxy_network_delegate.Pass(); |
| - |
| - // Initialize context members. |
| - |
| - // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| - tracked_objects::ScopedTracker tracking_profile4( |
| - FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| - "436671 ProfileImplIOData::InitializeInternal4")); |
| - |
| ApplyProfileParamsToContext(main_context); |
| if (http_server_properties_manager_) |
| @@ -513,6 +443,9 @@ void ProfileImplIOData::InitializeInternal( |
| main_context->set_net_log(io_thread->net_log()); |
| + network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate( |
| + chrome_network_delegate.Pass(), true).Pass(); |
| + |
| main_context->set_network_delegate(network_delegate_.get()); |
| main_context->set_http_server_properties(http_server_properties()); |
| @@ -640,10 +573,7 @@ void ProfileImplIOData::InitializeInternal( |
| // as possible. |
| request_interceptors.insert( |
| request_interceptors.begin(), |
| - new data_reduction_proxy::DataReductionProxyInterceptor( |
| - data_reduction_proxy_params(), |
| - data_reduction_proxy_usage_stats(), |
| - data_reduction_proxy_event_store())); |
| + data_reduction_proxy_io_data()->CreateInterceptor()); |
| main_job_factory_ = SetUpJobFactoryDefaults( |
| main_job_factory.Pass(), |
| request_interceptors.Pass(), |
| @@ -797,10 +727,7 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext( |
| // as possible. |
| request_interceptors.insert( |
| request_interceptors.begin(), |
| - new data_reduction_proxy::DataReductionProxyInterceptor( |
| - data_reduction_proxy_params(), |
| - data_reduction_proxy_usage_stats(), |
| - data_reduction_proxy_event_store())); |
| + data_reduction_proxy_io_data()->CreateInterceptor()); |
| scoped_ptr<net::URLRequestJobFactory> top_job_factory( |
| SetUpJobFactoryDefaults(job_factory.Pass(), |
| request_interceptors.Pass(), |
| @@ -910,9 +837,3 @@ void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
| DCHECK(http_server_properties_manager_); |
| http_server_properties_manager_->Clear(completion); |
| } |
| - |
| -bool ProfileImplIOData::IsDataReductionProxyEnabled() const { |
| - return data_reduction_proxy_enabled_.GetValue() || |
| - base::CommandLine::ForCurrentProcess()->HasSwitch( |
| - data_reduction_proxy::switches::kEnableDataReductionProxy); |
| -} |