Chromium Code Reviews| Index: chrome/browser/io_thread.cc |
| diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
| index 595c01b03d5777bca0797ecce8051c57e56ba4fc..b7650ea073790ad209721e64e2e791aae27be7c6 100644 |
| --- a/chrome/browser/io_thread.cc |
| +++ b/chrome/browser/io_thread.cc |
| @@ -39,7 +39,11 @@ |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/chrome_version_info.h" |
| #include "chrome/common/pref_names.h" |
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h" |
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" |
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h" |
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h" |
| #include "components/policy/core/common/policy_service.h" |
| #include "components/variations/variations_associated_data.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -94,13 +98,6 @@ |
| #include "net/ocsp/nss_ocsp.h" |
| #endif |
| -#if defined(SPDY_PROXY_AUTH_ORIGIN) |
| -#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| -#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.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" |
| -#endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
| - |
| #if defined(OS_CHROMEOS) |
| #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
| #include "chromeos/network/host_resolver_impl_chromeos.h" |
| @@ -539,6 +536,38 @@ void IOThread::Init() { |
| // the UI thread |
| } |
| +void IOThread::SetupDataReductionProxy( |
| + ChromeNetworkDelegate* network_delegate) { |
|
mmenke
2014/09/05 16:29:09
Definition order should match declaration order.
Not at Google. Contact bengr
2014/09/05 21:24:35
Done.
|
| + int flags = data_reduction_proxy::DataReductionProxyParams::kAllowed | |
| + data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed; |
| + if (data_reduction_proxy::DataReductionProxyParams:: |
| + IsIncludedInAlternativeFieldTrial()) |
|
mmenke
2014/09/05 16:29:10
Use braces in multi-line if statements (x3).
Not at Google. Contact bengr
2014/09/05 21:24:35
Done.
|
| + flags |= |
| + data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed; |
| + if (data_reduction_proxy::DataReductionProxyParams:: |
| + IsIncludedInPromoFieldTrial()) |
| + flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed; |
| + if (data_reduction_proxy::DataReductionProxyParams:: |
| + IsIncludedInHoldbackFieldTrial()) |
| + flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback; |
| + globals_->data_reduction_proxy_params.reset( |
| + new data_reduction_proxy::DataReductionProxyParams(flags)); |
| + globals_->data_reduction_proxy_auth_request_handler.reset( |
| + new data_reduction_proxy::DataReductionProxyAuthRequestHandler( |
| + DataReductionProxyChromeSettings::GetClient(), |
| + DataReductionProxyChromeSettings::GetBuildAndPatchNumber(), |
| + globals_->data_reduction_proxy_params.get(), |
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| + // This is the same as in ProfileImplIOData except that we do not collect |
| + // usage stats. |
| + network_delegate->set_data_reduction_proxy_params( |
| + globals_->data_reduction_proxy_params.get()); |
| + network_delegate->set_data_reduction_proxy_auth_request_handler( |
| + globals_->data_reduction_proxy_auth_request_handler.get()); |
| + network_delegate->set_on_resolve_proxy_handler( |
| + base::Bind(data_reduction_proxy::OnResolveProxyHandler)); |
| +} |
| + |
| void IOThread::InitAsync() { |
| TRACE_EVENT0("startup", "IOThread::InitAsync"); |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| @@ -625,44 +654,7 @@ void IOThread::InitAsync() { |
| } |
| globals_->ssl_config_service = GetSSLConfigService(); |
| - |
| -#if defined(SPDY_PROXY_AUTH_ORIGIN) |
| - int drp_flags = 0; |
| - if (data_reduction_proxy::DataReductionProxyParams:: |
| - IsIncludedInFieldTrial()) { |
| - drp_flags |= |
| - (data_reduction_proxy::DataReductionProxyParams::kAllowed | |
| - data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed); |
| - } |
| - if (data_reduction_proxy::DataReductionProxyParams:: |
| - IsIncludedInAlternativeFieldTrial()) { |
| - drp_flags |= |
| - data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed; |
| - } |
| - if (data_reduction_proxy::DataReductionProxyParams:: |
| - IsIncludedInPromoFieldTrial()) |
| - drp_flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed; |
| - if (data_reduction_proxy::DataReductionProxyParams:: |
| - IsIncludedInHoldbackFieldTrial()) |
| - drp_flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback; |
| - globals_->data_reduction_proxy_params.reset( |
| - new data_reduction_proxy::DataReductionProxyParams(drp_flags)); |
| - globals_->data_reduction_proxy_auth_request_handler.reset( |
| - new data_reduction_proxy::DataReductionProxyAuthRequestHandler( |
| - DataReductionProxyChromeSettings::GetClient(), |
| - DataReductionProxyChromeSettings::GetBuildAndPatchNumber(), |
| - globals_->data_reduction_proxy_params.get(), |
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| - // This is the same as in ProfileImplIOData except that we do not collect |
| - // usage stats. |
| - network_delegate->set_data_reduction_proxy_params( |
| - globals_->data_reduction_proxy_params.get()); |
| - network_delegate->set_data_reduction_proxy_auth_request_handler( |
| - globals_->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) |
| - |
| + SetupDataReductionProxy(network_delegate); |
|
mmenke
2014/09/05 16:29:09
Question: The NetworkDelegate for system context
mmenke
2014/09/05 16:29:10
Also, we never call InitDataReductionProxySettings
Not at Google. Contact bengr
2014/09/05 21:24:35
Currently, data reduction proxy is turned on and o
|
| globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
| globals_->host_resolver.get())); |
| globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); |
| @@ -1102,6 +1094,7 @@ void IOThread::InitSystemRequestContextOnIOThread() { |
| system_proxy_config_service_.release(), |
| command_line, |
| quick_check_enabled_.GetValue())); |
| + DCHECK(globals_->data_reduction_proxy_params); |
| net::HttpNetworkSession::Params system_params; |
| InitializeNetworkSessionParams(&system_params); |