#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/chrome_net_log.h"
#include "chrome/browser/net/chrome_network_delegate.h"
+#include "chrome/browser/net/chrome_sdch_policy.h"
#include "chrome/browser/net/connect_interceptor.h"
#include "chrome/browser/net/cookie_store_util.h"
#include "chrome/browser/net/http_server_properties_manager_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.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_statistics_prefs.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"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol.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/common/data_reduction_proxy_pref_names.h"
#include "components/domain_reliability/monitor.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/common/constants.h"
#include "net/base/cache_type.h"
-#include "net/base/sdch_dictionary_fetcher.h"
#include "net/base/sdch_manager.h"
#include "net/ftp/ftp_network_layer.h"
#include "net/http/http_cache.h"
#include "net/http/http_server_properties_manager.h"
#include "net/ssl/channel_id_service.h"
+#include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "storage/browser/quota/special_storage_policy.h"
if (io_data_->http_server_properties_manager_)
io_data_->http_server_properties_manager_->ShutdownOnPrefThread();
- if (io_data_->domain_reliability_monitor_)
- io_data_->domain_reliability_monitor_->DestroyReportingPref();
-
+ io_data_->data_reduction_proxy_enabled()->Destroy();
io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass());
}
}
void ProfileImplIOData::Handle::LazyInitialize() const {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (initialized_)
return;
data_reduction_proxy_usage_stats()->set_unavailable_callback(
data_reduction_proxy_unavailable_callback());
+ network_delegate()->set_data_reduction_proxy_enabled_pref(
+ &data_reduction_proxy_enabled_);
network_delegate()->set_data_reduction_proxy_params(
data_reduction_proxy_params());
network_delegate()->set_data_reduction_proxy_usage_stats(
scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
new net::URLRequestJobFactoryImpl());
InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
+ // The data reduction proxy interceptor should be as close to the network
+ // as possible.
+ request_interceptors.insert(
+ request_interceptors.begin(),
+ new data_reduction_proxy::DataReductionProxyInterceptor(
+ data_reduction_proxy_params(),
+ data_reduction_proxy_usage_stats()));
main_job_factory_ = SetUpJobFactoryDefaults(
main_job_factory.Pass(),
request_interceptors.Pass(),
InitializeExtensionsRequestContext(profile_params);
#endif
- // Setup the SDCHManager for this profile.
+ // Setup SDCH for this profile.
sdch_manager_.reset(new net::SdchManager);
- sdch_manager_->set_sdch_fetcher(scoped_ptr<net::SdchFetcher>(
- new net::SdchDictionaryFetcher(sdch_manager_.get(),
- main_context)).Pass());
+ sdch_policy_.reset(new ChromeSdchPolicy(sdch_manager_.get(), main_context));
main_context->set_sdch_manager(sdch_manager_.get());
// Create a media request context based on the main context, but using a
domain_reliability_monitor_.get();
monitor->InitURLRequestContext(main_context);
monitor->AddBakedInConfigs();
+ monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
network_delegate()->set_domain_reliability_monitor(monitor);
}
// Transfer ownership of the cookies and cache to AppRequestContext.
context->SetCookieStore(cookie_store.get());
- context->SetHttpTransactionFactory(
- scoped_ptr<net::HttpTransactionFactory>(
- app_http_cache.PassAs<net::HttpTransactionFactory>()));
+ context->SetHttpTransactionFactory(app_http_cache.Pass());
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
InstallProtocolHandlers(job_factory.get(), protocol_handlers);
+ // The data reduction proxy interceptor should be as close to the network
+ // as possible.
+ request_interceptors.insert(
+ request_interceptors.begin(),
+ new data_reduction_proxy::DataReductionProxyInterceptor(
+ data_reduction_proxy_params(),
+ data_reduction_proxy_usage_stats()));
scoped_ptr<net::URLRequestJobFactory> top_job_factory(
SetUpJobFactoryDefaults(job_factory.Pass(),
request_interceptors.Pass(),
CreateHttpFactory(main_network_session, media_backend);
// Transfer ownership of the cache to MediaRequestContext.
- context->SetHttpTransactionFactory(
- media_http_cache.PassAs<net::HttpTransactionFactory>());
+ context->SetHttpTransactionFactory(media_http_cache.Pass());
// Note that we do not create a new URLRequestJobFactory because
// the media context should behave exactly like its parent context
DCHECK(http_server_properties_manager_);
http_server_properties_manager_->Clear(completion);
}
+
+bool ProfileImplIOData::IsDataReductionProxyEnabled() const {
+ return data_reduction_proxy_enabled_.GetValue() ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ data_reduction_proxy::switches::kEnableDataReductionProxy);
+}