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..d5fb7e25ec896009680438840c0cf48c62716b97 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,17 +10,23 @@ |
#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" |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" |
#include "net/base/net_log.h" |
+#if defined(OS_ANDROID) |
+#include "base/android/build_info.h" |
+#endif |
+ |
namespace data_reduction_proxy { |
DataReductionProxyIOData::DataReductionProxyIOData( |
@@ -41,21 +47,45 @@ DataReductionProxyIOData::DataReductionProxyIOData( |
DCHECK(net_log); |
DCHECK(io_task_runner_.get()); |
DCHECK(ui_task_runner_.get()); |
- params_ = settings->params()->Clone(); |
+ int flags = DataReductionProxyParams::kAllowed; |
+ if (client != Client::WEBVIEW_ANDROID) { |
bengr
2015/02/03 21:51:58
This is bad. Please have each platform inject its
jeremyim
2015/02/04 01:31:21
Done.
|
+ flags |= DataReductionProxyParams::kFallbackAllowed | |
+ DataReductionProxyParams::kAlternativeAllowed; |
+ if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) |
+ flags |= DataReductionProxyParams::kPromoAllowed; |
+ if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) |
+ flags |= DataReductionProxyParams::kHoldback; |
+ #if defined(OS_ANDROID) |
bengr
2015/02/03 21:51:58
Likewise, as much as possible I'd like to keep our
jeremyim
2015/02/04 01:31:21
Done.
|
+ if (DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial( |
+ base::android::BuildInfo::GetInstance()->android_build_fp())) { |
+ flags |= DataReductionProxyParams::kPromoAllowed; |
+ } |
+ #endif |
+ } |
+ scoped_ptr<DataReductionProxyParams> params( |
+ new DataReductionProxyParams(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() { |
DCHECK(shutdown_on_ui_); |
} |
+void DataReductionProxyIOData::InitURLRequestContext( |
+ 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); |
@@ -84,7 +114,7 @@ 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 +133,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()); |