summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles/profile_impl_io_data.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/profiles/profile_impl_io_data.cc')
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc52
1 files changed, 49 insertions, 3 deletions
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 4d12e68..1c49b31 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -50,6 +50,14 @@
#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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
+#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 +86,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),
@@ -140,7 +151,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);
@@ -170,6 +184,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*
@@ -348,12 +369,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_);
}
@@ -391,6 +412,31 @@ 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(
+ DataReductionProxyChromeSettings::GetClient(),
+ DataReductionProxyChromeSettings::GetBuildAndPatchNumber(),
+ 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.