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 eff5ad5e245e72955b73626a7522fb1773a50f43..cb28c91dd6e6c5de3d061efca1328167bbc1e4d5 100644 |
--- a/chrome/browser/profiles/profile_impl_io_data.cc |
+++ b/chrome/browser/profiles/profile_impl_io_data.cc |
@@ -50,6 +50,13 @@ |
#include "net/url_request/url_request_job_factory_impl.h" |
#include "webkit/browser/quota/special_storage_policy.h" |
+#if defined(SPDY_PROXY_AUTH_ORIGIN) |
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h" |
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h" |
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h" |
+#include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h" |
+#endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
+ |
namespace { |
net::BackendType ChooseCacheBackendType() { |
@@ -78,6 +85,9 @@ net::BackendType ChooseCacheBackendType() { |
} // namespace |
using content::BrowserThread; |
+#if defined(SPDY_PROXY_AUTH_ORIGIN) |
+using data_reduction_proxy::DataReductionProxyParams; |
+#endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
ProfileImplIOData::Handle::Handle(Profile* profile) |
: io_data_(new ProfileImplIOData), |
@@ -120,7 +130,10 @@ void ProfileImplIOData::Handle::Init( |
content::CookieStoreConfig::SessionCookieMode session_cookie_mode, |
quota::SpecialStoragePolicy* special_storage_policy, |
scoped_ptr<domain_reliability::DomainReliabilityMonitor> |
- domain_reliability_monitor) { |
+ domain_reliability_monitor, |
+ const base::Callback<void(bool)>& data_reduction_proxy_unavailable, |
+ scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
+ data_reduction_proxy_params) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(!io_data_->lazy_params_); |
DCHECK(predictor); |
@@ -150,6 +163,13 @@ void ProfileImplIOData::Handle::Init( |
io_data_->domain_reliability_monitor_ = domain_reliability_monitor.Pass(); |
io_data_->InitializeMetricsEnabledStateOnUIThread(); |
+ |
+#if defined(SPDY_PROXY_AUTH_ORIGIN) |
+ io_data_->data_reduction_proxy_unavailable_callback_ = |
+ data_reduction_proxy_unavailable; |
+ io_data_->data_reduction_proxy_params_ = |
+ data_reduction_proxy_params.Pass(); |
+#endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
} |
content::ResourceContext* |
@@ -328,12 +348,12 @@ void ProfileImplIOData::Handle::LazyInitialize() const { |
io_data_->safe_browsing_enabled()->MoveToThread( |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
#endif |
-#if defined(OS_ANDROID) || defined(OS_IOS) |
+#if defined(SPDY_PROXY_AUTH_ORIGIN) |
io_data_->data_reduction_proxy_enabled()->Init( |
data_reduction_proxy::prefs::kDataReductionProxyEnabled, pref_service); |
io_data_->data_reduction_proxy_enabled()->MoveToThread( |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
-#endif |
+#endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
io_data_->InitializeOnUIThread(profile_); |
} |
@@ -371,6 +391,29 @@ void ProfileImplIOData::InitializeInternal( |
IOThread* const io_thread = profile_params->io_thread; |
IOThread::Globals* const io_thread_globals = io_thread->globals(); |
+#if defined(SPDY_PROXY_AUTH_ORIGIN) |
+ data_reduction_proxy_auth_request_handler_.reset( |
+ new data_reduction_proxy::DataReductionProxyAuthRequestHandler( |
+ data_reduction_proxy_params_.get(), |
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
+ data_reduction_proxy_usage_stats_.reset( |
+ new data_reduction_proxy::DataReductionProxyUsageStats( |
+ data_reduction_proxy_params_.get(), |
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); |
+ data_reduction_proxy_usage_stats_->set_unavailable_callback( |
+ data_reduction_proxy_unavailable_callback_); |
+ |
+ |
+ network_delegate()->set_data_reduction_proxy_params( |
+ data_reduction_proxy_params_.get()); |
+ network_delegate()->set_data_reduction_proxy_usage_stats( |
+ data_reduction_proxy_usage_stats_.get()); |
+ network_delegate()->set_data_reduction_proxy_auth_request_handler( |
+ data_reduction_proxy_auth_request_handler_.get()); |
+ network_delegate()->set_on_resolve_proxy_handler( |
+ base::Bind(data_reduction_proxy::OnResolveProxyHandler)); |
+#endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
+ |
network_delegate()->set_predictor(predictor_.get()); |
// Initialize context members. |