Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc |
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc |
index 71d206e262ac18329d6267a954c12ac4d94040d7..b4f5122cf40186c6a86ece047727b9be1a4e7936 100644 |
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc |
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc |
@@ -10,11 +10,13 @@ |
#include "base/single_thread_task_runner.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_bypass_protocol.h" |
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.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_settings.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_event_store.h" |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
@@ -25,6 +27,7 @@ namespace data_reduction_proxy { |
DataReductionProxyIOData::DataReductionProxyIOData( |
const Client& client, |
+ int param_flags, |
scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs, |
DataReductionProxySettings* settings, |
net::NetLog* net_log, |
@@ -41,21 +44,33 @@ DataReductionProxyIOData::DataReductionProxyIOData( |
DCHECK(net_log); |
DCHECK(io_task_runner_.get()); |
DCHECK(ui_task_runner_.get()); |
- params_ = settings->params()->Clone(); |
+ scoped_ptr<DataReductionProxyParams> params( |
+ new DataReductionProxyParams(param_flags)); |
auth_request_handler_.reset(new DataReductionProxyAuthRequestHandler( |
- client_, params_.get(), io_task_runner_)); |
+ client_, params.get(), io_task_runner_)); |
event_store_.reset(new DataReductionProxyEventStore(ui_task_runner)); |
configurator_.reset(new DataReductionProxyConfigurator( |
io_task_runner, net_log, event_store_.get())); |
- proxy_delegate_.reset( |
- new data_reduction_proxy::DataReductionProxyDelegate( |
- auth_request_handler_.get(), params_.get())); |
+ proxy_delegate_.reset(new data_reduction_proxy::DataReductionProxyDelegate( |
+ auth_request_handler_.get(), params.get())); |
+ config_.reset(new DataReductionProxyConfig(io_task_runner_, net_log, |
+ params.Pass(), configurator_.get(), |
+ event_store_.get())); |
+} |
+ |
+DataReductionProxyIOData::DataReductionProxyIOData() { |
} |
DataReductionProxyIOData::~DataReductionProxyIOData() { |
DCHECK(shutdown_on_ui_); |
} |
+void DataReductionProxyIOData::Initialize( |
+ net::URLRequestContextGetter* context) { |
+ DCHECK(context); |
+ config_->InitURLRequestContext(context); |
+} |
+ |
void DataReductionProxyIOData::InitOnUIThread(PrefService* pref_service) { |
DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
enabled_.Init(prefs::kDataReductionProxyEnabled, pref_service); |
@@ -80,11 +95,40 @@ bool DataReductionProxyIOData::IsEnabled() const { |
switches::kEnableDataReductionProxy); |
} |
+DataReductionProxyConfig* DataReductionProxyIOData::config() const { |
+ return config_.get(); |
+} |
+ |
+DataReductionProxyConfigurator* DataReductionProxyIOData::configurator() const { |
+ return configurator_.get(); |
+} |
+ |
+DataReductionProxyEventStore* DataReductionProxyIOData::event_store() const { |
+ return event_store_.get(); |
+} |
+ |
+DataReductionProxyStatisticsPrefs* DataReductionProxyIOData::statistics_prefs() |
+ const { |
+ return statistics_prefs_.get(); |
+} |
+ |
+net::ProxyDelegate* DataReductionProxyIOData::proxy_delegate() const { |
+ return proxy_delegate_.get(); |
+} |
+ |
+net::NetLog* DataReductionProxyIOData::net_log() { |
+ return net_log_; |
+} |
+ |
+DataReductionProxyUsageStats* DataReductionProxyIOData::usage_stats() const { |
+ return usage_stats_.get(); |
+} |
+ |
scoped_ptr<net::URLRequestInterceptor> |
DataReductionProxyIOData::CreateInterceptor() { |
DCHECK(io_task_runner_->BelongsToCurrentThread()); |
return make_scoped_ptr(new DataReductionProxyInterceptor( |
- params_.get(), usage_stats_.get(), event_store_.get())); |
+ config_->params(), usage_stats_.get(), event_store_.get())); |
} |
void DataReductionProxyIOData::EnableCompressionStatisticsLogging( |
@@ -103,12 +147,12 @@ DataReductionProxyIOData::CreateNetworkDelegate( |
DCHECK(io_task_runner_->BelongsToCurrentThread()); |
scoped_ptr<DataReductionProxyNetworkDelegate> network_delegate( |
new DataReductionProxyNetworkDelegate( |
- wrapped_network_delegate.Pass(), params_.get(), |
+ wrapped_network_delegate.Pass(), config_->params(), |
auth_request_handler_.get(), configurator_.get())); |
if (track_proxy_bypass_statistics && !usage_stats_) { |
usage_stats_.reset( |
new data_reduction_proxy::DataReductionProxyUsageStats( |
- params_.get(), settings_, ui_task_runner_)); |
+ config_->params(), settings_, ui_task_runner_)); |
network_delegate->InitStatisticsPrefsAndUMA( |
ui_task_runner_, statistics_prefs_.get(), &enabled_, |
usage_stats_.get()); |